akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)


ll dfs(vector<vector<ll>> g, ll vt, vector<bool> used, vector<ll> v){
  v.push_back(vt);
  if(v.size()==g.size()){
    return 1;
  }
  ll ans=0;
  FOR(j,0,g.size()){
    if(g[vt][j]==1 && !used[j]){
      used[vt]=true;
      ans+=dfs(g, j, used, v);
      used[vt]=false;
    }
  }
  return ans;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>> g(n,vector<ll>(n));
    FOR(i,0,m){
      ll a,b;
      cin>>a>>b;
      a--;b--;
      g[a][b] = g[b][a] = 1;
    }
    vector<ll> v;
    vector<bool> used(n, false);
    cout<<dfs(g,0,used,v)<<endl;
}


Measured memory_bytes: 256
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define all(a)      (a).begin(),(a).end()
#define si(x)       (int)((x).size())
#define debug(x)    cout<<#x<<" is "<<(x)<<endl;cout.flush();  
#define se second 
#define endl        '\n'
#define f(i,a,b)    for(int i=a;i<b;i++)
#define mem(a,x)          memset(a,x,sizeof(a))

// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
    os<<"[";
    for(auto& x:v){os<<x<<", ";}
    return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
    return os<<"{"<<p.first<<", "<<p.second<<"}";
}

// === Debug macro ends here ===


// const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846
void inp(ll *arr,ll n)
{
  for(int i=0;i<n;i++)
    cin>>arr[i];
}
void inp_mat(ll *arr,ll n,ll m)
{
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        {
          ll x;cin>>x;
          *((arr+i*m) + j)=x;
        }
}
// syntax for inp_mat inp_mat((ll *)arr,n,m);
// int x2[]={+1,-1,+0,+0};
// int y2[]={+0,+0,+1,-1};
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGEc
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif 
    int t=1;
    // cin>>t;
    while(t--)
    {
        // string s,t;
        // cin>>s>>t;
        // int n=si(s);
        // int c=0;
        // f(i,0,n)
        // {
        //   if(s[i]!=t[i])
        //   c++;
        // }
        // cout<<c;
        ll n,m,k;cin>>n>>m>>k;
        ll arr[n+1],brr[m+1];
        // inp(arr,n);inp(brr,m);
        f(i,1,n+1)
        cin>>arr[i];
        f(i,1,m+1)
        cin>>brr[i];
        ll a[n+1],b[m+1];
        a[0]=0;b[0]=0;
        f(i,1,n+1)
        a[i]=a[i-1]+arr[i];
        f(i,1,m+1)
        b[i]=b[i-1]+brr[i];
        ll ans=0;
        ll ind=upper_bound(b,b+m+1,k)-b;
        ans=max(ans,ind-1);
        f(i,1,n+1)
        {
          if(k-a[i]<0)
          break;
           ind=upper_bound(b,b+m+1,k-a[i])-b;
        ans=max(ans,ind-1+i);
        }
        cout<<ans;

    }    
} 

Measured memory_bytes: 9852
#include<iostream>

using namespace std;

int main() {
	int v = 0;
	int a, b, c;
	cin >> a >> b >> c;
	v += (a * 100) + (b * 10) + c;
	
	if (v % 4 == 0)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;

}

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

int main(){
  string s;
  int n, x = 0, xmax = 0;
  cin >> n >> s;
  
  
  for ( int i = 0; i < n; i++ ){
    if ( s[i] == 'I' ){
      x++;
      if ( x > xmax ){
        xmax = x;
      }
    }else{
      x--;
    }
  }
  cout << xmax << endl;
}

Measured memory_bytes: 256
S = input()
 
ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
cntList.append(cnt)
for s in S:
    if s in ACGT:
        cnt += 1
        cntList.append(cnt)
    else:
        cnt = 0
print(max(cntList))

Measured memory_bytes: 8940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);
    string S;cin>>S;
    int n=S.size();
    bool check=0;
    rep(i,n){
        if(S[i]!=S[n-1-i])check=1;
    }
    rep(i,(n-1)/2){
        if(S[i]!=S[(n-1)/2-1-i])check=1;
        if(S[(n-1)/2+1+i]!=S[n-1-i])check=1;
    }
    if(check)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

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

