akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = long.Parse(Console.ReadLine());
            var cnt = 0;
            long n = 100;
            while (true)
            {
                cnt++;
                n = (long)(n * 1.01);
                if (n >= X)
                {
                    Console.WriteLine(cnt);
                    return;
                }
            }
        }
    }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n;
int t[100],c[100];
int maxt[2];

struct state{
  int t,pc,r,idx;
};

bool operator<(const state& a,const state& b){
  if(a.t==b.t)return a.pc > b.pc;
  else return a.t > b.t;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    rep(i,n)cin>>t[i]>>c[i];
    priority_queue<state> que;
    memset(maxt,0,sizeof(maxt));
    rep(i,n){
      que.push((state){0,t[i],0,(int)i});
      c[i]*=2;
    }
    while(que.size()){
      state s=que.top(); que.pop();
      int nxt=max(maxt[s.r],s.t+s.pc);
      maxt[s.r]=nxt;
      c[s.idx]--;
      if(c[s.idx]>0){
        que.push((state){nxt,s.pc,1-s.r,s.idx});
      }
    }
    cout<<max(maxt[0],maxt[1])<<endl;
  }
  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
using namespace std;
int main(){
  while(1){
    string n;
    int i, sum=0;
    cin >> n;
    if (n=="0") break;
    for (i=0; n[i]!='\0'; i++) {
      sum+=n[i]-48;
    }
    cout << sum << endl;
  }
}


Measured memory_bytes: 3208
import java.io.PrintWriter;
import java.util.*;

public class Main {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int r = nextInt();

        out.println(r >= 1800 ? 1 : r >= 1600 ? 2 : r >= 1400 ? 3 : r >= 1200 ? 4 : r >= 1000 ? 5 : r >= 800 ? 6 : r >= 600 ? 7 : 8);


