akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

int main(){
  int N, M;cin>>N>>M;
  vi G[N];
  int used[N];
  memset(used, 0, sizeof(used));
  
  for (int i=0;i<M;++i){
    int a, b;cin >>a>>b;
    G[a-1].push_back(b-1);G[b-1].push_back(a-1);
  }

  int cnt=0;
  vi path;
  path.push_back(0);
  used[0]=1;
  int pos=0;

  while(cnt<M){
    int j=0;
    while(used[G[pos][j]]==1&&j<G[pos].size()){j++;}
    int ps=G[pos].size();
    if(j==ps) break;
    int v=G[pos][j];
    path.push_back(v);
    used[v]=1;
    pos=v;
    cnt++;
  }
cnt=0;
  vi path2;
  pos=0;
  while(cnt<M){
    int j=0;
    while(used[G[pos][j]]==1&&j<G[pos].size()){j++;}
    int ps=G[pos].size();
    if(j==ps) break;
    int v=G[pos][j];
    path2.push_back(v);
    used[v]=1;
    pos=v;
    cnt++;
  }

  reverse(path2.begin(), path2.end());

  int L=path2.size();

  path.insert(path.begin(), path2.begin(), path2.end());
  

  int K=path.size();
  cout << K << endl;
  for (int i=0;i<K;++i){
    int v=path[i];
    cout << v+1 << ' ';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 7160
#include <iostream>
#include <algorithm>
using namespace std;
 
int main()
{
    // int a, b, c, d, e;
    // cin >> a >> b >> c >> d >> e;
    long long n;
    cin >> n;
    long long list[10] = {0}, sm[10] = {0}, pos = 0, sms = 0;
    long long ans = 0;

    for (int i = 0; i < 5; ++i){
        cin >> list[i]; 
        if (i == 0) {
            sms = list[i];
            ans = n / list[i];
            if (n % list[i] != 0) ans ++;
        }
        if (list[i] < sms){
             sms = list[i];
             ans = n / list[i]  + i;
            if (n % list[i] != 0) ans ++;
        }
        else if(i != 0)
            ans =  ans + 1;




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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <map>
#define ll long long

using namespace std;

int main(void){
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans;
    if(b-a<0)
        ans = 0;
    else{
        ll MIN = a*(n-1)+b;
        ll MAX = b*(n-1)+a;
        ans = MAX - MIN + 1;
        if(ans<0) ans = 0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,s=0;
cin>>a>>b;
if(a>1){
	for(int i=1;i<a;i++){
		s+=i;
	}
}
if(b>1){
	for(int i=1;i<b;i++){
		s+=i;
	}
}
cout<<s;
return 0;
}


Measured memory_bytes: 256
n,c,k=map(int,input().split())
t=[int(input()) for _ in range(n)]+[10**10]
t.sort()
b=1
p=0
if c==1:
  print(n)
  exit()
while p<n:
  l=t[p]+k
  pp=1
  f=1
  while pp<c and f:
    p+=1
    if t[p]<=l:
      pp+=1
      if pp==c:
        p+=1
    else:
      f=0
  if p<n:
    b+=1
print(b)

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

const int maxn = 3010;
const double PI = acos(-1);
int n, L, a[maxn];

int main() {
    scanf("%d %d", &n, &L);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    double ansx = 0, ansy = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            ansx += (n - 2 * (j - i)) * cos(PI * (a[i] + a[j]) / L);
            ansy += (n - 2 * (j - i)) * sin(PI * (a[i] + a[j]) / L);
        }
    }
    long long t = 1LL * n * (n - 1) * (n - 2) / 6;
    printf("%.10f %.10f\n", ansx / t, ansy / t);
    return 0;
}

Measured memory_bytes: 4188
N=int(input())
a=[[int(i) for i in input().split()] for j in range(2)]

ans=sum(a[0])+a[1][-1]

for i in range(N-1):
	tmp=sum(a[0][:i+1])+sum(a[1][i:])
	ans=max(ans,tmp)
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define PB push_back
#define MP make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
  while (true) {
    int n, cand[26];
    char c[100];
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> c[i];
    }
    for (int i = 0; i < 26; i++) cand[i] = 0;

    int rest = n;
    bool flag = true;
    for (int i = 0; i < n; i++) {
      cand[c[i]-'A']++;
      rest--;
      // cout << rest << endl;
      int mx = -1, smx = -1, a = 0, b = 0;
      for (int j = 0; j < 26; j++) {
        // cout << cand[j] << " ";
        if (mx <= cand[j]) {
          smx = mx; mx = cand[j];
          b = a; a = j;
        } else if (smx < cand[j]) {
          smx = cand[j];
          b = j;
        }
      } // cout << endl;
      // printf("max:   %d, alpha: %c\n", mx, 'A'+a);
      // printf("s_max: %d, alpha: %c\n", smx, 'A'+b);
      if (smx+rest < mx) {
        printf("%c %d\n", 'A'+a, i+1);
        flag = false;
        break;
      }
    }
    if (flag) cout << "TIE" << endl;
  }
  return 0;
}



Measured memory_bytes: 3240
#include<stdio.h>

int main (){
 int a,b,c;
 scanf("%d %d %d", &a, &b, &c);
 
 if (a == b && a == c && b == c){
  printf("No\n");
 }else if (a == b && a != c){
  printf("Yes\n");
 }else if (a == c && a != b){
  printf("Yes\n");
 }else if (b == c && b != a){
  printf("Yes\n");
 }else if (a != b && a != c && b != c){
  printf("No\n");
 }

 return 0;
}

Measured memory_bytes: 3132
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

int main(){
 
int a,b;
cin>>a>>b;
cout<<(a-1)*(b-1)<<endl;





}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using ll = long long int;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 373;

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

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> init_vector2(size_t n0, size_t n1, T e = T()) {
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> init_vector3(size_t n0, size_t n1, size_t n2, T e = T()) {
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    vector<int> a1(n);
    vector<int> a2(n);
    rep(i, n) { cin >> a1[i]; }
    rep(i, n) { cin >> a2[i]; }

    vector<int> c1(n + 1);
    vector<int> c2(n + 1);
    for (int i = 1; i <= n; i++) {
        c1[i] = c1[i - 1] + a1[i - 1];
        c2[i] = c2[i - 1] + a2[i - 1];
    }

    int ans = 0;
    rep(i, n) { ans = max(ans, c1[i + 1] + c2[n] - c2[i]); }

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


Measured memory_bytes: 256
//ABC 062 Grouping 
#include <iostream>
using namespace std;

int grouping(int n){
  switch(n){
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
      return 1;

    case 4:
    case 6:
    case 9:
    case 11:
      return 2;
			
    case 2:
      return 3;

    default:
      return -1;
  }
}

int main(void){
  int x,y;
  cin >> x >> y;
  cout << ((grouping(x)==grouping(y)) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n, t[100], m, p[100], x[100], i, j, sum;
    scanf("%d", &n);
    for (i=0; i<n; i++)
    {
        scanf("%d", &t[i]);
    }
    scanf("%d", &m);
    for (i=0; i<m; i++)
    {
        scanf("%d%d", &p[i], &x[i]);
    }
    for (i=0; i<m; i++)
    {
        sum = 0;
        for (j=0; j<n; j++)
        {
            if (j == p[i]-1) {
                sum += x[i];
            } else {
                sum += t[j];
            }
        }
        printf("%d\n", sum);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a[]={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};
  int n;
  cin>>n;
  cout<<a[n-1]<<endl;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp[ohara],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl[3];
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

long long gcd(long long aaa,long long bbb){
    if(bbb==0){
        return aaa;
    }
    return gcd(bbb,aaa%bbb);
}
 
long long lcm(long long aaa,long long bbb){
    long long g = gcd(aaa,bbb);
    return aaa/g * bbb;
}

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

      
      cin>>n>>x;
      ans=LINF;
      rep(i,n){
        cin>>a[i];
        cmp[i]=abs(a[i]-x);
      }
      ans=cmp[0];
      rrep(i,1,n){
        ans=gcd(ans,cmp[i]);
      }
      Cout(ans);
     

       
return 0;
}


Measured memory_bytes: 5120
#include<iostream>
#include<map>
using namespace std;
map<int,int> a;
int main(void)
{
    int n,t,ans=0;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        cin >> t;
        a[t]=1-a[t];
        if(a[t]==0) ans--;
        else ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <bitset>
#include <algorithm>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

const int MAX_N = 5005;

#define getchar getchar_unlocked

inline int in() {
    int n = 0; short c;
    while ((c = getchar()) >= '0') n = n * 10 + c - '0';
    return n;
}

int a[MAX_N], sm[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n = in(), K = in(), id = 0;
    rep(i,n){
        a[id] = in();
        if(a[id] < K-1) id++;
    }
    n = id;
    sort(a, a+n, greater<int>());
    rrep(i,n){
        sm[i] = sm[i+1] + a[i];
    }
    int ans = 0;
    bitset<MAX_N> dp;
    dp[0] = true;
    rep(i,n){
        if(K+a[i]-sm[i] > 0){
            bool flag = true;
            srep(j,max(0, K-sm[i]),K+a[i]-sm[i]){
                if(dp[j]){
                    flag = false;
                    break;
                }
            }
            ans += flag;
        }
        dp |= (dp << a[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{      
    
    public void Slove()
    {
        int count = 0;
        string input = Console.ReadLine();
        char bef = input[0];
        foreach(char c in input.Skip(1))
        {
            if(bef != c)
                count++;
            bef = c;
        }
        System.Console.WriteLine(count);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,r;
    cin>>n>>r;
    if(n>=10) cout<<r<<endl;
    else{
        cout<<r+100*(10-n)<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  map<long long,int>m;
  long long n,ans=0,a[200000],x;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x;
    if(i)a[i]=a[i-1]+x;
    else a[i]=x;
    if(!m[a[i]])m[a[i]]=i+1;
  }
  for(int i=0;i<n;i++){
    if(m[a[i]])if(i-m[a[i]]+1>ans)ans=i-m[a[i]]+1;
    if(!a[i])ans=i+1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 17032
#include<stdio.h>

int main()
{
	int i,t,n=0,m=0,x=0,y,c[2000];
	
	char a[2000]={0},b[2000]={0};
	
	scanf("%s",a);
	
	for(i=0;a[i]!='\0';i++){//??????????????????????????? OK
		
		y=0;
		if(n==0){
			
			b[n]=a[i];
			
		}
		else for(t=0;t<n;t++){
			
			if(a[i]==b[t]){
				
				y++;
				
			}
		}
		if(y==0){
			b[n]=a[i];//b[]????¨????????????????
			n++;
		}
			//?¨??????°
		}
	
	//printf("%d\n",i);
	//printf("%d\n\n",n);
	for(x=0;x<n;x++){//???b[]?????°?????°??????
		
		m=0;
		
		for(t=0;t<i;t++){
			
			if(a[t]==b[x]){
				
				m++;
			}
		}
		c[x]=m;
	}
	
	/*for(x=0;x<n;x++){
		
		printf("%d\n",c[x]);
	}*/
	
	for(i=0,x=0;i<n;i++){
		
		if(c[i]%2){
			x++;
		}
	}
	if(x<=0){
		printf("%d\n",0);
	}
	else printf("%d\n",(x-1)/2+(x-1)%2);
	
	return 0;
	
}

Measured memory_bytes: 2716
//abc140_c.cpp
//Wed Oct  9 23:52:37 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int b[n-1];
	int ans = 0;
	for (int i=0;i<n-1;i++){
		cin >> b[i];
		if (i==0){
			ans += b[i];
		}else {
			ans += min(b[i],b[i-1]);
		}
	}

	cout << ans+b[n-2]<< endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 2000000000;

int a, b, c;

int main(){
  cin >> a >> b >> c;
  if(a+b==c||b+c==a||c+a==b) cout << "Yes" <<endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
 
module Main
  ( main
  )
where
 
import           Control.Applicative
import           Control.Monad
import           Control.Monad.ST
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import           Data.Ord
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

main = do
  n <- readInt
  arr <- readIntList
  putStrLn $ if all (\val -> val `mod` 3 == 0 || val `mod` 5 == 0) . filter (\val -> val `mod` 2 == 0) $ arr then "APPROVED" else "DENIED"


Measured memory_bytes: 508
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>

using namespace std;
typedef long long int ll;

int a,b,f;

int main(){
    scanf("%d %d",&a,&b);
    if(a<0 and b<0){
        if((-a+b)%2)f=1;
        else f=-1;
    }
    else if(a<=0 and b>=0){
        f=0;
    }
    else{
        f=1;
    }
    if(f==1)cout<<"Positive"<<endl;
    if(f==-1)cout<<"Negative"<<endl;
    if(f==0)cout<<"Zero"<<endl;
}

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

int main(void)
{
    char a[100000];
    char z[1];
    int len;
    int count[26] = {0};
    cin >> a;
    len = strlen(a);

    for(int i = 0; i < len; i++){
        for( int j = 0; j < 26; j++){
            if(a[i] == 'a' + j){
                count[j]++;
            }
        }
    }
    for(int j = 0; j < 26; j++){
        if(count[j] == 0){
            z[0] = ('a' + j);
            printf("%c\n",z[0]);
            return 0;
        }
    }
    printf("None");
    return 0;
}

Measured memory_bytes: 384
N, X = map(int, input().split())

def get_size(level):
    return (1 << (level+2)) - 3

def get_patty(level):
    return (1 << (level+1)) - 1

ans = 0
while X > 0:
    if get_size(N) > X:
        X -= 1
        N -= 1
    else:
        X -= get_size(N)
        ans += get_patty(N)
        if X > 0:
            ans += 1
            X -= 1
print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;



ll fight(ll h){
    if (h==1LL) rn 1LL;
    return 1LL + 2*fight(h/2);
}
int main(){
    ll h;
    cin >> h;
    ll ans = 0;
    ans = fight(h);
    cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, K;
ll f[2001];

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1) {
			a = a*x%mod;
		}
		x = x*x%mod;
		y /= 2;
	}
	return a;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}

ll comb(int n, int r) {
	if (n < r)return 0;
	return f[n] * modinv(f[r]) % mod * modinv(f[n - r]) % mod;
}

int main() {
	f[0] = 1;
	for (int i = 1; i <= 2000; ++i) {
		f[i] = f[i - 1] * i%mod;
	}
	cin >> N >> K;
	for (int i = 1; i <= K; ++i) {
		cout << comb(N - K + 1, i)*comb(K - 1, i - 1) % mod << endl;
	}
}

Measured memory_bytes: 888
<?php
  list($s) = explode(" ",fgets(STDIN));
  list($k) = explode(" ",fgets(STDIN));

  $n=strlen($s);
 
  $ans=[];
  for($i=0;$i<$n;$i++){ 
    $a="";
    for($j=0;$j<$k;$j++){
      if($i+$j < $n-1){
        $a.=$s[$i+$j];
        $ans[$a]=true;
      }
    }
  }

  $ans=array_keys($ans);

  sort($ans);

  echo $ans[$k-1];

Measured memory_bytes: 17696
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
	int dsn; scanf("%d", &dsn);
	for(int dsi = 0; dsi < dsn; dsi++) {
		static char ais[10000],bis[10000];
		scanf("%s%s",ais,bis);
		int aislen = strlen(ais);
		int bislen = strlen(bis);
		if(aislen > 80 || bislen > 80) {
			printf("overflow\n");
			continue;
		}
		static int ad[90],bd[90];
		fill(ad,ad+90,0);
		fill(bd,bd+90,0);
		for(int i = 0; i < aislen; i++) ad[i] = ais[aislen-1-i]-'0';
		for(int i = 0; i < bislen; i++) bd[i] = bis[bislen-1-i]-'0';
		int cl = 0;
		for(int i = 0; i < 90; i++) {
			ad[i] += bd[i]+cl;
			cl = ad[i]/10;
			ad[i] %= 10;
		}
		if(ad[80]) {
			printf("overflow\n");
			continue;
		}
		bool flag = false;
		for(int i = 89; i >= 0; i--) {
			flag = flag || ad[i];
			if(flag) {
				printf("%d",ad[i]);
			}
		}
		if(!flag)printf("0");
		printf("\n");
	}
	return 0;
}

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  vector<mint> two(n+1);
  two[0] = 1;
  rep(i,n) two[i+1] = two[i]*2;

  mint ans;
  rep(i,n) {
    int l = i, r = n-1-i;
    mint now = two[r];
    if (r != 0) now += two[r-1]*r;
    now *= two[l];
    now *= a[i];
    ans += now;
  }

  ans *= two[n];

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

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <locale>
#include <math.h>

using namespace std;

int main()
{
    int r, D, x;
    cin>>r>>D>>x;
    for(int i=0;i<10;i++)
    {
        x=r*x-D;
        cout<<x<<endl;
    }



    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int a[10005];
int main(){
	int k,n,i=0,j,l;
	scanf("%d",&n);
	if(n==0){
		printf("0");
		return 0;
	}
	while(n){
		if(n<0){
		if(n%2){a[i++]=1;
		n=(n-1)/(-2);
		}
		else{
		a[i++]=0;
		n=n/(-2);
	}
}
else{
a[i++]=n%2;
n=n/(-2);
}
}
for(i=i-1;i>=0;i--)printf("%d",a[i]);
		
return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
//#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  A.begin(), A.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))


#define forr(i,n) for(i=0; i<n; i++)
#define whilee(i,t) while(i!=t)
#define pb(x) push_back(x);

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());

//vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
string S, T;
int i, j, k, a, b, c, d, l, m, n=3, p, q, r, s, t, x, y, z, cnt=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>S;
    forr(i,n)
    {
        if(S[i]=='1')
        {
            cout<<9;
        }
        else
        {
            cout<<1;
        }
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int n, dp[2100][2100];P a[2100];
signed main() {
  cin>>n;rep(i,n)cin>>a[i].first, a[i].second = i;
  sort(a,a+n,greater<P>());
  dp[0][1] = a[0].first*a[0].second;
  dp[0][0] = a[0].first*(n-a[0].second-1);
  repd(i,1,n){
    dp[i][0] = dp[i-1][0] + a[i].first*abs(n-a[i].second-i-1);
    repd(j,1,n+1){
      if(j > i+1)continue;
      int s = n-1-(i-j), t = j-1;
      dp[i][j] = max(dp[i-1][j]+a[i].first*abs(s-a[i].second), dp[i-1][j-1]+a[i].first*abs(t-a[i].second));
    }
  }
  int ans = 0;
  rep(i,n)chmax(ans, dp[n-1][i]);
  cout << ans << endl;
}



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

int main()
{
	int n;
	int max1=0;
	int max2=0;
	
	cin>>n;
	int a[n];
	
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	
	for(int i=0;i<n;i++)
	{
		if(a[i]>=max1)
		{
			max2=max1;
			max1=a[i];
			
		}
		else if(a[i]<max1 && a[i]>max2)
		{
			max2=a[i];
		}
	}
	
	//cout<<"maximum number is"<<max1<<"\t 2nd most maximum number is"<<max2;
	for(int i=0;i<n;i++)
	{
		if(a[i]==max1)
			cout<<max2<<"\n";
		else
			cout<<max1<<"\n";
	}
	
	
		
}



Measured memory_bytes: 2432
'use strict'

const main = arg => {
    arg = arg.trim().split("\n")
    const K = ~~arg[0].split(" ")[0];
    const S = ~~arg[0].split(" ")[1];
    
    let answer = 0;
    
    for(let i=0; i<=K; i++) {
        for(let j=0; j<=K; j++) {
            let z = S - i - j;
            
            if(0 <= z && z <= K) {
                answer++;
            }
        }
    }
    
    console.log(answer);
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define INF (1e18+1)
#define LL long long
#define rep(i, c) for(int i=0;i<(int)(c);i++)
//ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

int main()
{

    int n = 0;
    cin >> n;
    
    std::vector<long long> v(n);
    rep(i,n) cin >> v[i];
    
    // ABCs ANS - v[i]
    //                      > #ABCs == #ARCs
    // ARCs v[i] - ANS
    
    sort(v.begin(),v.end());
    
    int answer = v[v.size()/2]-v[v.size()/2-1];
    
    cout<<answer<<endl;

}

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

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

#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 INT_MAX/3

struct UnionFind{
  vector<int> v;
  UnionFind(int n) : v(n, -1) {}
  void init(){ for(int i = 0;i < v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};

int N,A,B,C,M;
int fa,fb,fc;
vector<int> g[100010];
P dist[3][100010];

void shortpath(int s,int t){
  rep(i,N)dist[t][i]=P(INF,INF);
  priority_queue<PI,vector<PI>,greater<PI> > que;
  que.push(PI(P(0,s),s));
  while(que.size()){
    int d=que.top().fi.fi;
    int mnv=que.top().fi.se;
    int v=que.top().se;
    que.pop();
    if(dist[t][v]!=P(INF,INF))continue;
    dist[t][v]=P(d,mnv);
    for(int nv : g[v]){
      que.push(PI(P(d+1,min(mnv,nv)),nv));
    }
  }
}

int main(){
  cin>>N>>A>>B>>C;
  UnionFind uf(N);
  int pre=-1;
  int mnv=INF;
  rep(i,A){
    int a;
    cin>>a;
    a--;
    minch(mnv,a);
    if(pre==-1)pre=a;
    else{
      uf.unite(pre,a);
    }
  }
  fa=uf.find(pre);
  pre=-1;
  rep(i,B){
    int a;
    cin>>a;
    a--;
    minch(mnv,a);
    if(pre==-1)pre=a;
    else{
      uf.unite(pre,a);
    }
  }
  fb=uf.find(pre);
  pre=-1;
  rep(i,C){
    int a;
    cin>>a;
    a--;
    minch(mnv,a);
    if(pre==-1)pre=a;
    else{
      uf.unite(pre,a);
    }
  }
  fc=uf.find(pre);

  cin>>M;
  rep(i,M){
    int a,b;
    cin>>a>>b;
    a--;b--;
    a=uf.find(a); b=uf.find(b);
    g[a].push_back(b);
    g[b].push_back(a);
  }

  shortpath(fa,0); shortpath(fb,1); shortpath(fc,2);

  int mn=INF,res=-1;
  rep(i,N){
    int j=uf.find(i);
    if(mn>dist[0][j].fi+dist[1][j].fi+dist[2][j].fi||(mn==dist[0][j].fi+dist[1][j].fi+dist[2][j].fi&&res>min({dist[0][j].se,dist[1][j].se,dist[2][j].se}))){
      mn=dist[0][j].fi+dist[1][j].fi+dist[2][j].fi;
      res=min({dist[0][j].se,dist[1][j].se,dist[2][j].se});
    }
  }
  cout<<mn<<" "<<min(mnv,res)+1<<endl;

  return 0;
}



Measured memory_bytes: 33392
def acc2(grid):
    H = len(grid); W = len(grid[0])
    for i in range(H):
        for j in range(W-1):
            grid[i][j+1] += grid[i][j]
    for j in range(W):
        for i in range(H-1):
            grid[i+1][j] += grid[i][j]
    ngrid = [[0]*(W+1)]
    for i in range(H):
        line = [0] + grid[i]
        ngrid.append(line)
    return ngrid

from bisect import bisect_left
N,K = map(int,input().split())
X = []; Y = []; info = []
for i in range(N):
    x,y = map(int,input().split())
    X.append(x); Y.append(y); info.append([x,y])
X.sort(); Y.sort()

acc = [[0]*(N) for i in range(N)]
for x, y in info:
    j = bisect_left(X,x)
    i = bisect_left(Y,y)
    acc[i][j] += 1

acc = acc2(acc)

ans = float('inf')
for t in range(N-1):
    for b in range(t+1,N):
        for l in range(N-1):
            for r in range(l+1,N):
                num = acc[b+1][r+1] - acc[b+1][l] - acc[t][r+1] + acc[t][l]
                if num < K: continue
                S = (Y[b] - Y[t]) * (X[r] - X[l])
                if S < ans:
                    ans = S

print(ans)

Measured memory_bytes: 3188
import sys
import collections
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

MOD = 998244353
N = int(input())
D = list(map(int, input().split()))
mD = max(D)

c = collections.Counter(D)
c = dict(c)

ans = 1
tmp = 1
for i in range(mD+1):
    if not(i in c.keys()):
        ans = 0
        break
    elif i == 0:
        if c[0] > 1:
            ans = 0
            break
    elif i == 1:
        tmp = c[i]
    else:
        ans = (ans * tmp**c[i])%MOD
        tmp = c[i]

if D[0] != 0:
    print(0)
else:
    print(ans)

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

#define ll long long
#define pb push_back
#define eb emplace_back
#define REP(i, n) for(int i=0;i<(n);++i)
#define caset int ___T; cin >> ___T; while(___T--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define fast_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"

int main() {
	fast_IO;

	int k;
	cin >> k;

	int val = 7;
	REP(i, k) {
		if (val%k == 0) {
			cout << i+1 << endl;
			return 0;
		}
		val *= 10;
		val += 7;
		val %= k;
	}

	cout << -1 << endl;
	cout << flush;
}


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

using namespace std;

#define ll long long
#define pb push_back


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

    sort(arr, arr + n);

    int largest = arr[n-1];

    sum = sum - largest;

    if( largest < sum)cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}


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

using namespace std;

int main (){
    string s;
    int num[4];
    char op[3];    
    cin >> s;
        
    long long ans = 0;
    
    for(int i = 0; i < 4; i++){
        num[i] = s[i] - '0';
    }	

    for(int i = 0; i < 1 << 3; i++){
        ans = num[0];
        for(int j = 0; j < 3; j ++){

            if(i & (1 << j)){	      
    	        ans -= num[j+1];
		op[j] = '-';		
    	    }
	    else{
	        ans += num[j+1];
		op[j] = '+';
	    }

        }

	if(ans == 7){
	  for(int i = 0; i < 4; i++){
	      cout << num[i];
	      if(i != 3) cout << op[i];
	  }
	  cout << "=" << ans << endl;
	  return 0;
	}
	
   }

}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<math.h>
#define Max 100
#define INF 1000000000000000000
using namespace std;

vector<pair<int,int>>vec[Max];


int max(int a,int b){
	return (a<b)?b:a;
}

int main(){

	int n,c,x,a,b,index,val,honest,count=0;
	bool valid;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		while(x--){
			scanf("%d%d",&a,&b);
			vec[i+1].push_back(make_pair(a,b));
		}
	}

	for(int i=1;i<(1<<n);i++){
		c = 0;
		valid = true;
		//printf("New :-\n\n");
		for(int j=0;j<32;j++){
			if((i & (1 << j)) != 0){
				c++;
				for(int k=0;k<vec[j+1].size();k++){
					index = vec[j+1][k].first;
					val = vec[j+1][k].second;


					honest = (i & (1<<(index-1)));

				//	printf("%d %d %d %d\n",i,(index-1),val,honest);

					if(val == 1 && honest == 0)
						valid = false;
					else if(val == 0 && honest != 0)
						valid = false;

				}


			}

		}

		if(valid){
			count = max(count,c);
		}

	}
	
	printf("%d\n",count);

	return 0;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, m, i, t, x;
    int[] f, d;

    for(;;out.println(t)){
      n = sc.nextInt(); m = sc.nextInt();
      if(n == 0 && m == 0)break;
      f = new int[n]; d = new int[m];
      for(i = 0;i < n;i++)f[i] = sc.nextInt();
      for(i = 0;i < m;i++)d[i] = sc.nextInt();
      x = 0;
      for(t = 0;x < n - 1;){
        x += d[t++];
        if(x < n - 1)x += f[x];
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 26792
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    int r;
    cin>>r;
    cout<<r*r<<endl;
    
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int main(void){
    int A, B;
    cin >> A >> B;
    if(A>B){
        cout << 2 * A - 1 << endl;
    }
    if(A==B){
        cout << A + B << endl;
    }
    if(A<B){
        cout << 2 * B - 1 << endl;
    }
    return (0);
}

Measured memory_bytes: 256
import itertools

n = int(input())
l = sorted(map(int,input().split()))
ans = 0
li =  []
c = 0
for team in itertools.combinations(l, 3):
    li.append(list(team))
    c  += 1
sum = 0
for i in range(c):
    if li[i][0] != li[i][1] and li[i][1] != li[i][2] and li[i][2] != li[i][0]:
        if li[i][0] + li[i][1] > li[i][2]:
            ans += 1
print(ans)


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

int main() {
        std::string n;
        std::cin >> n;

        for (auto v : n) {
                if (v == '1') {
                        std::cout << '9';
                }
                else if (v== '9') {
                        std::cout << '1';
                }
                else {
                        std::cout << v;
                }
        }
        std::cout << std::endl;

        return 0;
}

Measured memory_bytes: 256
/* #include <iostream>
using namespace std;
main()
{
    int n,a,b,c,d;string s;
    cin >> n >> a >> b >> c >> d >> s;
    //go through
    if( d < c )
    {
        s[d-1] = '#';
        for( int i = a-1; i <= d-1; i++ )
        {
            if( s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' ){puts("Yes");return 0;}
            if( s[i] == '#' && s[i+1] == '#' ){puts("No");return 0;}
        }
    }
    //keep up with
    else
    {
        if( c < b )
        {
            }
        }
        else
        {
            for( int i = a - 1; i < d; i++ )
            {
                if( s[i] == '#' && s[i+1] =='#'){puts("No");return 0;}
            }
        }
    }
    puts("Yes");
    return 0;
} */
///ETA assesment
#include <iostream>
using namespace std;
    int a,b,c,d,n;string s;
void na()
{
    puts("No");
    exit(0);
}
bool check( int x, int y )
{
    int i;
    for( i = x; i < y; i++ ) if( s[i] == '#' && s[i+1] == '#' )return 0;
    return 1;
}
main()
{
    cin >> n >> a >> b >> c >> d  >> s;
    s = "#" + s + "#";
    int i;
    if( !check( a, c ) || !check( b, d ) ) na();
    if( c > d )
    {
        for( i = b; i <= d; i++ )
        {
            if( s[i - 1] == '.' && s[i] == '.' && s[i+1] == '.' ){puts("Yes");return 0;}
        }
        na();
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,k;
    cin >>a>>b>>c>>k;
    if(k<=a){
        cout << k;
    }
    else if(k<=a+b&&k>a){
        cout << a;
    }
    else{
        cout << 2*a +b-k;
    }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mxn= 2e4+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
// 1
// 5
// 0 1 0 2 0
int main(){
    rishabh();
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    deque<char> temp;
    set<deque<char>> st;
    for(auto x: t){
        temp.push_back(x);
        st.insert(temp);
    }
    temp.clear();
    int ans=0;
    for(int i=n-1;i>=0;i--){
        temp.push_front(s[i]);
        if(st.count(temp))ans=n-i;
    }
    cout<<2*n-ans;
}

Measured memory_bytes: 3692
#include<iostream>
using namespace std;
int dp[100005];
int N;
void solve(int a){
  for(int i=a;i<=N;i*=a){
    for(int j=0;j+i<=N;j++)
      dp[j+i]=min(dp[j+i],dp[j]+1);
  }
}
int main(){
  cin>>N;
  for(int i=0;i<=N;i++)
    dp[i]=i;
  solve(6);
  solve(9);
  cout<<dp[N]<<endl;
  return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(i64, K);
    vector<i64> ans;
    vector<string> buf[15];
    ans.reserve(1000010);

    rep(i, 1, 10) {
        buf[1].push_back(to_string(i));
        ans.push_back(i);
    }

    rep(len, 2, 12) {
        buf[len].reserve(buf[len - 1].size() * 3);
        for (const string &a : buf[len - 1]) {
            for (char d = a.back() - 1; d <= a.back() + 1; ++d) {
                if (d < '0' || d > '9') continue;
                buf[len].push_back(a + d);
                ans.push_back(stoll(buf[len].back()));
                if (ans.size() > K) goto HOGE;
            }
        }
    }

HOGE:

    sort(all(ans));
    print(ans[K - 1]);

    return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string s,t; cin >> s >> t;
  string ans = t+s;

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


Measured memory_bytes: 3644