akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string a,b,c; cin >> a >> b>> c;
    int n=0;

    for(;;){
        if(n==0){
            if(a.size()==0){
                cout<<'A'<<endl;
                return 0;
            }
            n=a[0]-'a';
            a.erase(0,1);
            
        }else if(n==1){
            if(b.size()==0){
                cout<<'B'<<endl;
                return 0;
            }
            n=b[0]-'a';
            b.erase(0,1);
            
        }else{
            if(c.size()==0){
                cout<<'C'<<endl;
                return 0;
            }
            n=c[0]-'a';
            c.erase(0,1);
            
        }
    }
}   

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  vector<int64_t> L(N + 1);
  
  L.at(0) = 2;
  L.at(1) = 1;
  
  for (int i = 2; i < N + 1; i++){
    L.at(i) = L.at(i-1) + L.at(i-2);
  }

  cout << L.at(N) << endl;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
  	for(int i=0; i<n; i++){
		cin >> a.at(i);
    }
  	sort(a.begin(), a.end());
  	int sum=0;
  	for(int i=0; i<n-1; i++){
		sum += a.at(i);
    }
  	if(sum<=a.at(n-1)){
		cout << "No" << endl;
    }else{
		cout << "Yes" << endl;
    }
	return 0;
}


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

using namespace std;

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

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