        out.flush();
    }

    public static int pow2(int i) {
        return i*i;
    }

    public static void println(Object o) {
        System.out.println(o);
    }

    public static void print(Object o) {
        System.out.print(o);
    }

    public static void printf(String format, Object... o) {
        System.out.printf(format, o);
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static void nextLine() {
        scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

Measured memory_bytes: 29348
goukei = []
sum = 0
count = 0

loop do

	number = gets.split("").map(&:to_i)

	for i in 0..number.size - 1
		sum += number[i]
	end

	if sum == 0 then 
		break
	else
 		goukei[count] = sum
 	end

 	count += 1

 	sum =0

end

puts goukei

Measured memory_bytes: 8868
#include <stdio.h>

int n;
int Adj[101][101] = { 0 };
int d[101] = { 0 };
int f[101] = { 0 };
int time = 0;

void DFS(int);

int main(void){
	int u, k, v;
	int i, j;

	scanf("%d", &n);
	for (i = 1; i <= n; i++){
		scanf("%d %d", &u, &k);
		for (j = 1; j <= k; j++){
			scanf("%d", &v);
			Adj[u][v] = 1;
		}
	}

	for (i = 1; i <= n; i++){
		if (d[i] == 0)
			DFS(i);
	}
	for (i = 1; i <= n; i++){
		printf("%d %d %d\n", i, d[i], f[i]);
	}
	
	return 0;
}

void DFS(int u){
	int v;

	d[u] = ++time;
	for (v = 1; v <= n; v++){
		if ((d[v] == 0) && (Adj[u][v] == 1))
			DFS(v);
	}
	f[u] = ++time;
}

Measured memory_bytes: 640
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"
#include "map"
#include "algorithm"
#include "functional"
#include "set"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007; 

long long int N, M, K, H, W, L, R;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

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

	cin >> N;
	vector<pair<int, int>>v(N);
	for (auto &i : v)cin >> i.first >> i.second;
	vector<vector<long long int>>dp(4002, vector<long long int>(4002));
	for (auto i : v)dp[i.first + 2000][i.second + 2000]++;
	for (int i = 4000; i >= 0; i--) {
		for (int j = 4000; j >= 0; j--) {
			dp[i][j] += dp[i + 1][j] + dp[i][j + 1];
			dp[i][j] %= MOD;
		}
	}
	vector<vector<long long int>>rev_dp(2001, vector<long long int>(2001));
	for (auto i : v)rev_dp[2000 - i.first][2000 - i.second]++;
	for (int i = 0; i < 2000; i++) {
		for (int j = 0; j < 2000; j++) {
			if (i)rev_dp[i][j] += rev_dp[i - 1][j];
			if (j)rev_dp[i][j] += rev_dp[i][j - 1];
			rev_dp[i][j] %= MOD;
		}
	}
	long long int ans = 0;
	for (int i = 0; i < 2000; i++) {
		//if (i >= 1998) {
		//	cout << i << " " << dp[i][2000] << " " << rev_dp[i][1999] << endl;
		//	cout << i << " " << dp[2000][i] << " " << rev_dp[1999][i] << endl;
		//}
		ans += dp[i][2000] * rev_dp[i][1999];
		ans %= MOD;
		ans += dp[2000][i] * rev_dp[1999][i];
		ans %= MOD;
	}
	//cout << ans << endl;
	vector<long long int>by(8001, 1);
	for (int i = 1; i <= 8000; i++) {
		by[i] = by[i - 1] * i;
		by[i] %= MOD;
	}
	for (auto i : v) {
		long long int minus = by[(i.first + i.second) * 2];
		minus *= power(by[i.first * 2], MOD - 2, MOD);
		minus %= MOD;
		minus *= power(by[i.second * 2], MOD - 2, MOD);
		minus %= MOD;
		ans += MOD;
		ans -= minus;
	}
	ans %= MOD;
	ans *= power(2, MOD - 2, MOD);
	ans %= MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 158592
#include <iostream>
#include <vector>
using namespace std;
int n, l;
vector<int> x;
vector< vector<int> > nxt;

void cal(){
    int lim = 1;
    for(int i=0;i<n;i++){
        while(lim+1<n && x[lim+1]-x[i] <= l){
            lim++;
        }
        nxt[i][0] = lim;
    }

    for(int k=0;k<18-1;k++){
        for(int i=0;i<n;i++){
            nxt[i][k+1] = nxt[nxt[i][k]][k];
        }
    }
}

int solve(int a, int b){
    if(a == b)return 0;
    if(a > b)return solve(b, a);
    if(nxt[a][0] >= b)return 1;
    int ng = 0, ok = 18-1;
    while(ng+1 < ok){
        int mid = (ng + ok) / 2;
        if(nxt[a][mid] >= b)ok = mid;
        else ng = mid;
    }
    return (1<<ng) + solve(nxt[a][ng], b);
}

int main() {
    int q;
    cin >> n;
    x.assign(n, 0);
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    cin >> l >> q;
    nxt.assign(n, vector<int>());
    for(int i=0;i<n;i++){
        nxt[i].assign(18, n-1);
    }
    cal();
    for(int i=0;i<q;i++){
        int a, b;
        cin >> a >> b;
        cout << solve(--a, --b) << endl;
    }

	return 0;
}


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

typedef long long ll;

int n,k;
int w[1000000];

int main(){
   int n;
   cin >> n;
   rep(i,9)rep(k,9){
      if((i+1)*(k+1)==n){
         cout << "Yes" << endl;
         return 0;
      }
   }
   cout << "No" <<endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <fstream>
#include <numeric>
#include <tuple>

using namespace std;

#define fori(t) for(int i = 0; i < t; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)
#define forai(a) for(auto& i : a)
#define foraj(a) for(auto& j : a)
#define forak(a) for(auto& k : a)
#define forp(s, n, d) for(int p = s; p < n; p += d)
#define fast cin.tie(0); cout.tie(0); std::ios_base::sync_with_stdio(0);
#define pb(a) push_back(a);
#define pob(a) pop_back(a);
#define sorti(a) sort(a.begin(), a.end());
#define sortm(a, n) sort(a, a + n);
#define reversi(a) reverse(a.begin(), a.end());
#define fi first
#define se second
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define ans(a) cout << a << '\n';
#define res(a, n) a.resize(n);
#define read(a, n) a.resize(n); fori(n) cin >> a[i];
//#define int long long
//#define double long double

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<long long, long long> llll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<int, pair<int, int>>> viii;
typedef pair<int, pair<int, int>> iii;
typedef vector<pair<long long, long long>> vllll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef pair<char, char> cc;
typedef pair<pair<char, char>, char> ccc;
typedef vector<char> vc;
typedef pair<int, char> ic;
typedef pair<ii, char> iic;
typedef vector<bool> vb;
typedef set<int> si;
typedef set<ii> sii;
typedef unsigned long long ull;
typedef pair<ull, ull> ullll;
typedef pair<double, double> dd;
typedef vector<dd> vdd;
typedef vector<pair<ull, ull>> vullll;
typedef pair<bool, bool> bb;
typedef vector<bb> vbb;
typedef vector<vector<ii>> vvii;
typedef vector<vector<iii>> vviii;

const int INF = 2147483647;
const ll LONGINF = 9223372036854775807;
const ll MOD = 1e9 + 7;

string n;

void solve()
{
    cin >> n;
    ll sum = 0;
    forai(n) sum += i - '0';
    if (sum % 9 == 0) yes
    else no
}

signed main()
{
    fast
    bool mult = false;
    if (mult)
    {
        int t;
        cin >> t;
        while (t--) solve();
    }
    else solve();
    return 0;
}


Measured memory_bytes: 3748
n,*s=map(int,open(0).read().split());s,t,f,g=[s[i*n:i*n+n]for i in range(4)];r=range(n);a=[n*[0]for _ in r]
for b in range(64):
 e=1<<b;u=[k&e for k in f];v=[k&e for k in g];l=[0]*n;m=l[:]
 for i in r:
  for j in r:
   if(u[i]&v[j])|((s[i]^1)*u[i])|((t[j]^1)*v[j]):a[i][j]|=e;l[i]+=1;m[j]+=1
 for i in r:
  if(l[i]==0)*s[i]*u[i]:
   for j in r:
    if(t[j]^1)*(n-m[j]>1):a[i][j]|=e;m[j]+=1;break
  if(m[i]==0)*t[i]*v[i]:
   for j in r:
    if(s[j]^1)*(n-l[j]>1):a[j][i]|=e;l[j]+=1;break
h=a[0][:];w=[i[0]for i in a]
for i in r:
 for j in r:w[i]=(w[i]|a[i][j]if s[i]else w[i]&a[i][j]);h[j]=(h[j]|a[i][j]if t[j]else h[j]&a[i][j])
if(g!=h)|(f!=w):print(-1);exit() 
for i in a:print(*i)

Measured memory_bytes: 99308
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N,K;
    cin>>N>>K;
    vector<int> d(K);
    vector<int> A[200];
    
    for(int i=0;i<K;i++){
        //cout<<K<<" "<<i<<endl;
        cin>>d[i];
        for(int j=0;j<d[i];j++){
            A[i].resize(d[i]);
            cin>>A[i][j];
        }
    }
    //cout<<"fuga";
    int count=0;
    bool flag=false;
    for(int i=1;i<=N;i++){
        flag=false;
        for(int j=0;j<K;j++){
            for(int k=0;k<d[j];k++){
                if(i==A[j][k])flag=true;
            }
            
        }
        if(!flag)count++;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 3640
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007
#define int long long

typedef pair<int, int> pint;
typedef long long ll;

int gcd(int a, int b)
{
    if (a == 0)
    {
        return b;
    }
    return gcd(b % a, a);
}

signed main()
{
    int x, y;
    cin >> x >> y;
    int ans = 1;
    while (2 * x <= y)
    {
        ans++;
        x *= 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()
flag = 1
Ta = [[0]*2 for i in range(N*M+1)]
Aup = [0]*(N*M+1)
Bup = [0]*(N*M+1)

for i in range(N):
    Ta[A[i]][0] += 1
    Aup[A[i]] += 1
    if Ta[A[i]][0]>=2:
        flag=0
        break
for i in range(M):
    Ta[B[i]][1] += 1
    Bup[B[i]] += 1
    if Ta[B[i]][1]>=2:
        flag=0
        break
for i in range(0,N*M)[::-1]:
    Aup[i]=Aup[i]+Aup[i+1]
    Bup[i]=Bup[i]+Bup[i+1]
if flag==0:
    print(0)
else:
    out = 1
    p = 10**9+7
    for k in range(1,N*M+1)[::-1]:
        As,Bs = Ta[k]
        if As==1 and Bs==1:
            out = out*1%p
        elif As==1 and Bs==0:
            out = out*(Bup[k])%p
        elif As==0 and Bs==1:
            out = out*(Aup[k])%p
        elif As==0 and Bs==0:
            out = out*(Aup[k]*Bup[k]-(N*M-k))%p
    print(out)

Measured memory_bytes: 200432
// https://atcoder.jp/contests/arc061/tasks/arc061_a
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S;
  cin >> S;

  ll ans = 0;
  int m = S.size() - 1;

  rep(bit, 1 << m) {
    ll cur = S[0] - '0';
    rep(i, m) {
      if (bit & (1 << i)) {
        ans += cur;
        cur = 0;
      }
      cur = cur * 10 + S[i + 1] - '0';
    }
    ans += cur;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int H,W;
    cin >> H >> W;
    map<int, int> m;
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for(auto&& si: s) m[si-'a']++;
    }
    int t2=0, t1=0, t0=0;
    for(auto&& mi : m){
        t0 += mi.se / 4;
        if((mi.se%4)==0) continue;

        if((mi.se%4)==1){
            t1++;
        }else if((mi.se%4)==2){
            t2++;
        }else if((mi.se%4)==3){
            t1++;
            t2++;
        }
    }
    int t = t0+t1+t2;

    if((H%2)==0&&(W%2)==0){
        Yes(t0==t);
    }else if((H%2)==1&&(W%2)==1){
        // Yes(t1==1&&(H*W-1)==(t2*2*((H/2)+(W/2))+t0*4));
        Yes(t1==1&&(H*W-1)==(t2*2+t0*4)&&t2<=((W/2)+(H/2)));
    }else{
        if(H%2==1) Yes(t1==0&&(H*W)==(t2*2+t0*4)&&t2<=(W/2));
        if(W%2==1) Yes(t1==0&&(H*W)==(t2*2+t0*4)&&t2<=(H/2));
    }
}

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

signed main()
{
	int n, d, x;
	cin >> n >> d >> x;
	vector<vector<int>> p(d, vector<int>(n));
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < n; j++) {
			cin >> p[i][j];
		}
	}
	for (int i = 1; i < d; i++) {
		vector<int> dp(100001, -1);
		dp[x] = x;
		for (int j = 0; j < n; j++) {
			for (int k = 0; k <= 100000 - p[i][j]; k++) {
				if (dp[k] >= p[i - 1][j]) {
					dp[k + p[i][j] - p[i - 1][j]] = max(dp[k + p[i][j] - p[i - 1][j]], dp[k] - p[i - 1][j]);
				}
			}
		}
		int Max = 0;
		for (int k = 0; k <= 100000; k++) {
			if (dp[k] >= 0) {
				Max = k;
			}
		}
		x = Max;
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 3892
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>

using namespace std;

int main() {
    int i,j,n,p,q,temp;
    int t=0;
    int flag1=0;
    int flag2=0;
    int flag3=0;
    string s;
    cin>>s;
    if(s[2]!='0'&&s[2]!='1')flag1=1;
    if(s[2]=='1'&&s[3]!='0'&&s[3]!='1'&&s[3]!='2')flag1=1;
    if(s[2]=='0'&&s[3]=='0')flag1=1;
    if(s[0]!='0'&&s[0]!='1')flag2=1;
    if(s[0]=='1'&&s[1]!='0'&&s[1]!='1'&&s[1]!='2')flag2=1;
    if(s[0]=='0'&&s[1]=='0')flag2=1;


    if(flag1==1&&flag2==0)cout<<"MMYY";
    else if(flag2==1&&flag1==0)cout<<"YYMM";
    else if(flag1==1&&flag2==1)cout<<"NA";
    else cout<<"AMBIGUOUS";

    return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

mt19937 mt_engine(chrono::steady_clock::now().time_since_epoch().count());
template <class T> enable_if_t<is_integral_v<T>, T> rng(T l, T r) {
  return uniform_int_distribution<T>(l, r - 1)(mt_engine);
}
template <class T> enable_if_t<is_floating_point_v<T>, T> rng(T l, T r) {
  return uniform_real_distribution<T>(l, r)(mt_engine);
}

struct chash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ x >> 30) * 0xbf58476d1ce4e5b9;
    x = (x ^ x >> 27) * 0x94d049bb133111eb;
    return x ^ x >> 31;
  }
  size_t operator()(pair<int, int> p) const {
    static const uint64_t r = rng<uint64_t>(0, 0);
    return splitmix64(((uint64_t)p.first << 32 | p.second) ^ r);
  }
};


int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k, s, t;
  cin >> n >> k >> s >> t;
  vector<gp_hash_table<pair<int, int>, long long, chash>> dp(k + 1);
  dp[0][{~(-1u << 18), 0}] = 1;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    for (int j = min(i, k - 1); j >= 0; --j) {
      for (auto [p, v] : dp[j]) {
        dp[j + 1][{p.first & a, p.second | a}] += v;
      }
    }
  }
  auto res = 0LL;
  for (int j = 1; j <= k; ++j) {
    res += dp[j][{s, t}];
  }
  cout << res << '\n';
}


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

using namespace std;

#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define ok puts("ok");

const int N = (int)1e5 + 7;

vector < pii > gr[N];
int used[N];
int vis[N];

void dfs(int v, int len, int pr) {
  used[v] = len;
  vis[v] = 1;
  for (auto to : gr[v]) {
    if (pr == to.fr) continue;
//    cout << v << ' ' << to.fr << endl;
    if (!vis[to.fr]) {
      dfs(to.fr, len + to.sc, v);
    } else if (vis[to.fr] == 1 && len - used[to.fr] + to.sc != 0) {
      puts("No");
      exit(0);
    }
  }
  vis[v] = 2;
}

main () {
  int n, m; scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) used[i] = -1;
  for (int i = 1; i <= m; i++) {
    int l, r, d; scanf("%d %d %d", &l, &r, &d);
    gr[l].pb(mk(r, d));
    gr[r].pb(mk(l, -d));
  }
  for (int i = 1; i <= n; i++) {
    if (used[i] == -1) {
      dfs(i, 0, 0);
    }
  }
  puts("Yes");
}