void fnInput(string& rsColor)
{
  cin >> rsColor;
}

int fnMaxRemove(string sColor)
{
  vector<int> vnColor(2);

  for (int i = 0; i < sColor.size(); i++)
    vnColor[ sColor[i] - '0' ]++;

  return min(vnColor[0], vnColor[1]) * 2;
}
 
int main()
{
  string sColor;

  fnInput(sColor);
  cout << fnMaxRemove(sColor) << endl;

  return 0;
}

Measured memory_bytes: 3820
# -*- coding: utf-8 -*-
from collections import deque

import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


# @mt
def slv(H, W, C, D, S):
    C = (C[0]-1, C[1]-1)
    D = (D[0]-1, D[1]-1)
    q = deque()
    q.append((0, C))
    memo = {}
    T = 10**6
    while q:
        c, (x, y) = q.popleft()
        v = x*T + y
        if v in memo:
            continue
        memo[v] = c

        for nx in range(x-2, x+3):
            for ny in range(y-2, y+3):
                if 0 <= nx < H and 0 <= ny < W and S[nx][ny] == '.':
                    if abs(nx-x) + abs(ny-y) == 1:
                        q.appendleft((c, (nx, ny)))
                    else:
                        q.append((c+1, (nx, ny)))
    g = D[0]*T + D[1]
    return -1 if g not in memo else memo[g]


def main():
    H, W = read_int_n()
    C = read_int_n()
    D = read_int_n()
    S = [read_str() for _ in range(H)]
    print(slv(H, W, C, D, S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 247448
import sys
from collections import deque

input = sys.stdin.readline
n = int(input())
a = deque()
a = deque(map(int, input().split()))
asum = sum(a)
ah = asum / 2
it = a.popleft()
l1 = [it]
sl1 = it
sl2 = asum
dp = []
sdp = 0

for i in range(n - 1):
    it = a.popleft()
    dp = l1
    sdp = sl1
    l1.append(it)
    sl1 += it
    sl2 -= it
    if sl1 > ah:
        break
if (sl1 - ah) ** 2 + (asum - sl1 - ah) ** 2 > (sdp - ah) ** 2 + (asum - sdp - ah) ** 2:
    l1 = dp
    a.append(it)
    sl1 = sdp
    sl2 += it
print(int(abs(sl1 - ah) * 2))



Measured memory_bytes: 25740
import sys
N=int(input())
a=[int(i) for i in input().split(" ")]

if 1 in a:
    pass
else:
    print("-1")
    sys.exit()

i=1
retval=0
for ai in a:
    if ai==i:
        i+=1
    else:
        retval+=1

print(retval)


Measured memory_bytes: 24744
n = int(input())
a = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

j_max = 0
cnt = [0] * 60
for i in range(n):
    for j in range(60):
        cnt[j] += a[i] % 2
        a[i] = a[i] // 2
        if a[i] == 0:
            j_max = max(j_max, j)
            break

ans = 0
for i in range(j_max + 1):
    ans = (ans + (2 ** i) * cnt[i] * (n - cnt[i])) % mod

print(ans)


Measured memory_bytes: 122936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  int a=n%10;
  if(a==2 || a==4 || a==5 || a==7 || a==9){
    cout<<"hon"<<endl;
  }
  else if(a==3){
    cout<<"bon"<<endl;
  }
  else{
    cout<<"pon"<<endl;
  }
}

Measured memory_bytes: 3636
//
//  main.cpp
//  testCpp01
//
//  Created by 田中英行 on 2019/11/13.
//  Copyright © 2019 田中英行. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

int main() {
    float a, b, t;
    cin >> a >> b >> t;
    
    int ans = 0;
    for(float i = a; i < (t + 0.5); i += a)
    {
        ans += b;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n,k,x,y;
    cin>>n>>k>>x>>y;
    
    if(n<k)cout << n*x << endl;
    else cout <<  k*x+(n-k)*y << endl;
    
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}

// end of Template

int n,k,ans;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ans = 1;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        ans = min(ans*2,ans+k);
    }
    cout<<ans<<newl;

}


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