int main() {
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    cout<<a*a-b<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p == NIL) printf("root, ");
  else if(T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r != NIL) calcDepth(T[u].r, p);
  if(T[u].l != NIL) calcDepth(T[u].l, p+1);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 6376
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m, q;
	cin>>n>>m>>q;
	P p[200000];
	for(int i=0; i<m; i++){
		int l, r;
		cin>>l>>r;
		p[i]=P(r, l);
	}
	sort(p, p+m);
	int d=450;
	vector<int> vl[450];
	for(int i=0; i<m; i++){
		vl[i/d].push_back(p[i].second);
	}
	for(int i=0; i<=(m-1)/d; i++){
		sort(vl[i].begin(), vl[i].end());
	}
	for(int k=0; k<q; k++){
		int x, y;
		cin>>x>>y;
		int i0=upper_bound(p, p+m, P(y, 502))-p;
		if(i0==0){
			cout<<0<<endl;
			continue;
		}
		int ans=0;
		for(int i=0; i<(i0-1)/d; i++){
			ans+=(vl[i].end()-lower_bound(vl[i].begin(), vl[i].end(), x));
		}
		for(int i=(i0-1)/d*d; i<i0; i++){
			if(p[i].second>=x) ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3456
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

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

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

	cin >> N;
	string ans;
	while (N) {
		N--;
		ans += 'a' + N % 26;
		N /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int dp[1001];
const int  mod=1e9+7;
int main()
{
    int h,w;
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>h>>w;
    dp[1]=1;
    for(int i=0;i<h;i++)
    {
        string s;
        cin>>s;
        for(int j=1;j<=w;j++)
        {
            if(s[j-1]=='.')
                dp[j]=(dp[j]+dp[j-1])%mod;
            else
                dp[j]=0;
        }
    }
    cout<<dp[w];
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;

inline void chk_min(int &a,int b){ if(a>b) a=b;}
inline void chk_max(int &a,int b){ if(a<b) a=b;}

int n;
char s[10+5];
int a[10+5],f[10+5][10+5];

ll gao(int now,bool lead,bool lim,int lst)
{
	if(now>n) return 1;
	if(~f[now][lst] && !lead && !lim) return f[now][lst];
	ll res = 0;
	
	int down = 0;
	int up = lim? a[now]: 9;
	if(!lead)
		chk_max(down, lst-1),
		chk_min(up, lst+1);
	
	for(int i=down; i<=up; ++i)
		res += gao(now+1, lead && !i, lim && i==a[now], i);
	if(!lead && !lim) f[now][lst] = res;
	return res;
}

ll chk(ll x)
{
	memset(f,-1,sizeof(f));
	
	sprintf(s+1,"%lld",x);
	n = strlen(s+1);
	for(int i=1; i<=n; ++i) a[i] = s[i]-'0';
	
	return gao(1,1,1,0);
}

int main(void)
{
	int d;
	scanf("%d",&d);
	++d;
	
	ll l=1, r=4e9;
	while(l<r)
	{
		ll mid = (l+r)>>1ll;
		if(chk(mid)>=d) r=mid;
		else l=mid+1;
	}
	printf("%lld",l);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
	int h, w;cin>>h>>w;
	bool ans=true;
	vector<vector<char>> field(h, vector<char>(w));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>field[i][j];
		}
	}
	int start=0;
	for(int i=0;i<h;i++){
		bool fin=false;
        if(field[i][start]!='#'){ans=false;break;}
		for(int j=0;j<w;j++){
			if(field[i][j]=='#'&&j<start){ans=false;break;}
			if(!fin&&(field[i][j]=='.'&&j>start)){start=j-1;fin=true;}
			else if(fin&&field[i][j]=='#'){ans=false;break;}
		}
        if(field[i][w-1]=='#')start=w-1;
		if(!ans)break;
	}
	cout << (ans?"Possible":"Impossible") << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

class Pair implements Comparable<Pair>{
  int i;
  int cnt;
  public Pair(int a, int b){
      this.i = a;
      this.cnt = b;
  }
  public int compareTo(Pair p){
    if(this.cnt == p.cnt) return 0;
    if(this.cnt<p.cnt) return -1;
    return 1;
  }
}

class Main{
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N = Integer.parseInt(sc.next());
      int K = Integer.parseInt(sc.next());
      HashMap<Integer, Pair> map = new HashMap<>();
      LinkedList<Pair> l = new LinkedList<>();
      for(int i = 0; i<N; i++){
        int c = Integer.parseInt(sc.next());
        if(!map.containsKey(c)){
          Pair p = new Pair(c,1);
          l.add(p);
           map.put(c, p);
         }
        else{
          Pair p = map.get(c);
          p.cnt++;
          map.put(c,p);
        }
      }
      Collections.sort(l);
      int size = l.size();
      if(size<=K){
        System.out.println(0);
        return;
      }
      long num = 0;
      for(int i = 0; i<K; i++){
          Pair cur =  l.get(size-i-1);
          num+=cur.cnt;
      }
      System.out.println(N-num);
  }
}

Measured memory_bytes: 74568
#include <bits/stdc++.h>
using namespace std;
int main() {
  while(1) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    int pa = 0;
    int pb = 0;
    for (int i=0; i<n; i++) {
      int a,b;
      cin >> a >> b;
      if (a > b) {
        pa += a;
        pa += b;
      } else if (a < b) {
        pb += a;
        pb += b;
      } else {
        pa += a;
        pb += b;
      }
    }
    cout << pa << " " << pb << endl;
  }
}


Measured memory_bytes: 3044
/*Saurav Paul*/
#include<bits/stdc++.h>
using namespace std;

int main()
{
    long long int a , b, c , k;
    cin >> a >> b >> c >> k ;
    long long int ans = 0 ;
    long long int x = min( a, k) ;
    ans += x ;
    k -= x ;
    x = min(b , k) ;
    k -= x ;
    ans -= k ;

    cout << ans << endl; 


    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define INF 0x3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n" 
#define pb push_back
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define print(v); for(auto x:v) cout<<x<<" "; cout<<endl;
typedef long long int ll;
int main()
{
    fast;
    ll x;
    cin >> x;
    ll start = 100;
    ll count = 0;
    while(start < x){
        ll percent = floor((long double)(0.01 * start));
        // cout << "percent: " << percent << endl;
        start = start + percent;
        count++;
    }
    cout << count << endl;



    return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n;
  cin >> n;
  if(n == 1)
    cout << "Hello World" << endl;
  else{
    ll a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
  
    

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
using namespace std;

int main() {
	int A;
	cin >> A;
	if (A == 23) {
		cout << "Christmas Eve Eve" << endl;
	}
	else if (A == 24) {
		cout << "Christmas Eve" << endl;
	}
	else if (A == 25) {
		cout << "Christmas" << endl;
	}
	else if (A == 22) {
		cout << "Christmas Eve Eve Eve" << endl;
	}

	return 0;
}

Measured memory_bytes: 764
N = int(input())
H = list(map(int, input().split()))

flag = "Yes"
for i in range(N-1,0,-1):
  if H[i-1] - H[i] > 1:
    flag = "No"
    break;
  elif H[i-1] - H[i] == 1:
    H[i-1] -= 1
for i in range(N-1):
  if H[i] - H[i+1] > 0:
    flag = "No"
    break;    
  
print (flag)


Measured memory_bytes: 14704
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_WH = 100;

int A, B;
char field[MAX_WH][MAX_WH];
int m[MAX_WH][MAX_WH];


int main() {
  cin >> A >> B;

   cout << 100 << ' ' << 100 << endl;

   --A; --B;
   rep(i,50) {
     rep(j,100) {
       if (i%2 == 0) cout << '.';
       else {
         if (j%3 == 1 && B > 0) {
           cout << '#'; --B;
         } else {
           cout << '.';
         }
       }
     }
     cout << endl;
   }

   rep(i,50) {
     rep(j,100) {
       if (i%2 == 0) cout << '#';
       else {
         if (j%3 == 1 && A > 0) {
           cout << '.'; --A;
         } else {
           cout << '#';
         }
       }
     }
     cout << endl;
   }
   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k;
priority_queue<int>q; 
int sum;
int main(){
	cin>>n>>k;
	for (int i=1;i<=n;i++){
		int x;
		cin>>x;
		q.push(x);
	}
	for (int i=1;i<=k;i++){
		sum+=q.top();
		q.pop();
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 256
while True:
    i,j,k = map(int, raw_input().split())
    if i==0 and j==0 and k==0: break
    n = i+j+k
    s = []
    a = set(range(n))
    b = set()
    c = set()
    for i in range(input()):
        x, y, z, r = map(int, raw_input().split())
        x-=1;y-=1;z-=1;
        if r==0: s.append(set([x,y,z]))
        else:
            c.add(x);c.add(y);c.add(z);
    while True:
        f = True
        for lst in s:
            if len(lst & c) >=2:
                s.remove(lst)
                lst = lst - c
                if len(lst)>=1: b.add(lst.pop())
                f = False
        if f : break
    a = a - b; a = a - c;
    for i in range(n):
        if i in a: print 2
        elif i in b: print 0
        else: print 1

Measured memory_bytes: 6356
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

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

    ll x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<pair<ll,int>> v;
    vector<ll> w;
    rep(i,a){
        ll t;cin>>t;
        v.push_back({t,0});
    }
    rep(i,b){
        ll t;cin>>t;
        v.push_back({t,1});
    }
    rep(i,c){
        ll t;cin>>t;w.push_back(t);
    }
    sort(ALL(v));reverse(ALL(v));
    sort(ALL(w));reverse(ALL(w));
    vector<ll> sum(500000,0);
    rep(i,c){
        sum[i+1]=sum[i]+w[i];
    }
    ll cnt[2]={};
    ll s=0,ans=0;
    rep(i,v.size()){
        if(v[i].second==0){
            if(cnt[0]<x) s+=v[i].first,cnt[0]++;
        }else{
            if(cnt[1]<y) s+=v[i].first,cnt[1]++;
        }
        chmax(ans,s+sum[x+y-cnt[0]-cnt[1]]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9836
#include "cstring"
#include "cstdio"
#include "queue"
using namespace std;

const int maxn=1024;

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};

char mp[maxn][maxn];
int vis[maxn][maxn];
int wx[10],wy[10];
int n,m,k;

int bfs(int x1,int y1,int x2,int y2)
{
	memset(vis,0,sizeof(vis));
	queue<int>qx;qx.push(x1);
	queue<int>qy;qy.push(y1);
	queue<int>qt;qt.push(0);
	vis[x1][y1]=1;
	
	while(!qx.empty())
	{
		int nx=qx.front();qx.pop();
		int ny=qy.front();qy.pop();
		int nt=qt.front();qt.pop();
		
		if(nx==x2 && ny==y2)return nt;
		
		for(int i=0;i<4;i++)
		{
			int px=nx+dx[i];
			int py=ny+dy[i];
			if(px>=0 && py>=0 && px<n && py<m && mp[px][py]!='X' && !vis[px][py])
			{
				qx.push(px);
				qy.push(py);
				qt.push(nt+1);
				vis[px][py]=1;
			}
		}
		
	}
	
	return 0;
}

int main()
{
	//freopen("f.txt","r",stdin);
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		{
			mp[i][j]=getchar();
			while(mp[i][j]=='\n' || mp[i][j]=='\0')mp[i][j]=getchar();
			if(mp[i][j]>='1' && mp[i][j]<='9')
			{
				wx[mp[i][j]-'0']=i;
				wy[mp[i][j]-'0']=j;
			}
			if(mp[i][j]=='S')
			{
				wx[0]=i;
				wy[0]=j;
			}	
		}
	int ans=0;
	for(int i=0;i<k;i++)
		ans+=bfs(wx[i],wy[i],wx[i+1],wy[i+1]);
	printf("%d\n",ans);
	return 0;
} 


Measured memory_bytes: 7852
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])



Measured memory_bytes: 11880
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
using namespace std;
#define MK make_pair
#define F first
#define S second
const int MX=-1*(1e9+7);


int main(){
    int v,e,s;
    int dis[110000];
    fill(dis,&dis[110000],MX);
    vector<vector<pair<int,int>>> E(110000); //to,dis
    cin>>v>>e>>s;
    
    dis[s]=0;
    for(int i=0;i<e;i++){
        int h,t,d;
        cin>>h>>t>>d;
        E[h].push_back(MK(t,d));
    }
    priority_queue<pair<int,int>> q; //-1*dis,to
    bool done[110000]={};
    q.push(MK(0,s));
    while(!q.empty()){
        pair<int,int> a=q.top();
        q.pop();
        if(done[a.S]){continue;}
        done[a.S]=true;
        for(int i=0;i<E[a.S].size();i++){
            pair<int,int> b=E[a.S][i];
            if(dis[b.F]<dis[a.S]-b.S){
                dis[b.F]=dis[a.S]-b.S;
                q.push({dis[b.F],b.F});
            }
        }
    }
    for(int i=0;i<v;i++){
        if(dis[i]!=MX){
            cout<<-1*dis[i]<<endl;
        }
        else{
            cout<<"INF"<<endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 13336
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// original: satanic-san
// https://atcoder.jp/contests/abc141/submissions/7525527
class RollingHash {
    template <int B, int M>
    class RollingHashPart {
      private:
        size_t len;
        std::vector<int> pow_b, hash;

      public:
        RollingHashPart() {}
        template <typename T>
        RollingHashPart(const T &s) : len(s.size()), pow_b(s.size() + 1), hash(s.size() + 1) {
            pow_b[0] = 1;
            hash[0]  = 0;
            for (int i = 0; i < len; i++) {
                pow_b[i + 1] = (ll)pow_b[i] * B % M;
                hash[i + 1]  = ((ll)hash[i] * B + s[i]) % M;
            }
        }
        // [l, r)
        int get(int l, int r) const {
            int res = (hash[r] - (ll)hash[l] * pow_b[r - l]) % M;
            if (res < 0)
                res += M;
            return res;
        }
    };

  public:
    using HashData = pair<int, int>;
    RollingHashPart<1033, 1000000007> rh1;
    RollingHashPart<6037, 999999937> rh2;

    RollingHash() {}
    template <typename T>
    RollingHash(const T &s) : rh1(s), rh2(s) {}
    // [l, r)
    HashData get(int l, int r) const { return HashData{rh1.get(l, r), rh2.get(l, r)}; }
    // [l1, r1), [l2, r2)
    int lcp(const RollingHash &rhs, int l1, int r1, int l2, int r2) const {
        int lb = 0, ub = std::min(r1 - l1, r2 - l2) + 1;
        while (ub - lb > 1) {
            int md                                               = (lb + ub) >> 1;
            (get(l1, l1 + md) == rhs.get(l2, l2 + md) ? lb : ub) = md;
        }
        return lb;
    }
};


int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    RollingHash rh(s);
    int maxLen = 0;
    for (int i = 0; i < s.size(); ++i) {
        for (int j = i; j < s.size(); ++j) {
            while (maxLen < j - i && j + maxLen < n && rh.get(i, i + maxLen + 1) == rh.get(j, j + maxLen + 1))
                maxLen++;
        }
    }
    cout << maxLen << "\n";
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;


int main() {
	int a;
	int ans = 0;
	cin >> a;
	vector<int> s(a);
	rep(i, a)cin >> s[i];
	rep(i, a) {
		if (i + 1 != s[i])ans++;
	}
	if (ans == 0 || ans == 2)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int N;
	int M;
	int X=0;
	int Y=0;
	
		scanf("%d %d",&N,&M);
		int i;
		
			if(N + M !=2){
				
				for(i=0;i<N;i++)
					X+=i;
				for(i=0;i<M;i++){
					Y+=i;	
					}
					printf("%d\n",X+Y);
				}
			else{
				puts("0");
			}
	return 0;
	}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int u[5001];
int v[5001];
int root(int a){ return u[a] == a ? a : root(u[a]);}

inline void update(int a){
    RREP(i,a){
	u[i] = min(u[i],root(i));
    }
}

void add(int a,int b){
    int na = root(a);
    int nb = root(b);
    u[a] = min(na,nb);
    u[b] = min(na,nb);
}

int main(){
    int n,m;
    REP(i,5001) u[i] = i;
    pair<int,int> ap[5001];
    map<string,int> dic;
    cin >> n;
    vector< pair<int,string> > a(n);
    REP(i,n){
	string ss;
	int x;
	cin >> ss >> x;
	a[i] = make_pair(x,ss);
    }
    sort(ALL(a));
    REP(i,n){
	dic[a[i].second] = a[i].first;
	v[i] = a[i].first;
    }
    cin >> m;
    REP(i,m){
	string s[2];
	cin >> s[0] >> s[1];
	int ab[2];
	int p = 0;
	REP(j,2){
	    REP(k,n){
		if(s[j] == a[k].second){
		    p = k+1;
		    ab[j] = k;
// 		    printf("ab[%d] = %d\n",j,ab[j]);
		    break;
		}
	    }
	}
	ap[i] = make_pair(ab[0],ab[1]);
    }
    REP(j,n)REP(i,m){
	add(ap[i].first,ap[i].second);
// 	update(n);
    }
    int ans = 0;
    REP(i,n){
	ans += v[root(i)];
// 	printf("root(%d) = %d\n",i,root(i));
// 	printf("v[root(%d)] = %d\n",i,v[root(i)]);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int n, k;
  cin>>n>>k;
  if (k % 2 == 1) {
    long long x = n / k;
    cout<<x*x*x<<endl;
  } else {
    int kk = k / 2;
    long long x = n / k;
    long long y = n / kk - n / k;
    cout<<x*x*x + y*y*y<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int h, w;
char field[1000][1000];
int ans[100][100];

int main(){
	cin >> h >> w;
	REP(i, h){
		REP(j, w){
			cin >> field[i][j];
			if (field[i][j] == 'c')ans[i][j] = 0;
			else ans[i][j] = -1;
		}
	}
	REP(i, h){
		REP(j, w){
			if (ans[i][j] == 0){
				for (int k = j + 1; k < w; k++){
					if (ans[i][k] == -1){
						ans[i][k] = ans[i][k - 1] + 1;
					}
					else break;
				}
			}
		}
	}
	REP(i, h){
		REP(j, w){
			if (j == 0)cout << ans[i][j];
			else cout << " " << ans[i][j];
		}
		cout << endl;
	}
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    deque<int> dq;
    rep (i, n) {
        int pos = lower_bound(dq.begin(), dq.end(), a[i]) - dq.begin();
        if (pos == 0) dq.push_front(a[i]);
        else dq[--pos] = a[i];
    }
    cout << dq.size() << endl;
    
    return 0;
}



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

int main(){
    int i;
    char c;
    map<char, int> a;
    for(i = 'a'; i < 'z' + 1; i++){
        a[i] = 0;
    }
    while(scanf("%c", &c) != EOF){
        if('A' <= c && c <= 'Z') c += 32;
        a[c]++;
    }
    for(i = 'a'; i < 'z' + 1; i++){
        printf("%c %c %d\n", i, ':', a[i]);
    }
}


Measured memory_bytes: 3212
# Problem C - Dice and Coin
# input
N, K = map(int, input().split())

# initialization
ans = 0

def calc_count(n, K):
    tmp = 0
    while n<K:
        tmp += 1
        n *= 2
    return tmp

# count
for i in range(1, N+1):
    count = calc_count(i, K)
    ans += (1 / 2)**count

# output
ans = ans / N
print(ans)


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

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a, b) << endl;

}

Measured memory_bytes: 256
N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]

"""
方針：0<=cx,cy<=100なのでcx,cyの特定は全数探索で間に合う
(cx,cy)があっていればh+(abs(cx-x)+abs(cy-y))=const
"""

xyh.sort(reverse=True,key = lambda x:x[2])

for cx in range(101):
	for cy in range(101):
		H = xyh[0][2] + (abs(cx-xyh[0][0]) + abs(cy-xyh[0][1]))
		correct_center = True
		for i in range(N):
			if max(H-(abs(cx-xyh[i][0]) + abs(cy-xyh[i][1])),0) != xyh[i][2]:
				correct_center = False
				break
		if correct_center:
			break
	if correct_center:
		break

print(cx,cy,H)


Measured memory_bytes: 3064
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
      
uf = UnionFind(n+1)
for i in range(m):
  if uf.same(ab[i][0], ab[i][1]) == False:
    uf.union(ab[i][0], ab[i][1])
ans=0
for i in range(1,n+1):
  if ans <uf.size(i):
    ans=uf.size(i)
print(ans)



Measured memory_bytes: 109788
//#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <math.h>
#define OO INT_MAX
#define mp(x,y) make_pair(x,y)
#define x first
#define y second
#define ll unsigned long long int
#define pp pair<int,int>
#define heap priority_queue<pp, vector<pp>, greater<pp>>
using namespace std;

int main()
{
//	freopen("test.txt", "r", stdin);

	ll n,k;
	cin >> n >> k;
	string ans;
	while (n != 0) {
		ans += (n%k);
		n = (int)(n / k);
	}
	cout << ans.size();
}



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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	int s1=0, s2=0;
	for (int i = 0; i < S.length(); i++)
	{
		char tmp1 = (i%2==0)?'0':'1';
		char tmp2 = (i%2==1)?'0':'1';
		if(S[i]!=tmp1)s1++;
		if(S[i]!=tmp2)s2++;
	}
	int ans = min(s1, s2);
	cout << ans << endl;	
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdbool.h>
 
int l;
int sr[10]={0};
int min[10];
int mi=0,ma=0,ci=0;
int memo[20];
bool ch=0;
 
int main(void){
  int i,j,n,k=0;
 
  while(1){
    scanf("%d %d",&memo[0],&l);
    if(memo[0]+l==0)break;
    k=1;
    while(1){
      for(i=0;i<10;i++)sr[i]=0;
      mi=0;
      ma=0;
      ci=0;
      n=memo[k-1];
      for(i=0;i<l;i++){
    sr[n%10]++;
    n/=10;
      }
      for(i=0;i<10;i++){
    for(j=ci;j<ci+sr[i];j++)min[j]=i;
    ci+=sr[i];
      }
      j=1;
      for(i=0;i<l;i++){
    mi+=min[l-1-i]*j;
    ma+=min[i]*j;
    j*=10;
      }
      for(i=0;i<k;i++){
    if(memo[i]==ma-mi){
      printf("%d %d %d\n",i,ma-mi,k-i);
      ch++;
      break;
    }
    if(i==k-1){
      memo[k]=ma-mi;
      k++;
      break;
    }
      }
      if(ch==1){
    ch=0;
    break;
      }
    }
  }
  return 0;
}





Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t;
    }
    return n*rep_jijo(n,x-1);
}

int dx[8]={0,-1,-1,-1,0,1,1,1};
int dy[8]={-1,-1,0,1,1,1,0,-1};

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>>maze(h,vector<char>(w));
    vector<vector<int>>ans(h,vector<int>(w,0));
    rep(i,h) rep(j,w) cin >> maze[i][j];
    rep(i,h){
        rep(j,w){
            if(maze[i][j]=='#'){
                rep(k,8){
                    int ny=i+dy[k];
                    int nx=j+dx[k];
                    if( ny<0 || ny>=h || nx<0 || nx>=w) continue;
                    ans[ny][nx]++;
                }
            }
        }
    }
    rep(i,h){
        rep(j,w){
            if(maze[i][j]=='#') cout << '#';
            else cout << ans[i][j] ;
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll a;
    long double b;
    scanf("%lld%Lf",&a,&b);
    int B = (b*100 + 0.5);
    //printf("%d ",B);
    printf("%lld\n",a*B/100);
}


Measured memory_bytes: 3836
//Caculate area and perimeter of rectangle - Class 3J Computer Assignment
#include <iostream>
using namespace std;
int main ()
{
    int l,b,a,p;
    cin>>l;
    cin>>b;
    p=2*(l+b);
    a=l*b;
    cout<< a << " " << p<<endl;
    return 0;
}


Measured memory_bytes: 3016
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int[] c = new int[n - 1];
        int[] s = new int[n - 1];
        int[] f = new int[n - 1];
        long[] ans = new long[n];

        for (int i = 0; i < n - 1; i++) {
            c[i] = sc.nextInt();
            s[i] = sc.nextInt();
            f[i] = sc.nextInt();
        }

        for (int i = 0; i < n - 1; i++) {
            for (int j = i; j < n - 1; j++) {
                if (ans[i] <= s[j]) {
                    ans[i] = s[j];
                } else if (ans[i] % f[j] != 0) {
                    ans[i] += f[j] - (ans[i] % f[j]);
                }
                ans[i] += c[j];
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.println(ans[i]);
        }
    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
    }
}

Measured memory_bytes: 23380
#include <iostream>

using namespace std;
int main() {
  	long abc[3], k, sum = 0, num[] = {1,0,-1};
  	cin >>  abc[0] >> abc[1] >> abc[2] >> k;
    for (long i = 0; i < 3; i++) {
      	if (abc[i] >= k) {
          	sum += num[i] * k;
          	break;
        }
      	sum += num[i] * abc[i];
      	k -= abc[i];
    }
      
  	cout << sum << endl;
  
  	return 0;
}

Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	private static BufferedReader br;
	private static Map<String, String> dic;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String line = br.readLine();
			int sizeDic = Integer.parseInt(line);
			if (sizeDic == 0) {
				break;
			}
			Map<String, String> dic = makeDictionary(sizeDic);
			int length = Integer.parseInt(br.readLine());
			String res = interpret(length);
			//System.out.println(dic);
			System.out.println(res);
		}
	}

	public static Map<String, String> makeDictionary(int sizeDic) throws IOException {
		dic = new HashMap<String, String>();
		for (int i = 0; i < sizeDic; i++) {
			String[] kv = br.readLine().trim().split(" ");
			dic.put(kv[0], kv[1]);
		}
		return dic;
	}

	public static String interpret(int length) throws IOException {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < length; i++){
			String str = br.readLine().trim();
			if (dic.containsKey(str)) {
				sb.append(dic.get(str));
			} else {
				sb.append(str);
			}
		}
		return sb.toString();
	}
}

Measured memory_bytes: 32728
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long n = sc.nextLong();
        long ret = 0;
        for(int i=0;i<n;i++){
          long a = sc.nextLong();
          ret += a;
        }
      if(ret>=h){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}

Measured memory_bytes: 48196
#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 REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)

#define SORT(c) sort((c).begin(),(c).end())
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;
const int MAX = 10001;
int N, A, B;

struct init{
    init(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
} init;


void input(){
  std::cin >> N;
  if (N==1) {
    std::cout << "Hello World" << '\n';
  }else{
    std::cin >> A >> B;
    std::cout << A+B << '\n';
  }

}


int main(int argc, char const *argv[]) {
  input();

  return 0;
}


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

int main(){
 int i,ans;
 char str[4];
 
ans=0;
 cin >> str;

 for(i=0;i<4;i++){
    if(str[i]=='+'){ans++;}
    if(str[i]=='-'){ans--;}
 }

 cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

using Graph = vector<vector<int>>;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N,M;
    cin >> N >> M;
    Graph G(N);
    vector<int> H(N);
    REP(i,N)cin >> H[i];
    REP(i,M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int count = 0;
    REP(i,N){
        bool hi = 1;
        REP(l,G[i].size()){
            if(H[i] <= H[G[i][l]])hi = 0;
        }
        if(hi)count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 8744
class Integer
  def steps
    1.upto(self).to_a
  end
end

class Deck

  def initialize(n)
    @cards = n.steps #=> [1,2...n]
  end

  def cut(r)
    # r == カット回数
    r.times do
      p_c = gets.chomp.split(" ")
      p = p_c[0].to_i
      c = p_c[1].to_i

      cards_bundle = fetch_cards(p,c)
      @cards.concat(cards_bundle)
    end 
    @cards
  end 

  def fetch_cards(p,c)
    bundle = @cards[-p-c+1..-p]
    @cards.slice!(-p-c+1..-p)
    bundle
  end 

  def top 
    @cards.last
  end 

end

loop do
  input = gets.chomp
  break if input == "0 0"
  n = input.split(" ")[0].to_i
  r = input.split(" ")[1].to_i
  deck = Deck.new(n)
  puts deck.cut(r).last
end

Measured memory_bytes: 6144
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let arr: Vec<i32> = vec![1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];

    let k = read::<usize>();

    println!("{}", arr[k-1]);


}

Measured memory_bytes: 4352
#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

typedef unsigned long long ull;
const int N_MAX = 1e6;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(b-a == c-b){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

struct point{
	double x,y;
	point operator+(point p){
		return point{x+p.x,y+p.y};
	}
	point operator-(point p){
		return point{x-p.x,y-p.y};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
	}
	bool operator<(point p){
		if(fabs(x-p.x)>eps) return x<p.x;
		return y<p.y;
	}
};

typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};

double Length(point x,point y){
	point z=y-x;
	return sqrt(z.x*z.x+z.y*z.y);
}

double IP(point p,point q){
	return p.x*q.x+p.y*q.y;
}

point Projection(pp a,point x){
	point A=x-a.first,B=a.second-a.first;
	double l=Length(O,B);
	return B*IP(A,B)/(l*l)+a.first;
}

point Reflection(pp a,point x){
	return Projection(a,x)*2-x;
}

point a,b,q;
char c;

int main(){
	cout<<syosu(7);
	while(cin>>a.x>>c>>a.y>>c>>b.x>>c>>b.y>>c>>q.x>>c>>q.y){
		point p=Reflection(pp(a,b),q);
		cout<<p.x<<' '<<p.y<<endl;
	}
}

Measured memory_bytes: 3148
def solve():
    N = int(input())
    res = N
    for i in range(N + 1):
        cnt = 0
        t = i
        while t > 0:
            cnt += t % 6
            t //= 6
        t = N - i
        while t > 0:
            cnt += t % 9
            t //= 9
        res = min(res, cnt)
    return res

if __name__ == '__main__':
    print(solve())


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    ll n, l;
    cin >> n >> l;
    ll ans = 0;
    ll mn = INF;
    bool neg = false;
    for(int i = 0; i < n; ++i){
        mn = min(mn, abs(l+i));
        ans += l+i;
        if(i == n-1) neg = (l+i < 0);
    }

    if(neg) ans += mn;
    else  ans -= mn;
    ppp(ans);

    return 0;
}


Measured memory_bytes: 256