Measured memory_bytes: 13312
#d=日数, c=満足低下度, s=満足上昇度, t=コンテストの日程 
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
t = [int(input()) for j in range(d)]
last = [0 for i in range(26)]
#print(c)
res = 0
count = 0
#while count != len(t):
for day in range(d):
  res += s[day][t[day]-1]
  last[t[day]-1] = day+1
  #print(last)
  #print(c[last[t[day]-1]])
  for i in range(26):
    #print(c[i] * (day + 1 - last[i]))
    res -= c[i] * (day + 1 - last[i])
  print(res)

Measured memory_bytes: 9184
icase=0
if icase==0:
    n=int(input())
    w=list(map(int,input().split()))
    ws=[0]*n
    ws[0]=w[0]
    for i in range(1,n):
        ws[i]=ws[i-1]+w[i]
    wdmin=100000
    for i in range(n):
        wd=abs(ws[-1]-2*ws[i])
        wdmin=min(wdmin,wd)
    print(wdmin)        
    

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    ll ans = 0;
    ll count = 0;
    for(ll i=0; i<S.length(); i++){
        if((S[i] == 'A') || (S[i] == 'C') || (S[i] == 'G') || (S[i] == 'T')){
            count++; 
            ans = max(ans, count);
        }
        else{
            count = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod=MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}


ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}