int main(int argc, char const *argv[]) {
    int a, b, c;
    cin >> a >> b >> c;

    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 3104
n = int(input())
s = [input() for _ in range(3)]
ans = 2*n
for i in range(n):
  if s[0][i] == s[1][i]: ans -= 1
  if s[0][i] == s[2][i]: ans -= 1
  if s[2][i] == s[1][i]: ans -= 1
  if s[0][i] == s[1][i] and s[2][i] == s[1][i] : ans += 1
print(ans)


Measured memory_bytes: 38256
n, k = STDIN.gets.split(/ +/).map(&:to_i)
p = []
n.times do
  p << STDIN.gets.to_i
end
p.sort!


min = p[k-1] - p[0]
i = 1
while i + k -1 < n do
  if min > p[k+i-1] - p[i]
    min = p[k+i-1] - p[i]
  end

  i += 1
end

puts min


Measured memory_bytes: 3832
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

ans = 0
for a in A:
    tmp_sum = 0
    for j in range(M):
        tmp_sum += a[j]*B[j]
    if tmp_sum+C > 0:
        ans += 1
print(ans)

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

int main() {
  int n,m,ans;
  cin >> n >> m;
  vector<int> x(m);
  vector<int> a(m-1);
  for(int i=0;i<m;i++) cin >> x.at(i);

  sort(x.begin(),x.end());
  for(int i=0;i<m-1;i++) {
    a.at(i)=x.at(i+1)-x.at(i);
  };
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ans=x.at(m-1)-x.at(0);
  if(n>=m) {
    ans=0;
  } else {
    for(int i=0;i<n-1;i++) {
      ans-=a.at(i);
    };
  };
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,x,y,f[2004];

int main()
{
    scanf("%d%d%d",&n,&x,&y);
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if(j<=x||i>=y)
            {
                f[j-i]++;
            }
            else if(i>x&&i<y&&j<y&&j>x)
            {
                int p=min(j-i,y-j+1+i-x);
                f[p]++;
            }
            else if(i<=x&&j>=y)f[j-i-(y-x-1)]++;
            else if(i<=x&&j>x)
            {
                int p=min(j-i,y-j+1+x-i);
                f[p]++;
            }
            else 
            {
                int p=min(j-i,i-x+1+j-y);
                f[p]++;
            }
        }
    }
    for(int i=1;i<n;i++)printf("%d\n",f[i]);
}

Measured memory_bytes: 256
#include <stdio.h>

int main () {

	char N[2000000];
	scanf("%s", N);
	
	int total = 0; 
	for(int i = 0; N[i] != '\0'; i++) {
		total += N[i] - '0';
	}
	
	//printf("total = %d\n", total);

	if((total % 9) == 0) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
  int n,m;cin>>n>>m;
  vector<vector<int>> G(n);
  rep(i,m){
    int a,b;cin>>a>>b;
    --a;--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int reached[n]={};
  stack<int> st;
  st.push(0);
  reached[0]=1;
  int ctr=0;
  bool flag=1;
  while(!st.empty()){
    if(!flag)break;
    int t=st.top();
    st.pop();
    for(auto au:G[t]){
      int color=(2-reached[t])+1;
      if(reached[au]==0){
        reached[au]=color;
        st.push(au);
      }
      else{
        if(color!=reached[au]){
          flag=0;
          break;
        }
      }
    }
  }
  if(!flag)cout<<1ll*n*(n-1)/2-m<<endl;
  else{
    int b=0;
    rep(i,n){
      if(reached[i]==1)++b;
    }
    cout<<1ll*b*(n-b)-m<<endl;
  }
}
          


    



  


Measured memory_bytes: 6144
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;

#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
const int maxn = 1e2 + 20;
char str[maxn];
char sub[maxn];
int tonext[maxn];
void get_next(char str[], int lenstr) {
    tonext[1] = 0;
    int i = 1;
    int j = 0;
    while (i <= lenstr) {
        if (j == 0 || str[j] == str[i]) {
            tonext[++i] = ++j;
        } else j = tonext[j];
    }
}
int kmp(char str[], char sub[], int lenstr, int lensub) {
    int i = 1, j = 1;
    while (i <= lenstr) {
        if (j == 0 || str[i] == sub[j]) {
            ++j;
            ++i;
        } else j = tonext[j];
    }
    return j - 1;
}
void work() {
    int n;
    scanf("%d", &n);
    scanf("%s%s", str + 1, sub + 1);
    get_next(sub, n);
    printf("%d\n", n + n - kmp(str, sub, n, n));
}

int main() {
#ifdef local
    freopen("data.txt","r",stdin);
#endif
    work();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <time.h>
#include <ctype.h>

int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; }
int max(int a, int b) { return a >= b ? a : b; }
int min(int a, int b) { return a <= b ? a : b; }
int dsum(int x) { int r=0; while(x){ r+=(x%10); x/=10; } return r;}
void swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp; return; }

