akhauriyash/Code-Regression huggingface dataset:
//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \###################\
//   \###################\
//    \        ____       \
//     \_______\___\_______\
// An AC a day keeps the doctor away.

#pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include <bits/extc++.h>
#ifdef local
#define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
#define debug(...) qqbx(#__VA_ARGS__,  __VA_ARGS__)
template <typename H, typename ...T> constexpr void qqbx(const char *s, const H &h, T &&...args) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr << *s;
    std::cerr << " = " << h << (sizeof...(T) ? ", " : "\n");
    if constexpr(sizeof...(T)) qqbx(++s, args...); // C++ 17!
}
#else
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#define safe ((void)0)
#endif // local
#define all(v) begin(v),end(v)
#define get_pos(v,x) (lower_bound(begin(v),end(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define pb emplace_back
#define ff first
#define ss second
#define mem(v,x) memset(v,x,sizeof v)

using namespace std;
using namespace __gnu_pbds;
typedef int64_t ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
template <typename T> using max_heap = std::priority_queue<T,vector<T>,less<T> >;
template <typename T> using min_heap = std::priority_queue<T,vector<T>,greater<T> >;
template <typename T> using rbt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
constexpr ld PI = acos(-1), eps = 1e-7;
constexpr ll N = 200025, INF = 1e18, MOD = 1000000007, K = 357, inf = 1e9;
constexpr inline ll cdiv(ll x, ll m) { return x/m + ((x<0 ^ m>0) && (x%m)); } // ceiling divide
constexpr inline ll modpow(ll e,ll p,ll m=MOD) { ll r=1; for(e%=m;p;p>>=1,e=e*e%m) if(p&1) r=r*e%m; return r; }

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int a, b, k;
    cin >> a >> b >> k;
    if(k*2 >= b-a+1) for(int i = a; i <= b; i++) cout << i << '\n';
    else {
        for(int i = 0; i < k; i++) cout << a+i << '\n';
        for(int i = k-1; i >= 0; i--) cout << b-i << '\n';
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 10001000
const ll mod=1e9+7;

ll H,W,k,ans,n;

ll power(ll x,ll y) {
	ll ret=1;
	for (;y;y>>=1,x=x*x%mod)
		if (y&1) ret=ret*x%mod;
	return ret;
}

ll inv(ll x) {return power(x,mod-2);}

int main()
{
	scanf("%lld%lld%lld",&H,&W,&k);
	n=H+W;
	ans=H*W%mod*(k*(k-1)%mod*inv(n*(n-1)%mod)%mod+k*(k-1)%mod*(k-2)%mod*inv(n*(n-1)%mod*(n-2)%mod*3ll%mod)%mod*(n-2)%mod)%mod;
	ans+=(k*inv(n)%mod+k*(k-1)%mod*inv(2ll*n*(n-1)%mod)%mod*(n-1)%mod)%mod*n%mod; ans%=mod;
	ans+=k; ans%=mod;
	for (ll i=n;i>=n-k+1;i--) ans=ans*i%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
char c[1000005];
int main() {
    c[0] = '0';
    cin >> c + 1;
    int cnt = 0;
    for (int i = strlen(c) - 1; i >= 0; i--) {
        int n = c[i] - '0';
        if (n > 5) {
            cnt += 10 - n;
            int j = i - 1;
            while(c[j]=='9'&&j>=0){
                c[j]='0';
                j--;
            }
            if (j >= 0) c[j] = c[j] + 1;
        } 
        else if(n==5&&i>0&&c[i-1]>='5'){
            cnt += 10 - n;
            int j = i - 1;
            while(c[j]=='9'&&j>=0){
                c[j]='0';
                j--;
            }
            if (j >= 0) c[j] = c[j] + 1;
        }
        else
            cnt += n;
    }
    cout << cnt;
}

Measured memory_bytes: 1280
N = int(input())
X = input()
ans = [1 for _ in range(N)]
#original 1 count
l = 0
for k in range(N):
  if X[k] == '1':
    l+=1
if l == 0:
  for _ in range(N):
    print(1)
  exit()
if l == 1:
  if X[-1] == '1':
    for _ in range(N-1):
      ans[_] = 2
  else:
    ans[-1] = 2 
  for k in range(N):
    if X[k] =='1':
      ans[k] = 0 
  for _ in range(N):
    print(ans[_])
  exit()


intN = int(X, 2)
N1 = intN %(l-1)
N0 = intN % (l+1)


start = []
if N == 1:
  if X[0] == '1':
    print(0)
    exit()
  else:
    print(1)
    exit()
else:
  s1 = 1
  s0 = 1
  for k in range(N-1, -1, -1):
    if X[k] == '1':      
      ia = (N1 - s1)%(l-1)
    else:
      ia = (N0 + s0)%(l+1)
    start.append(ia)
    s1 = s1*2%(l-1)
    s0 = s0*2%(l+1)
start = start[::-1]

ml = len(bin(l+1))-2
poplist = [0 for _ in range(N)]
t = 1
while t < N + 1:
  t *= 2
  for k in range(t//2, N, t):
    for j in range(t//2):
      if k+j>N-1:
        break
      poplist[k+j] += 1
"""

def popcount(n):
  c = 0
  n = bin(n)[2:]
  for k in range(len(n)):
    if n[k] == '1':
      c+=1
  return c
"""
for k in range(len(start)):
  for count in range(10*5):
    if start[k] == 0:
      ans[k] += count
      break
    else:
      start[k] = start[k] % poplist[start[k]]

for k in range(N):
  print(ans[k])

Measured memory_bytes: 112188
#include<iostream>
#include<vector>
using namespace std;

const int MAX_D = 365;
const int C_SIZE = 26;

typedef vector<int> State;

int decreaseSatisfaction(const vector<int>&vec_c, vector<vector<int> >&last,  int d) {
  int res = 0;
  for(int i = 0 ; i < C_SIZE ; i++){
    res += vec_c[i] * (d - last[d][i]);
  }
  return res;
}

void input(int& D, vector<int>&vec_c, vector<vector<int> >& vec_s){
  cin >> D;
  for(int i = 0 ; i <  C_SIZE ; i++){
    int c; cin >> c; vec_c.push_back(c);
  }
  for(int i = 0 ; i < D ; i++){
    vector<int>vec;
    for(int j = 0 ; j < C_SIZE ; j++){
      int s; cin >> s;
      vec.push_back(s);
    }
    vec_s.push_back(vec);
  }
}

void init(const int D, vector<int>& vec_last, State& state){
  for(int i = 0 ; i < C_SIZE ; i++){
    vec_last.push_back(0);
  }
  for(int i = 0 ; i < D ; i++){
    int bit = 0;
    for(int j = 0 ; j < C_SIZE ; j++){
      if(i%C_SIZE == j){
        bit = (1 << j);
      }
    }
    state.push_back(bit);
  }
}

void output(const State& res){
  for(int i = 0 ; i < res.size() ; i++){
    for(int j = 0 ; j < C_SIZE ; j++){
      if((res[i] >> j)&1) {
        cout << (j+1) << endl;
      }
    }
  }
}

string createBits(int num){
  string ret;
  for(int i = 0 ; i < C_SIZE; i++){
    if((num >> i)&1){
      ret += '1';
    }
    else {
      ret += '0';
    }
  }
  return ret;
}

void displayState(State state){
  for(int i = 0 ; i < state.size() ; i++){
    cout << createBits(state[i]) << endl;
  }
}

State solve(const int D, const vector<int>& vec_c, const vector<vector<int> >vec_s){
  vector<vector<int> > res;
  vector<int> vec_last;
  State state;
  init(D, vec_last, state);
  //displayState(state);
  return state;
}

int main(){
  int D;
  vector<int>vec_c;
  vector<vector<int> >vec_s;
  input(D, vec_c, vec_s);
  output(solve(D, vec_c, vec_s));
  return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,K;
int dp[105][70000];
signed main(){
	cin>>N>>K;
	int M=1;
	while(M*M<=N)M++;
	M--;
	dp[0][1]=1;dp[0][2]=-1;
	rep(i,K){
		REP(j,M*2+1){
			(dp[i][j+1]+=dp[i][j])%=mod;
			if(j*j<=N){
				(dp[i+1][1]+=dp[i][j])%=mod;
				(dp[i+1][2*M-j+2]-=dp[i][j]-mod)%=mod;
			}else {
				int p=M-(j-M)+1;
				int q=N/p;
				if(q*q<=N)continue;
				int ko=N/p-N/(p+1);
				(dp[i+1][1]+=dp[i][j]*ko%mod)%=mod;
				(dp[i+1][p+1]-=dp[i][j]*ko%mod-mod)%=mod;
			}
		}
	}
	int ans=0;
	REP(i,M*2+1){
		(dp[K][i+1]+=dp[K][i])%=mod;
		if(i*i<=N)(ans+=dp[K][i])%=mod;
		else {
			int p=M-(i-M)+1;
			int q=N/p;
			if(q*q<=N)continue;
			int ko=N/p-N/(p+1);
			(ans+=dp[K][i]*ko)%=mod;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 55424
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

constexpr int mod = 1000000007;
struct mint {
  long long x;
  constexpr mint(long long x = 0) : x((x % mod + mod) % mod) {}
  constexpr mint operator-() const { return mint(-x); }
  constexpr mint &operator+=(const mint &a) {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  constexpr mint &operator-=(const mint &a) {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  constexpr mint &operator*=(const mint &a) {
    (x *= a.x) %= mod;
    return *this;
  }
  constexpr mint operator+(const mint &a) const {
    mint res(*this);
    return res += a;
  }
  constexpr mint operator-(const mint &a) const {
    mint res(*this);
    return res -= a;
  }
  constexpr mint operator*(const mint &a) const {
    mint res(*this);
    return res *= a;
  }
  constexpr mint pow(long long t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  constexpr mint inv() const { return pow(mod - 2); }
  constexpr mint &operator/=(const mint &a) { return (*this) *= a.inv(); }
  constexpr mint operator/(const mint &a) const {
    mint res(*this);
    return res /= a;
  }
};
ostream &operator<<(ostream &os, const mint &m) {
  os << m.x;
  return os;
}

mint comb(ll n, ll r) {
  mint res = 1;
  for (int i = 1; i <= r; i++) {
    res *= n;
    res /= i;
    n--;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int x, y;
  cin >> x >> y;
  if ((x + y) % 3)
    cout << 0 << endl;
  else {
    int n = (x + y) / 3;
    x -= n;
    y -= n;
    if (x < 0 || y < 0)
      cout << 0 << endl;
    else
      cout << comb(x + y, x) << endl;
  }
}


Measured memory_bytes: 256
n = int(raw_input())
A_str = raw_input().split(" ")
A = map(int, A_str)

i = 0

r = A[-1]
for j in range(n):
    if A[j] <= r:
        A[i], A[j] = A[j], A[i]
        i += 1

print "%s [%d] %s" % (" ".join(map(str, A[:i-1])), A[i-1], " ".join(map(str, A[i:])))

Measured memory_bytes: 20824
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)
#define pow10(n) int(1e##n + n)

typedef long long LL;
typedef pair<int, int> P;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;

void solve()
{
    list<int> lst;
    int N;
    cin >> N;

    REP1 (i, N)
    {
        int b;
        cin >> b;
        lst.push_front(b);
    }
    vector<int> ans;
    while (lst.size())
    {
        int N = lst.size();
        int i = N;
        bool isok = false;
        for (auto itr = lst.begin(); itr != lst.end(); itr++)
        {
            if (*itr == i)
            {
                lst.erase(itr);
                isok = true;
                ans.push_back(i);
                break;
            }
            i--;
        }

        if (!isok)
        {
            std::cout << -1 << endl;
            return;
        }
    }
    reverse(ans.begin(), ans.end());
    for (auto n : ans)
    {
        std::cout << n << endl;
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(NULL);
    string s,t;
    cin >> s >> t;
    int len=s.size();
    int ans=0;
    for(int i=0;i<len;i++)
    {
        if(s[i]!=t[i])
            ans++;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define mod 1000000007LL

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

string k;
ll dp[10001][2][101], d;
ll count(ll i, bool tight, ll sum){
	if(i == k.size())	return (sum == 0);
	if(dp[i][tight][sum] != -1)	return dp[i][tight][sum];
	ll ans = 0, high = tight ? k[i]-'0' : 9;
	for(ll j = 0; j <= high; j++)
		ans = mop(ans, +, count(i+1, tight & (j == high), (sum+j)%d));
	return dp[i][tight][sum] = ans;
}
int main(){
	fill(dp, -1);	cin>>k>>d;
	cout<<(count(0, 1, 0) + mod - 1) % mod;
}

// Time: O(D*logK)
// Space: O(D*logK)

Measured memory_bytes: 20160
N = int(input())
S = [input() for _ in range(N)]

ans = cnt_b = cnt_a = cnt_ba = 0
for s in S:
    ans += s.count("AB")
    if s[0] == "B":
        cnt_b += 1
    if s[-1] == "A":
        cnt_a += 1
    if s[0] == "B" and s[-1] == "A":
        cnt_ba += 1

if cnt_a == cnt_ba and cnt_b == cnt_ba:
    cnt_a -= 1
    cnt_b -= 1
ans += max(min(cnt_a, cnt_b, N - 1), 0)

print(ans)


Measured memory_bytes: 3700
#include <iostream>

using namespace std;

uint64_t a[200'000];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    uint64_t s = 0;
    uint64_t cnt = 0;
    int j = 0;
    for (int i = 0; i < n; i++)
    {
        while (j < n && (s ^ a[j]) == s + a[j])
        {
            s ^= a[j];
            j++;
        }

        cnt += j - i;
        s ^= a[i];
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
  string S; cin>>S;
  int n=S.size();
  bool ans = true;
  rep(i, n) {
    if (i%2==0) {
      if (S[i]=='L') ans=false;
    }
    else {
      if (S[i]=='R') ans=false;
    }
  }
  if (ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
main(){
	char s[8];
	scanf("%s",s);
	if(strcmp(s,"Sunny")==0){
		printf("Cloudy");
	}
	if(strcmp(s,"Cloudy")==0){
		printf("Rainy");
	}
	if(strcmp(s,"Rainy")==0){
		printf("Sunny");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	long long N; long long A;
	while(~scanf("%lld%lld", &N, &A)) {
		const int T = 20000, B = 100;
		ll ans = INFL;
		vector<ll> dp, ndp(T + 1, -1);
		ndp[0] = 1;
		rep(a, B) {
			dp.swap(ndp);
			ndp.assign(T + 1, -1);
			rer(t, 0, T) {
				ll x = dp[t];
				if(x == -1) continue;
				ll num = 0;
				amin(ans, A * a + t + (N + x - 1) / x);
				rer(u, t + 1, T) {
					num += x;
					if(num >= N) break;
					amax(ndp[u], num);
				}
			}
		}
		//A + x + N/x
		rer(x, 1, 3000000)
			amin(ans, A + x + (N + x - 1) / x);
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 640
def main():
    N, A, B, C, D = map(int, input().split())
    diff = B - A
    for i in range(N-1):
        if -D * i + C * (N-1-i) <= diff <= -C * i + D * (N-1-i):
            print("YES")
            return
    print("NO")


if __name__ == "__main__":
    main()


Measured memory_bytes: 38972
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
    ll N, Q;
    cin >> N >> Q;
    
    string S;
    cin >> S;

    vector<ll> SUM(N);
    SUM[0] = 0;
    for (size_t i = 1; i < S.size(); i++)
    {
        if (S.substr(i - 1, 2) == "AC") {
            SUM[i] = SUM[i - 1] + 1;
        } else {
            SUM[i] = SUM[i - 1];
        }
    }
    
    for (size_t i = 0; i < Q; i++)
    {
        ll l, r;
        cin >> l >> r;
        cout << (SUM[r - 1] - SUM[l - 1]) << endl;
    }
}

Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;

#define N 500010
int a[N];

int main() {
	int n, m, k;
	while (scanf("%d%d", &n, &k) != EOF) {
		m = (1 << n) - 1;
		n = 1 << (n + 1);
		if (k == 0) {
			for (int i = 0; i <= m; ++i) {
				printf("%d %d%c", i, i, " \n"[i == m]);
			}
		} else {
			int tot = 0;
			for (int i = 0; i <= m; ++i) {
				a[i] = i;
				tot ^= i;
			}
			if (tot == 0 && k <= m) {
				swap(a[0], a[k]);
				for (int i = 0; i <= m; ++i) {
					printf("%d ", a[i]);
				}
				reverse(a + 1, a + 1 + m);
				for (int i = 0; i <= m; ++i) {
					printf("%d%c", a[i], " \n"[i == m]);
				}
			} else {
				puts("-1");
			}			
		}
	}
	return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
int main(void)
{
    sync;
    string s;
    cin>>s;
    s="#"+s;
    int n=s.size();
    string s1=s.substr(1,(n-1)/2);
    string s2=s.substr((n+3)/2);
    bool flag=true;
    if(!equal(s.begin()+1,s.end(),s.rbegin()))
        flag=false;
    if(!equal(s1.begin(),s1.end(),s1.rbegin()))
        flag=false;
    if(!equal(s2.begin(),s2.end(),s2.rbegin()))
        flag=false;
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int A, B, C;
	cin >> A >> B >> C;
	bool found = false;
	for(int i = 1; i <= B; i++){
		if((A * i) % B == C) found = true;
	}
	if(found){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,c,k=MI()
time=[I() for i in range(n)]
time.sort()
lis=[[time[i],time[i]+k] for i in range(n)]
#print(lis)
i=0
ans=0
count=0
while i<n:
    if count==c:
        count=0
        ans+=1
        #print("1x")
    elif count==0:
        count=1
        sup=lis[i][1]
        i+=1
        #print("2x")
    elif count<c:
        if lis[i][0]>sup:
            ans+=1
            count=0
            #print("3x")
        else:
            count+=1
            i+=1
            #print("4x")
    #print(sup)
if count!=0:
    ans+=1
    
print(ans)
            
            
    
    

Measured memory_bytes: 82236
import java.util.*;
import javax.lang.model.util.ElementScanner6;
import java.lang.Math;

public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);

        // 入力
        //String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();

        // 処理
        int out = a * b;

        // 出力
        System.out.println(out);
    }    
}


Measured memory_bytes: 35720
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);

  int x;
	cin >> x;
  int u500 = x / 500;
  int u5 = (x % 500)/5;
	cout << u500 * 1000 + u5 * 5 << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define LL long long 
#define ULL unsigned LL
#define LD long double 

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	cout<<(n>=30?"Yes":"No");
}


Measured memory_bytes: 3624
def ok_exit(res_):
    print(res_)
    exit(0)

H, W = map(int, input().split())

res = float("inf")

# H//3
if (-(-H//3) * 3) == H:   # ceil(H//3) = -(-H//3)
    ok_exit(0)
res = min(res, W)         # W * (-(-H//3) - (H//3))

# W//3
if (-(-W//3) * 3) == W:
    ok_exit(0)
res = min(res, H)

# (W, W//2) * (H//2)
for h1 in range(1, -(-H//2)+1):
    h2 = H - h1
    A3 = (W*h1, (W//2)*h2, (W-(W//2))*h2)
    res = min(res, max(A3)-min(A3))

if res == 0:
    ok_exit(0)
if H == W:
    ok_exit(res)

# (H, H//2) * (W//2)
H, W = W, H
for h1 in range(1, -(-H//2)+1):
    h2 = H - h1
    A3 = (W*h1, (W//2)*h2, (W-(W//2))*h2)
    res = min(res, max(A3)-min(A3))

print(res)


Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main(){
	char a[N + 1];
	f(i, N + 1)a[i] = 0;
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%s", a);
	n = strlen(a);
	x = 0;
	y = 0;
	f(i, n){
		if (a[i] == '0')x++;
		else y++;
	}
	ans = min(x, y) * 2;
	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 384
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, S);
    YES(S[2] == S[3] and S[4] == S[5]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int H, N;
  cin >> H >> N;
  
  int count = 0;
  
  for (int i = 0; i < N; i++) {
    int X;
    cin >> X;
    count += X;
    if (count >= H) {
      cout << "Yes" << endl;
      break;
    }
  }
  if (count < H) {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<climits>
using namespace std;
int main(void) {
  int n;
  int f[100][10];
  int p[100][11];
  int s[10];
  int ans=INT_MIN;
  cin>>n;
  for(int i=0; i<n; i++) {
    for(int j=0; j<10; j++) {
      cin>>f[i][j];
    }
  }
  for(int i=0; i<n; i++) {
    for(int j=0; j<11; j++) {
      cin>>p[i][j];
    }
  }
  for(int i0=0; i0<2; i0++) {
    for(int i1=0; i1<2; i1++) {
      for(int i2=0; i2<2; i2++) {
	for(int i3=0; i3<2; i3++) {
	  for(int i4=0; i4<2; i4++) {
	    for(int i5=0; i5<2; i5++) {
	      for(int i6=0; i6<2; i6++) {
		for(int i7=0; i7<2; i7++) {
		  for(int i8=0; i8<2; i8++) {
		    for(int i9=0; i9<2; i9++) {
		      if(i0 or i1 or i2 or i3 or i4 or i5 or i6 or i7 or i8 or i9) {
			s[0]=i0;
			s[1]=i1;
			s[2]=i2;
			s[3]=i3;
			s[4]=i4;
			s[5]=i5;
			s[6]=i6;
			s[7]=i7;
			s[8]=i8;
			s[9]=i9;
			int t=0;
			for(int i=0; i<n; i++) {
			  int x=0;
			  for(int j=0; j<10; j++) {
			    if(s[j]==1 and f[i][j]==1) {
			      x++;
			    }
			  }
			  t+=p[i][x];
			}
			ans=max(t, ans);
		      }			
		    }
		  }
		}
	      }
	    }
	  }
	}
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))

l = 1
r = 10**9 + 1

import math
while l < r:
    mid = (l + r) // 2
    counter = 0
    for i in range(N):
        if A[i] > mid:
            counter += math.ceil(A[i]/mid) - 1
    if counter <= K:
        r = mid
    else:
        l = mid + 1

print(l)

Measured memory_bytes: 31224
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
#include <chrono>
#include <bitset>
#include <tuple>
#include <queue>
#include <cstring>
#include <cassert>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    // scanf("%d", &tc);
    for(int cn = 1; cn <= tc; cn++) {
        string s, t; cin >> s >> t;
        bool ok = 1;
        for(int i = 0; i < s.size(); i++) ok &= (s[i] == t[i]);
        if(ok) puts("Yes");
        else puts("No");
    }  
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
    int n, a, min, max, i;
    long sum = 0;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &a);
        if (i == 0) {
            max = a;
            min = a;
        }
        if (min > a)
            min = a;
        if (max < a)
            max = a;
        sum += a;
    }

    printf("%d %d %ld\n", min, max, sum);

    return 0;
}


Measured memory_bytes: 2136
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long K, long long R, long long S, long long P, std::string T){
  vector<char> v(N);
  ll ans = 0;
  rep(i,N) {
    if(i<K) {
      if(T[i]=='r') {
	ans += P;
	v[i] = 'p';
      } else if(T[i]=='s') {
	ans += R;
	v[i] = 'r';
      } else {
	ans += S;
	v[i] = 's';
      }
    } else {
      if(T[i]=='r') {
	if(v[i-K]=='p') {
	  if(i+K<N) {
	    if(T[i+K]=='p') {
	      v[i] = 'r';
	    } else {
	      v[i] = 's';
	    }
	  } else {
	    v[i] = 'r';
	  }
	} else {
	  v[i] = 'p';
	  ans += P;
	}
      } else if(T[i]=='s') {
	if(v[i-K]=='r') {
	  if(i+K<N) {
	    if(T[i+K]=='r') {
	      v[i] = 's';
	    } else {
	      v[i] = 'p';
	    }
	  } else {
	    v[i] = 'p';
	  }
	} else {
	  v[i] = 'r';
	  ans += R;
	}
      } else {
	if(v[i-K]=='s') {
	  if(i+K<N) {
	    if(T[i+K]=='s') {
	      v[i] = 'p';
	    } else {
	      v[i] = 'r';
	    }
	  } else {
	    v[i] = 'r';
	  }
	} else {
	  v[i] = 's';
	  ans += S;
	}
      }
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  long long R;
  scanf("%lld",&R);
  long long S;
  scanf("%lld",&S);
  long long P;
  scanf("%lld",&P);
  std::string T;
  std::cin >> T;
  solve(N, K, R, S, P, T);
  return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


int main() {
    int N;
    cin >> N;

    vector<int> a(2*N);
    REP(i,2*N) cin >> a[i];
    sort(all(a));

    ll ans=0;
    REP(i,2*N) {
        ans += a[i];
        i++;        
    }

    pl(ans)

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> a(h+2, vector<int>(w+2, -1));
    rep(i, h) rep(j, w){
        cin >> a.at(i+1).at(j+1);
    }

    vector<pair<P, P>> ans;
    for(int i=1; i<=h; i++){
        if(i%2){
            for(int j=1; j<=w; j++){
                if(a.at(i).at(j)%2){
                    a.at(i).at(j)--;
                    if(j!=w) {
                        a.at(i).at(j+1)++;
                        ans.push_back(make_pair(make_pair(i, j), make_pair(i, j+1)));
                    }
                    else{
                        if(i!=h) {
                            a.at(i+1).at(j)++;
                            ans.push_back(make_pair(make_pair(i, j), make_pair(i+1, j)));
                        }
                        else{
                          continue;  
                        }
                    }
                }
                else{
                    continue;
                }
            }
        }
        else{
            for(int j=w; j>=1; j--){
                if(a.at(i).at(j)%2){
                    a.at(i).at(j)--;
                    if(j!=1) {
                        a.at(i).at(j-1)++;
                        ans.push_back(make_pair(make_pair(i, j), make_pair(i, j-1)));
                    }
                    else{
                        if(i!=h) {
                            a.at(i+1).at(j)++;
                            ans.push_back(make_pair(make_pair(i, j), make_pair(i+1, j)));
                        }
                        else{
                          continue;  
                        }
                    }
                }
                else{
                    continue;
                }
            }
        }
    }

    cout << ans.size() << endl;
    for(auto x:ans){
        cout << x.first.first << " " << x.first.second << " " << x.second.first << " " << x.second.second << endl;
    }

    return 0;
}


Measured memory_bytes: 5232
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func main() {
	N := nextInt()
	M := nextInt()
	H := nextInts(N)
	good := make([]bool, N)
	for i := 0; i < N; i++ {
		good[i] = true
	}
	for i := 0; i < M; i++ {
		a := nextInt() - 1
		b := nextInt() - 1
		if H[a] >= H[b] {
			good[b] = false
		}
		if H[b] >= H[a] {
			good[a] = false
		}
	}
	ans := 0
	for i := 0; i < N; i++ {
		if good[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

type que struct {
	a, b, c, d int
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 5524
import math
a,b,c=map(int,input().split())
S=1/2*a*b*(math.sin(math.radians(c)))
l=a**2+b**2-2*a*b*(math.cos(math.radians(c)))
L=a+b+(math.sqrt(l))
h=b*(math.sin(math.radians(c)))
print(S)
print(L)
print(h)


Measured memory_bytes: 5708
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N + 1):
    for g in range(N + 1):
        rem = N - (r * R + g * G)
        if rem < 0:
            break
        if rem == 0 or (rem > 0 and rem % B == 0):
            ans += 1
print(ans)


Measured memory_bytes: 41308
#include <stdio.h>

int main(void)
{
    long long n, k, t;
    scanf("%lld%lld", &n, &k);
    t = n % k;
    if(t < -(t - k))
        printf("%lld", t);
    else
        printf("%lld", -(t-k));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    ll n;
    cin >> n;
    int flag = 0;
    if (n < 0)
    {
        flag = -1;
    }
    else if (n > 0)
    {
        flag = 1;
    }
    else
    {
        cout << 0 << endl;
        return 0;
    }

    n *= flag;

    vector<int> ans;

    for (int i = 0; n != 0; i++)
    {
        ll waru = pow(2, i + 1);
        if (n % waru != 0)
        {
            ans.push_back(1);
            if (i % 2 == 0)
            {
                n -= (waru / 2) * flag;
            }
            else
            {
                n += (waru / 2) * flag;
            }
        }
        else
        {
            ans.push_back(0);
        }
    }
    reverse(ans.begin(), ans.end());
    for (int a : ans)
    {
        cout << a;
    }
    cout << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 512
# 差が1か0のみ隣り合わない 適当に毎回割る再帰

n, m = map(int, input().split())
if abs(n - m) > 1:
    print(0)
elif n == m:
    ans = 1
    while n > 0:
        ans *= n
        n -= 1
        ans %= (10 ** 9 + 7)
    ans = (ans * ans * 2) % (10 ** 9 + 7)
    print(ans)
else:
    ans = max(n, m)
    t = 1
    x = min(n, m)
    while x > 0:
        t *= x
        x -= 1
        t %= (10 ** 9 + 7)
    ans = (ans * t * t) % (10 ** 9 + 7)
    print(ans)


Measured memory_bytes: 38512
require 'prime'

mod = 10 ** 9 + 7

N = gets.to_i
a = gets.split.map(&:to_i).sort
# p a

if N.even?
  
  N.times do |i|
    
    if a[i] != (i+2)/2 * 2 - 1
      puts 0
      exit
    end
  end
  
  puts 2 ** (N/2) % mod

else # odd?

  N.times do |i|
    
    if a[i] != (i+1)/2 * 2
      puts 0
      # p ?o
      exit
    end
  end
  
  puts 2 ** (( N - 1 )/2) % mod
  
end


Measured memory_bytes: 10384
#include<bits/stdc++.h>
using namespace std;

int main(void){
  int n;
  cin >> n;
  vector<tuple<string,int,int>> a;
  for(int id = 1; id <= n; id++){
    string s;
    int p;
    cin >> s >> p;
    p=-p;
    a.emplace_back(s,p,id);
    //a.push_back(tie(s,p,id));
  }
  sort(a.begin(),a.end());
  for(int i = 0; i < n; i++){
    string s;
    int p, id;
    tie(s,p,id) = a.at(i);
//    cout << get<2>(a.at(i)) << endl;
    cout << id << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
m=166666;a=[[1]*m for _ in[0]*2]
for i in range(m):
 if a[0][i]:
  k=6*i+5
  a[0][i+k::k]=[0]*len(a[0][i+k::k])
  a[1][-2-i+k::k]=[0]*len(a[1][-2-i+k::k])
 if a[1][i]:
  k=6*i+7
  a[0][-2-i+k::k]=[0]*len(a[0][-2-i+k::k])
  a[1][i+k::k]=[0]*len(a[1][i+k::k])
for e in map(int,sys.stdin):
 print([e-1,sum(a[0][:(e+1)//6]+a[1][:(e-1)//6])+2][e>3])


Measured memory_bytes: 14048
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
	long long d, n,a[1000],c=0;
	for (long long i = 0; i < 500; i++)a[i] = 0;
	cin >> d >> n;
	if (d == 0) {
		cout << n + n / 100 << endl;
		getchar();
		getchar();
		return 0;
	}
	long long po = pow(100, d),po2=pow(100,d+1);
	cout << po * n+((po*n)/po2)*po << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
(loop with list = (loop repeat (read) collect (read))
      with max = 0
      for glmax = 0 then (max glmax max)
      for prev = (first list) then el               
      for el in (rest list)
      if (>= prev el) do (incf max)
      else do (setf max 0)
      finally (print glmax))

Measured memory_bytes: 59752
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int dis[110][110];
const int INF=100100100/3;

int main() {
	int n,k;
	int a,b,c,d,e;
	int x,y;
	while(cin>>n>>k,n){
		for(x=0;x<n;x++){
			for(y=0;y<n;y++){
				dis[x][y]=(x==y?0:INF);
			}
		}
		while(k--){
			if(in()==1){
				cin>>c>>d>>e;
				c--;d--;
				chmin(dis[c][d],e);
				chmin(dis[d][c],e);
				for(x=0;x<n;x++){
					for(y=0;y<n;y++){
						chmin(dis[x][y],dis[x][c]+dis[c][d]+dis[d][y]);
						chmin(dis[x][y],dis[x][d]+dis[d][c]+dis[c][y]);
					}
				}
			}else{
				cin>>a>>b;
				a--;b--;
				if(dis[a][b]==INF){
					cout<<-1<<endl;
				}else{
					cout<<dis[a][b]<<endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()

int main(){
  string S,T;cin>>S>>T;
  ll ans=1e9;
  for(int i=0;i<S.size()-T.size()+1;++i){
    ll tmp=0;
    for(int j=0;j<T.size();++j){
      if(S[i+j]!=T[j]) tmp++;
    }
    ans = min(ans,tmp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<cmath>
#include<string>
#include<vector>
#include<cstring>
#define ll long long
#define pb push_back
// #define memset(a,n) memset(a,n,sizeof(a))
#define mp make_pair
using namespace std;
const int maxn = 2e5 + 100;

void FAST()
{
    ios::sync_with_stdio(0);cin.tie(0);
}



int main()
{
    FAST();
    int a[maxn] = {0};int n;scanf("%d",&n);
    for(int i = 0 ; i < n - 1; i++){
        int x;scanf("%d",&x);a[x]++;
    }
    for(int i = 1;i <= n;i++) printf("%d\n",a[i]);
    // system("pause"); // 测试专用，提交勿忘注释掉
    return 0;
}

Measured memory_bytes: 4620
import java.util.Scanner;

class Main {
    private static String reverse(String string) {
        char[] result = new char[string.length()];
        for (int i = 0; i < result.length; i++) {
            result[i] = string.charAt(result.length - i - 1);
        }
        return String.valueOf(result);
    }

    private static void solve() {
        Scanner scanner = new Scanner(System.in);
        String string = scanner.next();
        System.out.println(reverse(string));
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 11000
N = int(input())
h = list(map(int, input().split()))
ans = 0
for i in range(max(h)):
    h.append(0)
    count = 0
    for k in range(N):
        if h[k] != 0 and h[k + 1] == 0:
            count += 1
    ans += count
    h = list(map(lambda x: (x - 1, 0)[x == 0], h))
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    int N, n = 0; 
    cin >> N;
    while(N)
    {
        n = N%10;
        N /= 10;
        if(n == 7)
        {
            break;
        }
    }
    if(n == 7)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
template<class I>void gi(I&x){static char c;for(c=getchar();c<'0'||c>'9';c=getchar());for(x=0;c<='9'&&c>='0';c=getchar())x=x*10+(c&15);}
const int N=8e5+5,M=4e6+5,inf=1e9;
int S,T,h[N],nxt[M],to[M],flow[M],g[M],tg[M],tc,cnt=1,qu[N],ql,qr,d[N],n,m;
void addedge(int u,int v,int c){to[++cnt]=v,nxt[cnt]=h[u],h[u]=cnt,flow[cnt]=c,to[++cnt]=u,nxt[cnt]=h[v],h[v]=cnt,flow[cnt]=0;}
int mx[N],fw[N];
int wxh(){
	memset(d+S+1,-1,(T-S)<<2),d[S]=0,qu[ql=qr=1]=S;
	while(ql<=qr)for(int u=qu[ql++],i=h[u],v;i;i=nxt[i])if(d[v=to[i]]==-1&&flow[i])d[v]=d[u]+1,qu[++qr]=v;
	if(d[T]==-1)return 0;
	d[T]=inf;ql--;
	for(int k=1;k<=ql;k++){mx[qu[k]]=fw[qu[k]]=0;if(qu[k]==T)qu[k]++;}
	mx[T]=inf,++tc;
	for(int i=h[T];i;i=nxt[i])if(flow[i^1])mx[to[i]]+=flow[i^1],g[i^1]=flow[i^1],tg[i^1]=tc;
	for(int k=ql,u;k>=1;k--)for(int i=h[u=qu[k]],cur=mx[u],v,p;i&&cur;i=nxt[i])if(flow[i^1]&&d[v=to[i]]+1==d[u])p=min(cur,flow[i^1]),mx[v]+=p,cur-=p,g[i^1]=p,tg[i^1]=tc;
	fw[S]=mx[S];
	for(int k=1,u;k<=ql;k++)for(int i=h[u=qu[k]],p;i&&fw[u];i=nxt[i])if(tg[i]==tc)p=min(g[i],fw[u]),flow[i]-=p,flow[i^1]+=p,fw[u]-=p,fw[to[i]]+=p;
	return fw[T];
}
int main(){
	gi(n),gi(m),S=0,T=n+m+m+m+1;
	for(int i=1;i<=n;i++)addedge(S,i,1);
	for(int i=1,l,r;i<=n;i++){gi(l),gi(r);if(l>=1)addedge(i,l+n+m,1);if(r<=m)addedge(i,r+n+m+m,1);}
	for(int i=1;i<=m;i++)addedge(i+n,T,1),addedge(i+n+m,i+n,inf),addedge(i+n+m+m,i+n,inf);
	for(int i=2;i<=m;i++)addedge(i+n+m,i+n+m-1,inf),addedge(i+n+m+m-1,i+n+m+m,inf);
	while(int f=wxh())n-=f;cout<<n;
	return 0;
}

Measured memory_bytes: 89856
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set=tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<int,ull> piu;
typedef vector<vector<int>> matrix;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=5e5+123;
const int M=1e6+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    if(k==1){
        cout<<0;
        return 0;
    }
    cout<<n-k;
    return 0;
}


Measured memory_bytes: 896
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;

int main(){
  char s[20];
  char t[20];
  int count = 0;
  cin >> s;
  strcpy(t, "CODEFESTIVAL2016");

  for(int i = 0; i < 16; i++){
    if(s[i] != t[i]){
      count++;
    }
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int power(int a){
	if(a==0) return 1;
	else return 10*power(a-1);
}
int main(){
  	int N;
  	cin >> N;

 	int tmp = N;
  	int dig = 0;

  	while(tmp){
 		dig++;
  		tmp /= 10;
  	}
  	//cout << dig <<endl;
  	int ans = 0;

  	if(dig%2!=0) ans += N-power(dig-1)+ 1;

	int ten = 1;
  	while(dig>=2){
		ans += 9*ten;
		ten *=100;
		dig -= 2;
	}
	cout << ans <<endl;

  	return 0;
}



Measured memory_bytes: 256