int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int r, c, k;
    cin>>r>>c>>k;

    for(int oddrows=0;oddrows<=r;oddrows++)
    	for(int oddcols=0;oddcols<=c;oddcols++)
    		if(oddrows*(c-oddcols) + oddcols*(r-oddrows) == k){
    			cout<<"Yes";
    			return 0;
    		}

    cout<<"No";
    return 0;
}







 




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;

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

  int N;
  cin >> N;

  ll A[301010];

  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  ll ans = 0;
  for (int b = 0; b < 60; b++) {
    ll msk = 1LL << b;

    ll zero = 0, one = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & msk) {
        one++;
      } else {
        zero++;
      }
    }

    ans += msk % MOD * zero % MOD * one % MOD;
  }
  cout << ans % MOD << endl;

  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<20)
#define LLINF (1LL<<60)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
    return 0;
}


Measured memory_bytes: 3632
use std::io;

fn printnum(x: i32){
    println!("{}", x);
}

fn sum(x: i32, y: i32) -> i32{
    x + y
}

fn read() -> i32{
    let mut x = String::new();
    io::stdin().read_line(&mut x).expect("read_line error");
    let x = x.trim().parse().expect("parse error");
    x
}

fn main() {
    let mut a = [0; 5];
    for i in (0..5){ a[i] = read(); }
    let k = read();
    println!("{}",if a[4] - a[0] <= k { "Yay!" } else { ":(" });
}


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