int main(void) {
  int a,b,idx,cnt=0,ans=0;
  char names[6] = {'A','B','C','D','E'};
  while(scanf("%d%d",&a,&b) != EOF) {
    if(cnt == 5) {
      printf("%c %d\n",names[idx],ans);
      cnt = 0;
      ans = 0;
    }
    if(a+b > ans) {
      ans = a+b;
      idx = cnt;
    }
    cnt++;
  }
  return 0;
}


Measured memory_bytes: 2024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
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) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll N_MAX = 10000000000000000;

ll N;

void input() {
	scanf("%lld", &N);
}

void solve() {
	string S=to_string(N);
	vector<vector<ll>> dp(20, vector<ll>(2,0));
	
	int v=S[0]-'0';
	dp[0][0]=v;
	dp[0][1]=v-1;

	rep(i,S.size()-1){
		v=S[i+1]-'0';
		dp[i+1][0]=dp[i][0]+v;
		if(v==0)dp[i+1][1]=dp[i][1]+9;
		else dp[i+1][1]=max(dp[i][1]+9, dp[i][0]+v-1);
	}
	debug(dp);
	printf("%lld\n", max(dp[S.size()-1][0],dp[S.size()-1][1]));
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x << " " << x << '\n';
#define int long long
signed main()
{
    int n,i;
    cin >> n;
    vector<int> arr(n);
    for(i=0;i<n;i++)
        cin >> arr[i];
        arr[0]--;
        for(i=1;i<n;i++)
            if(arr[i]!=arr[i-1]) arr[i]--;
    bool f=false;

    for(i=1;i<n;i++)
        if(arr[i-1]>arr[i]) f = true;
    if(f) cout << "No\n"; else cout << "Yes\n";

}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int[] a = in.nextIntArray(3);
        int sum = Arrays.stream(a).sum();
        out.println(sum >= 22 ? "bust" : "win");
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 28500
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  map<int,int> o;
  for(int i = 0; i < n; i++){
    int x; cin >> x;
    o[x]++;
  }
  int ans = 0;
  for(auto it : o) ans += it.second % 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  int a[n],b[n];
  rep(i,0,n) cin>>a[i];
  rep(i,0,n) cin>>b[i];
  int c[n+1],d[n+1];
  c[0]=0,d[0]=0;
  rep(i,0,n) c[i+1]=c[i]+a[i];
  rep(i,0,n) d[i+1]=d[i]+b[n-1-i];
  int ans=0;
  rep(i,1,n+1){
    ans=max(ans,c[i]+d[n+1-i]);
  }
  cout<<ans<<endl;
}

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