int main()
{
    int a, b, c, s = 0;
    cin >> a >> b >> c;

    for (; a <= b; a++)
    {
        if (c % a == 0)
        {
            s++;
        }
    }

    cout << s << endl;
}



Measured memory_bytes: 3112
#include<cstdio>
#include<algorithm>
using ll=long long;
int main(){
    ll l,r;
    scanf("%lld%lld",&l,&r);
    if(r-l>2019*2){
        printf("0\n");
    }else{
        ll ans=2018;
        for(ll i=l;i<=r;i++){
            for(ll j=i+1;j<=r;j++){
                ans=std::min(ans,(i*j)%2019);
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
template <class T> void corner(bool flg, T hoge) {
    if (flg) {
        cout << hoge << endl;
        exit(0);
    }
}
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin >> h >> w;
    ll A[h][w];
    rep(i, h) {
        rep(j, w) {
            cin >> A[i][j];
        }
    }

    rep(i, h) {
        rep(j, w) {
            cin >> x;
            A[i][j] -= x;
        }
    }

    bitset<25600> dp[h][w];
    rep(i, h) {
        rep(j, w) {
            if (i == 0 && j == 0){
              dp[i][j].set(A[0][0]+80);
              dp[i][j].set(-A[0][0]+80);
            }
            if(i != 0) {
                dp[i][j] = dp[i][j] | (dp[i - 1][j] << A[i][j] + 80);
                dp[i][j] = dp[i][j] | (dp[i - 1][j] << -A[i][j] + 80);
            }
            if (j != 0) {
                dp[i][j] = dp[i][j] | (dp[i][j-1] << A[i][j] + 80);
                dp[i][j] = dp[i][j] | (dp[i][j-1] << -A[i][j] + 80);
            }
          //cout<<dp[i][j][ans + (i+j) * 80]<<endl;
        }
    }

    while (!dp[h - 1][w - 1][ans + (h + w - 1) * 80])ans++;

    cout << ans << endl;
}

Measured memory_bytes: 20352
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto G = new int[][](N, N);

    DList!int red;
    DList!int blue;

    foreach (i; 0..bsr(N)+1) {
        red.clear;
        blue.clear;
        foreach (j; 0..N) (((j >> i) & 1) ? red : blue).insertBack(j);
        foreach (r; red) foreach (b; blue) if (G[r][b] == 0) G[r][b] = G[b][r] = i + 1;
    }

    N.iota.each!(i => G[i][i+1..$].map!(to!string).join(" ").writeln);
}

Measured memory_bytes: 5628
#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <stack>
#include <random>
#include <bitset>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>

using namespace std;

int n;

int main()
{
#if _DEBUG
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("capital.in", "r", stdin);
	//freopen("capital.out", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin >> n;
	if (n / 10 == 9 || n % 10 == 9)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

#define ll long long
#define ld long double
#define ii pair<int ,int >
#define S second
#define F first
#define PI 3.1415926535897932384626
#define SPEED std::ios_base::sync_with_stdio(false);
const int inf = 1e9+7;
int h,w;
int a[107][107],dp[107][107];

int main(){
    SPEED
        cin>>h>>w;
        for(int i=0;i<h;i++){
            string s; cin>>s;
            for(int j=0;j<w;j++){
                if(s[j]=='#')a[i][j]=1;
                dp[i][j]=inf;
            }
        }
    dp[0][0]=a[0][0];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i-1>=0){
                dp[i][j]=min(dp[i][j],dp[i-1][j]+(!a[i-1][j] & a[i][j]));
            }
            if(j-1>=0){
                dp[i][j]=min(dp[i][j],dp[i][j-1]+(!a[i][j-1] & a[i][j]));
            }
        }
    }
    cout<<dp[h-1][w-1];
}