void _150() {
    string s;
    cin >> s;

    if ((s == "AAA") || (s == "BBB"))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

void _156() {
    int n, r;
    cin >> n >> r;

    if (n >= 10)
        cout << r << endl;
    else
        cout << r + 100 * (10 - n) << endl;
}

void _155() {
    int a, b, c;
    cin >> a >> b >> c;

    if ((a != b) && (a != c) && (b != c))
        cout << "No" << endl;
    else if ((a == b) && (b == c))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

void _154() {
    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if (s ==u)
        cout << a - 1 << " " << b << endl;
    else
        cout << a << " " << b - 1 << endl;
}

void _153() {
    int h, a;
    cin >> h >> a;

    // int times = h / a;
    // if (times % a == 0)
    //     cout << times << endl;
    // else
    //     cout << times + 1 << endl;
    cout << (h + a - 1) / a << endl;
}

void _152() {
    int n, m;
    cin >> n >> m;

    if (m == n)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main()
{
    // _150();
    _152();
    
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };

void  bubbleSort(int number[], int length);



int main() {

	int N, H[100002];

	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &H[i]);
	}

	H[N] = c_INF;

	int ans = 0;

	int anCan = 0;

	for (int i = 0; i < N-1; i++) {
		

		if (H[i] >= H[i + 1]) {
			anCan++;
		}
		else {
			ans = max(ans, anCan);
			anCan = 0;
		}


		
	}

	ans = max(ans, anCan);

	printf("%d", ans);


}

Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DIHateFactorization solver = new DIHateFactorization();
        solver.solve(1, in, out);
        out.close();
    }

    static class DIHateFactorization {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            long x = s.nextLong();
            for (long i = -1000L; i <= 1000L; i++) {
                for (long j = i - 200L; j <= i + 200L; j++) {
                    if (Math.pow(i, 5) - Math.pow(j, 5) == x) {
                        out.println(i + " " + j);
                        return;
                    }
                }
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 36796
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main {
    static int[][] paper;
    public static void main (String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	paper = new int[10][10];
	int x, y;
	String size, str;
	String[] input;
	while ((str = br.readLine()) != null) {
	    input = str.split(",");
	    x = Integer.parseInt(input[0]);
	    y = Integer.parseInt(input[1]);
	    size = input[2];
	    dropInk(x, y);
	    smallInk(x, y);
	    if (size.equals("1")) {
		continue;
	    }
	    mediumInk(x, y);
	    if (size.equals("2")) {
		continue;
	    }
	    largeInk(x, y);
	}
	int max = 0, cnt = 0;
	for (int i = 0; i < 10; i++) {
	    for (int j = 0; j < 10; j++) {
		if (paper[i][j] == 0) {
		    cnt++;
		}
		if (paper[i][j] > max) {
		    max = paper[i][j];
		}
	    }
	}
	System.out.println(cnt);
	System.out.println(max);
    }
    public static void dropInk (int x, int y) {
	if ((0 <= x && x < 10) && (0 <= y && y < 10)) {
	    paper[x][y]++;
	}
    }
    public static void smallInk (int x, int y) {
	dropInk(x+1, y);
	dropInk(x-1, y);
	dropInk(x, y+1);
	dropInk(x, y-1);	
    }
    public static void mediumInk (int x, int y) {
	dropInk(x+1, y+1);
	dropInk(x-1, y+1);
	dropInk(x+1, y-1);
	dropInk(x-1, y-1);
    }
    public static void largeInk (int x, int y) {
	dropInk(x+2, y);
	dropInk(x-2, y);
	dropInk(x, y+2);
	dropInk(x, y-2);
    }
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;

ll fac[maxn], ifac[maxn];

ll modpow(ll, ll);
ll inv(ll);
ll nck(ll, ll);
void build();
void testlib();


ll x, y;


int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  build();
  cin>>x>>y;

  if (2LL*y - x < 0) out(0);
  if ((2LL*y - x)%3) out(0);
  ll b = (2LL*y - x) / 3;
  ll a = (x - y) + b;
  if (b < 0 || a < 0) out(0);

  //cout<<a<<" "<<b<<endl;

  ll ans = nck(a+b, a);
  cout<<ans<<endl;

  return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////


ll modpow(ll x, ll y) {
  x %= mod;
  ll res = 1;
  while (y > 0) {
    if (y%2 == 1) {
      res *= x;
      res %= mod;
    }
    x = x * x;
    x %= mod;
    y = y / 2;
  }
  return res;
}

ll inv(ll x) {
  assert(x != 0);
  return modpow(x, mod-2);
}

void build() {
  fac[0] = ifac[0] = 1;
  for (int i=1; i<maxn; i++) {
    fac[i] = fac[i-1] * i;
    fac[i] %= mod;
    ifac[i] = inv(fac[i]);
    ifac[i] %= mod;
  }
}

ll nck(ll n, ll k) {
  assert(n>=0 && k>=0);
  if (k > n) return 0;
  return (((fac[n] * ifac[k]) % mod) * ifac[n-k]) % mod;
}

void testlib() {
  assert(modpow(1,1) == 1);
  assert(modpow(4,2) == 16);
  assert(modpow(2,5) == 32);
  assert(fac[3] == 6);
  assert(nck(4,2) == 6);
  assert(nck(10,2) == 45);
}


Measured memory_bytes: 15872
#include<stdio.h>
int main(void){
    int a,b,c,i,j;
    j=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=a+c;i<=10100;i+=a){
        if(i%b==0){
            printf("YES");
            j++;
            break;
        }
    }
    if(j==0)printf("NO");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> inline bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> inline bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    in>>n;
    ll s{};
    Fr(i,n) if(i%3&&i%5) s+=i;
    cout<<s<<endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pi pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define in1(x) int x; cin>>x;
#define in2(x, y) int x, y; cin>>x>>y;
#define in3(x, y, z) int x, y, z; cin>>x>>y>>z;
#define in4(x, y, z, w) int x, y, z, w; cin>>x>>y>>z>>w;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
using namespace std;
bool primes[1000001];vi prime; void seive(); int gcd(int a, int b); int power(int x, int y);

int32_t main(void){
	IOS;
	in1(n);
	long double d;
	cin>>d;
	int ans = 0;
	rep(i, 0, n)
	{
		long double x, y;
		cin>>x>>y;
		long double dist = sqrt(x*x + y*y);
		if(dist <= d) ans += 1;	
	}
	cout<<ans<<endl;
}

void seive(){memset(primes, true, sizeof(primes));primes[0] = primes[1] = false;for(int i = 2; i*i<=1000000;i += 1){
if(primes[i]){for(int j = i*i; j <= 1000000;j += i) primes[j] = false;}}rep(i, 2, 1000001){if(primes[i]) prime.pb(i);}}
int gcd(int a, int b){return b==0 ? a : gcd(b, a%b);}
int power(int x, int y){ int res = 1;x = x % mod; if (x == 0) return 0;
while (y > 0){ if(y & 1) res = (res*x) % mod; y = y>>1; x = (x*x) % mod;} return res;}


Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include <cmath>
using namespace std;
 
int main() {
 
	long long n, MAX=-1000000000;
	cin >> n;
	vector<int> R(n);

	/* 株価の値を入力 */
	for(int i = 0; i < n; i++){
		cin >> R[i];
	}

	/* 株価の最大値を探す */
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			if(MAX < R[j]-R[i]) MAX = R[j]-R[i];
			if(R[i]>=R[j])break;
		}
	}

	cout << MAX << endl;
 
	return 0;
}
 



Measured memory_bytes: 3556
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
	cin >> s;

	if (((s[0] == s[1]) && (s[2] == s[1]) || (s[1] == s[2]) && (s[3] == s[2])))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		if (N == 1){
			System.out.println("Hello World");
		}else {
			int a = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			System.out.println(a+b);
		}
	}
}

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

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------