Measured memory_bytes: 384
import sys

def generate_next_hexes(x, y):
    hexes = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)]
    if y % 2:
        hexes += [(x - 1, y - 1), (x - 1, y + 1)]
    else:
        hexes += [(x + 1, y - 1), (x + 1, y + 1)]
    return hexes

def update_map(hex_map, hexes):
    num_updated_hexes = 0
    distance = 0
    while hexes:
        next_hexes = []
        for pos in hexes:
            x = pos[0]
            y = pos[1]
            if (1 <= x <= m and 1 <= y <= n
                    and (pos not in hex_map or distance < hex_map[pos])):
                hex_map[pos] = distance
                num_updated_hexes += 1
                next_hexes += generate_next_hexes(x, y)
        distance += 1
        hexes = next_hexes
    return num_updated_hexes

while True:
    (m, n) = [int(i) for i in sys.stdin.readline().split()]
    if m == n == 0:
        break

    s = int(sys.stdin.readline())
    stores = []
    for i in range(s):
        pos = [int(j) for j in sys.stdin.readline().split()]
        stores.append(tuple(pos))
    hex_map = {}
    update_map(hex_map, stores)

    t = int(sys.stdin.readline())
    candidates = []
    for i in range(t):
        pos = [int(j) for j in sys.stdin.readline().split()]
        candidates.append(tuple(pos))

    max_num_blocks = 0
    for candidate in candidates:
        new_hex_map = hex_map.copy()
        num_blocks = update_map(new_hex_map, [candidate])
        max_num_blocks = max(max_num_blocks, num_blocks)

    print(max_num_blocks)

Measured memory_bytes: 7036
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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

    int ans,max_cnt=-1;
    for(int i=1;i<=N;i++){
        int t=i,cnt=0;
        while(t%2==0){
            t/=2;
            cnt++;
        }
        if(cnt>max_cnt){
            max_cnt=cnt;
            ans=i;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,i;
  char s[100],t[100];
  scanf("%d",&n);
  scanf("%s",s);
  scanf("%s",t);
  for (i = 0; i < n; i++) {
    printf("%c%c",s[i],t[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
using System;

namespace _0048
{
    class Program
    {
        static void Main(string[] args)
        {
            float[] weight = { 48.00f, 51.00f, 54.00f, 57.00f, 60.00f, 64.00f, 69.00f, 75.00f, 81.00f, 91.00f, 100000.00f };
            string[] name = { "light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy" };

            while (true)
            {
                var input = Console.ReadLine();
                if (string.IsNullOrEmpty(input))
                {
                    break;
                }
                var personalWeight = float.Parse(input);
                for (int i = 0; ; i++)
                {
                    if (personalWeight <= weight[i])
                    {
                        Console.WriteLine(name[i]);
                        break;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 5748
from collections import deque
A = list(input())
B = list(input())
C = list(input())
next = 'a'
qa = deque(A)
qb = deque(B)
qc = deque(C)


while True:
    if next == 'a':
        if len(qa) == 0:
            print('A')
            break
        next = qa.popleft()
    elif next == 'b':
        if len(qb) == 0:
            print('B')
            break
        next = qb.popleft()
    else:
        if len(qc) == 0:
            print('C')
            break
        next = qc.popleft()


Measured memory_bytes: 3316
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    const PI: f32 = 3.1416;
    input!{
        r: i32
    };
    println!("{}", 2.0 * (r as f32) * PI);
}

Measured memory_bytes: 2104
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_set>
#include<vector>
#include<utility>
#include<cstring>
#define pb(a)             push_back(a)
#define mp(a,b)           make_pair(a,b)
#define pf printf
#define ff first
#define ss second
#define sef second.first
#define ses second.second
#define ms(a,b)            memset(a, b, sizeof(a))
#define loop(i,a)          for(int i=1;i<=a;i++)
#define pii                pair <int,int>
#define sl(a)              scanf("%I64d",&a)
#define sll(a,b)           scanf("%I64d %I64d",&a,&b)
#define si(a)              scanf("%d",&a)
#define sii(a,b)           scanf("%d %d",&a,&b)
using namespace std ;
const int maxx = 8e4+10;
//typedef pair < int , pii > node ;
//node tree[4*maxx],lazy[4*maxx];
typedef long long ll ;
int tree[4*maxx],lazy[4*maxx] ;
int gcd(int a,int b)
{
    if(b==0){return a;}
    return gcd(b,a%b);
}
int main()
{
  int k ;
  ll sum=0;
  si(k);
  loop(i,k)
  {
      loop(j,k)
      {
          loop(p,k)
          {
              int a = gcd(max(i,j),min(i,j)),b;
              b = gcd(max(a,p),min(a,p));
              sum+=b;
          }
      }
  }
  cout << sum << endl;
  return 0 ;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
#define MOD 1000000007
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> c(n),s(n),f(n),ans(n);
    rep(i,0,n-1){
        cin>>c[i]>>s[i]>>f[i];
        ans[i]=s[i];
    }
    rep(i,0,n-1){
        rep(j,0,i+1){
            ans[j]+=c[i];
            if(i!=n-2){
                if(ans[j]<s[i+1])ans[j]=s[i+1];
                else{
                    int buf=(ans[j]-s[i+1])/f[i+1];
                    if(((ans[j]-s[i+1])%f[i+1])!=0)buf++;
                    ans[j]=s[i+1]+f[i+1]*buf;
                }
            }
        }
    }
    rep(i,0,n)cout<<ans[i]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    long x1,x2,y1,y2;
    cin>>x1>>x2>>y1>>y2;
    long answer=-1*pow(10,18);
    vector<vector<long>> vec={{x1,x2},{y1,y2}};
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            if(vec[0][i]*vec[1][j]>answer){
                answer=vec[0][i]*vec[1][j];
            }
        }
    }
    cout<<answer;
}

Measured memory_bytes: 3628
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
N = int(input())
num = []
for i in range(N):
	n = int(input())
	num.append(n)
chk = []
for i in range(3):
	a = [0]*3
	chk.append(a)
for i in range(3):
	for j in range(3):
		if i == 0:
			if A[j] in num:
				chk[0][j] = 1
		elif i == 1:
			if B[j] in num:
				chk[1][j] = 1
		else:
			if C[j] in num:
				chk[2][j] = 1
if chk[0] == [1,1,1] or chk[1] == [1,1,1] or chk[2] == [1,1,1]:
	print("Yes")
elif chk[0][0] + chk[1][1] + chk[2][2] == 3 :
	print("Yes")
elif chk[0][2] + chk[1][1] + chk[2][0] == 3 :
	print("Yes")
elif chk[0][0] + chk[1][0] + chk[2][0] == 3 :
	print("Yes")
elif chk[0][1] + chk[1][1] + chk[2][1] == 3 :
	print("Yes")
elif chk[0][2] + chk[1][2] + chk[2][2] == 3 :
	print("Yes")
else:
	print("No")

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    string s; cin>>s;
    ll ans=0;
    rep(i,s.size()){
        if(s.substr(i,3)=="ABC") ++ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
int main()
{
  int n, zero = 0;
  long long arr[100000];
  long long temp = 1;
  scanf("%d",&n);
  for(int i = 0; i < n ;i++)
  {
    scanf("%lld", &arr[i]);
  }
  for(int i = 0; i < n;i++)
  {
    if(arr[i] == 0)
	{
      zero=zero+1;
    }
    if(zero > 0)
	{
      printf("0\n");
      return 0;
    }
  }
  
  for(int i = 0; i < n;i++)
  {
    if(arr[i]<=1000000000000000000/temp)
	{
      temp = temp * arr[i];
    }
    else
	{
      printf("-1\n");
      return 0;
    }
  }
  printf("%lld", temp);
  return 0;
}

Measured memory_bytes: 2492
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int n;
	cin >> n;
	vector<ll> v(n+1);
	v[0] = 2;
	v[1] = 1;
	for (int i = 2; i < n+1;i++) {
		v[i] = v[i - 1] + v[i - 2];
	}
	cout << v[n] << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<stack>

using namespace std;
int a[200];
int main(){
    int n, count=0;
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++){
        int min = i;
        for(int j=i;j<n;j++){
            if(a[j]<a[min]) {
                min = j;
            }
        }
        if(min!=i){
            count++;
            int tmp = a[i];
            a[i] = a[min];
            a[min] = tmp;
        }
    }
    for(int i=0;i<n;i++){
        if(i!=0) cout << " ";
        cout << a[i];
    }
    cout << "\n" << count << endl;
    return 0;
}


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

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T &b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T &b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { 1,  0, -1,  0,  1, -1,  1, -1};
static const int dy[8] = { 0,  1,  0, -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

const int maxn = 300+5;

LL dp[maxn][maxn];
LL height[maxn];
int N,K;

void init(){
    _for(i,0,maxn) _for(j,0,maxn)  dp[i][j] = INF;
    dp[0][0] = 0;
    cin >> N >> K;
    _rep(i,1,N){
        cin >> height[i];
    }
    height[0] = 0;


}

int main()
{
    init();
    _rep(j,1,N-K){
        _rep(i,j,N){
            LL &ans = dp[i][j];
            _rep(k,j-1,i-1){
                ans = min(ans,dp[k][j-1] + max(height[i] - height[k],0LL));
            }
        }
    }

    /*
    _rep(i,0,N){
        _rep(j,0,N){
            printf("%lld ",dp[i][j]);
        }
        printf("\n");
    }
    */
    LL a = INF;
    _rep(i,N-K,N){
        a = min(dp[i][N-K],a);
    }

    cout << a <<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	string s;
	cin>>s;
	if(s.back() == 's'){
		s+="es";
	}
	else{
		s+='s';
	}
	cout<<s<<endl;
}


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

typedef long long ll;
typedef tuple<int,int, int> tup;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

void printV(vector<int> &v);
void printVV(vector<vector<int>> &vv);


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

  vector<int> t(N+1);
  vector<int> x(N+1);
  vector<int> y(N+1);
  vector<int> dt(N+1);
  vector<int> di(N+1);

  t.at(0) = 0;
  x.at(0) = 0;
  y.at(0) = 0;
  dt.at(0) = 0;
  di.at(0) = 0;
  for(int i = 1; i <= N; i++) {
    cin >> t.at(i) >> x.at(i) >> y.at(i);
    dt.at(i) = t.at(i) - t.at(i-1); // 時刻の差
    di.at(i) = abs(x.at(i) - x.at(i-1)) + abs(y.at(i) - y.at(i-1)); // 変位の合計
  }

  // printV(dt);
  // printV(di);

  for(int i = 1; i <= N; i++) {
    if(dt.at(i) - di.at(i) < 0 || (dt.at(i) - di.at(i)) % 2 == 1) { // 秒数 - 変位の合計 が 0未満
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


// ベクターの中身を全部出力
void printV(vector<int> &v) {
  cout << "  [ ";
  for(int i = 0; i < (int)v.size(); i++) {
    cout << v.at(i) << " ";
  }
  cout << "]" << endl;
}

void printVV(vector<vector<int>> &vv) {
  cout << "{" << endl;
  for(int i = 0; i < (int)vv.size(); i++) {
    cout << "  [ ";
    for(int j = 0; j < (int)vv.at(i).size(); j++) {
      cout << vv.at(i).at(j) << " ";
    }
    cout << "]," << endl;
  }
  cout << "}" << endl;
}


Measured memory_bytes: 2176
import sys

K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    sys.exit(0)

if K % 7 == 0:
    K //= 7

count = 0
candidate = 1

while True:
    count += 1
    rem = candidate % K
    if rem == 0:
        print(count)
        sys.exit(0)
    candidate = 10*rem + 1

Measured memory_bytes: 9096
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  int N,M,cnt=0,ans=0;
  cin>>N;
  string s[N];
  for(int i=0;i<N;i++) cin>>s[i];
  cin>>M;
  string t[M];
  for(int i=0;i<M;i++) cin>>t[i];
  
  for(int i=0;i<N;i++){
    cnt=0;
    for(int j=0;j<N;j++){
      if(s[i]==s[j]) cnt++;
    }
    for(int k=0;k<M;k++){
      if(s[i]==t[k]) cnt--;
    }
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String o = sc.nextLine();
    String e = sc.nextLine();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < e.length(); i++) {
      sb.append(o.charAt(i));
      sb.append(e.charAt(i));
    }
    if (o.length() != e.length()) {
      sb.append(o.charAt(o.length() - 1));
    }
    System.out.println(sb.toString());
  }
}

Measured memory_bytes: 21716