int main() {
    

    ll n,ans=0;
    cin>>n;
    vll a(n+1,0);
    rep2(i,1,n+1){
        for(ll k=i;k<=n;k+=i){
            a.at(k)++;
        }
    }
    rep2(i,1,n+1){
        ans+=i*a.at(i);
    }
    cout<<ans<<endl;
}



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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define sz(v) ll(v.size())


void solve(ll N, vector<ll> a, vector<ll> b, vector<ll> c){
    ll v[N][3];
    fill(v[0], v[N], 0);
    v[0][0] = a[0];
    v[0][1] = b[0];
    v[0][2] = c[0];
    for (int i = 1; i < N; i++) {
        v[i][0] = a[i] + max(v[i-1][1], v[i-1][2]);
        v[i][1] = b[i] + max(v[i-1][0], v[i-1][2]);
        v[i][2] = c[i] + max(v[i-1][0], v[i-1][1]);
    }
    cout << max(v[N-1][0], max(v[N-1][1], v[N-1][2])) << endl;
}

int main() {
    ll N;
    scanf("%lld",&N);
    vector<ll> a(N);
    vector<ll> b(N);
    vector<ll> c(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, move(a), move(b), move(c));
    return 0;
}


Measured memory_bytes: 4992
while 1:
    d = input()
    if d==0:
        break
    V = [float(raw_input()) for i in xrange(d+3)]

    a = [0]*(d+3)
    cnts = [0]*(d+3)
    import itertools
    for K in itertools.combinations(range(d+3), d+1):
        for k in K:
            res = 1
            for j in K:
                if k==j: continue
                res *= k-j
            a[k] = V[k] / res
        for i in xrange(d+3):
            if i in K: continue
            res = 0.
            for k in K:
                tmp = 1
                for j in K:
                    if k==j: continue
                    tmp *= i-j
                res += a[k]*tmp
            if abs(V[i]-res) > 0.5:
                cnts[i] += 1
    print cnts.index(max(cnts))

Measured memory_bytes: 6400
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int K,T;
	cin>>K>>T;
	priority_queue<int>A;
	for(int i=0;i<T;i++)
	{
		int a;
		cin>>a;
		A.push(a);
	}
	while(A.size()>1)
	{
		int f=A.top();A.pop();
		int s=A.top();A.pop();
		A.push(f-s);
	}
	cout<<max(A.top()-1,0)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long LL;

int main() {
	string s;
	cin >> s;
	int l1 = s.length();
	for (int i = 0; i < l1 - 1; i++) {
		if (s[i] != s[i + 1]) {
			printf("Yes\n");
			return 0;
		}
	}	
	printf("No\n");
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

void print(vector<int> v, char mark)
{
  for (int i = 1; i < 14; ++i) {
    if (!v[i]) {
      fprintf(stdout, "%c %d\n", mark, i);
    }
  }
}

int main()
{
  vector<int> spade(14, 0), heart(14, 0), club(14, 0), dia(14, 0);
  int n;
  fscanf(stdin, "%d\n", &n);
  for (int i = 0; i < n; ++i) {
    char mark;
    int num;
    if (i < n - 1) {
      fscanf(stdin, "%c %d\n", &mark, &num);
    }
    else {
      fscanf(stdin, "%c %d", &mark, &num);
    }
    if (mark == 'S') { spade[num] = 1; }
    else if (mark == 'H') { heart[num] = 1; }
    else if (mark == 'C') { club[num] = 1; }
    else if (mark == 'D') { dia[num] = 1; }
  }
  print(spade, 'S');
  print(heart, 'H');
  print(club, 'C');
  print(dia, 'D');
  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
 
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i)
void fastscan(int &x)
 {
        bool neg=false;
        register int c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    } 
string alpha = "abcdefghijklmnopqrstuvwxyz";
const int mod = 1e9+7;
const int inf = 2e18+5;
const int nax = 100010;
const int mod1 = 998244353;

signed main()
 {
   
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n,sum = 0;
     cin>>n;
     vector<int> v(n);
     loop(i,0,n)
      {
        cin>>v[i];
        sum += v[i];
      }
     double p = 1.0 * sum / n;
    p = round(p);
     int ans = 0;
     loop(i,0,n)
      ans += (v[i] - p) * (v[i] - p);
     cout<<ans;
     return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int dp[1000000];
string S;
int main() {
	cin >> S; dp[0] = 1;
	for (int i = 0; i < S.size(); i++) {
		if (dp[i] == 0)continue;
		if (i + 5 <= S.size() && S.substr(i, 5) == "dream")dp[i + 5] = 1;
		if (i + 7 <= S.size() && S.substr(i, 7) == "dreamer")dp[i + 7] = 1;
		if (i + 5 <= S.size() && S.substr(i, 5) == "erase")dp[i + 5] = 1;
		if (i + 6 <= S.size() && S.substr(i, 6) == "eraser")dp[i + 6] = 1;
	}
	if (dp[S.size()] == 1)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 4132
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const double pi=acos(-1.0);

int main(){
	string s,s1,s2;
	cin>>s>>s1;
	s1.erase(s1.size()-1,1);
	if(s1==s)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3612
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	VI a(n);
	rep(i, n) cin >> a[i];

	double sum = 0;
	rep(i, n) sum+= a[i];

	double ave = sum / n;
	double minv = INF, memo;
	int ans=0;


	rep(i, n) {
		memo = abs(ave - a[i]);
		if (min(memo, minv) == memo) {
			if(memo!=minv ){
				minv = memo;
				ans = i;
			}
		}
	}
	cout << ans << endl;

	return 0;
	
}





Measured memory_bytes: 256
=begin
  1, num > 0 で処理開始
    1.1 num % 10 の結果を ans に足す
    1.2 num /= 10 をする
  2, 1 に戻る
=end

while (num = gets.to_i) != 0
  ans = 0
  while num > 0
    ans += num % 10
    num /= 10
  end
  puts ans
end


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

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

  if (a.at(1)==a.at(2)){
    if (a.at(1)==a.at(0)||a.at(1)==a.at(3)){
      cout <<"Yes"<<endl;
    }
    else
    {
      cout <<"No"<<endl;
    }
    
  }
  else 
  cout<<"No"<<endl;

}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll sum = 0, mi = INF;
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    for(int i=0;i<n;i++){
    	cin >> a[i] >> b[i];
    	if(a[i] > b[i] && b[i] < mi) mi = b[i];
    	sum += a[i];
    }
    sum -= mi;
    cout << ((a == b)? 0: sum) << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int m,d;
	cin>>m>>d;
	int cnt=0;
	for(int i=20;i<=d;i++)
	{
		int x=i/10;
		int y=i%10;
		if((x*y)<=m&&x*y!=0&&y>=2)
		{
			//cout<<x*y<<endl;
			cnt++;
		} 
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 200000
#define LL long long
LL ai[N];
LL n;
int solve()
{
    LL a = 0, x = 0;
    for (int i = 1; i <= n; ++ i)
        a ^= (ai[i] - 1) & 1, x += ai[i] & 1;
    if (a) return 1;
    if (x == 1)
    {
        int p = 0;
        for (int i = 1; i <= n; ++ i)
            if (ai[i] & 1) p = i;
        ai[p] --;
        if (ai[p] == 0) return 0;
        LL g = ai[1];
        for (int i = 2; i <= n; ++ i)
            g = __gcd(g, ai[i]);
        for (int i = 1; i <= n; ++ i)
            ai[i] /= g;
        return !solve();
    }
    return 0;
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> ai[i];
    if (solve()) puts("First"); else puts("Second");
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;


int main(){
        int N;
        int i;
        cin >> N;
        vector <int> a(N);
        for(int i=0; i<N; i++) {
                cin >> a[i];
        }
        int ans=0;
        for(i=0; i<N; i++) {
                while(a[i]%2==0) {
                        a[i]/=2;
                        ans++;
                }
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
map<string,int> mp;
map<string,int>::iterator it;
ll nc2(int n)
{
  ll r,s=(ll)n;
  r=(s*(s-1))/2;
  return r;
}
int main()
{
  string s;
  int n,i,j,k;
  ll sum=0;
  cin>>n;
  for(i=1; i<=n; i++)
  {
    cin>>s;
    sort(s.begin(),s.end());
    //cout<<s<<endl;
    if(mp.find(s)==mp.end())
    {
       mp[s]=1;
    }
    else
    {
      mp[s]++;
    }
  }
  for(it=mp.begin(); it!=mp.end(); it++)
  {
   // cout<< it->first << " => "<<it->second<<endl;
    k=it->second;
    //cout<<k<<endl;
    if(k>1)
    {
      sum+=nc2(k);
    }
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 11136
x1, y1, x2, y2 = map(int, input().split())

x3_1, x3_2 = x2 - abs(y2 - y1), x2 + abs(y2 - y1)
x4_1, x4_2 = x1 - abs(y2 - y1), x1 + abs(y2 - y1)
y3_1, y3_2 = y2 - abs(x2 - x1), y2 + abs(x2 - x1)
y4_1, y4_2 = y1 - abs(x2 - x1), y1 + abs(x2 - x1)

if x2 > x1 and y2 > y1:
    print(x3_1, y3_2, x4_1, y4_2)
elif x2 > x1 and y2 <= y1:
    print(x3_2, y3_2, x4_2, y4_2)
elif x2 <= x1 and y2 > y1:
    print(x3_1, y3_1, x4_1, y4_1)
elif x2 <= x1 and y2 <= y1:
    print(x3_2, y3_1, x4_2, y4_1)

Measured memory_bytes: 9244