akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

char ca[100];

int main(){
	int n,m;
	cin>>n>>m;
	cin>>ca;
	ca[m-1]+=(int)'a'-(int)'A';
	cout<<ca<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define ll long long
#define MAXN 1000000
#define MODD 1000000007
#define ll long long
using namespace std;


ll A[111111];
int main() {
    int N;
    cin>>N;
    for(int i=1;i<=N;i++)
        cin>>A[i];
    
    ll ans = 0;
    for(int s=-1;s<=1;s+=2) {
        ll summ = 0;
        ll total_delta = 0;
        int reqd=s;
        for(int i=1;i<=N;i++) {
            
            // sign(summ + A[i]) = reqd
            ll delta = 0;
            if (reqd == -1) {
                if (summ + A[i] >= 0) {
                    delta = -1-summ-A[i];
                } else {
                    delta = 0;
                }
            } else {
                if (summ + A[i] <= 0) {
                    delta = 1-summ-A[i];
                } else {
                    delta = 0;
                }
            }
            
            
            summ += A[i]+delta;
            total_delta += abs(delta);
            reqd = -reqd;
            
        }
        if (s == -1) {
            ans = total_delta;
        } else {
            ans = min(ans, total_delta);
        }
        
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 1024
import sys

def main():
    input = sys.stdin.readline
    S = int(input())

    x1 = 0
    y1 = 0

    if S <= 10**9:
        x2 = 1
        y2 = 0
        x3 = 0
        y3 = S
    elif S == 10**18:
        x2 = 10**9
        y2 = 0
        x3 = 0
        y3 = 10**9
    else:
        x2 = 10**9
        y2 = 1
        y3 = S // 10**9 + 1
        x3 = 10**9 * y3 - S

    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>; // intの2次元の型に vvi という別名をつける
const ll llMAX=9223372036854775807LL; 
const ll llMIN=-9223372036854775808LL;

void myprint1D(vi &data)
{
  REP(i,data.size())
    cout<<data[i]<<" ";
  cout<<endl;
}

//配列を[y][x]で表示
void myprint2D_T(vvi &data)
{
  REP(i,data.size())
    myprint1D(data[i]);
}

//配列を[x][y]で表示
void myprint2D(vvi &data)
{
  ll l1=data.size();
  ll l2=data[0].size();
  REP(j,l2){
    REP(i,l1)
      cout<<data[i][j]<<" ";
    cout<<endl;
  }
}

//print(a,b...)って使い方
void print1(ll a){cout<<a<<endl;}
void print2(ll a,ll b){cout<<a<<" "<<b<<endl;}
void print3(ll a,ll b,ll c){cout<<a<<" "<<b<<" "<<c<<endl;}
void print4(ll a,ll b,ll c,ll d){cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;}
void print5(ll a,ll b,ll c,ll d,ll e){cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;}


ll n,k,x,y;


//moddivとnCk
//c剰余下でaをbで割った値
ll moddiv(ll a,ll b,ll c){
	ll x0=c,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0LL) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%c;
      if (x2==1LL){
        ans=(n2+c)%c;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%c)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n,ll c){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1LL) ans=ans*aa%c;
    aa=aa*aa%c;
    beki/=2LL;
    if (beki==0LL)break;
  }
  return ans;
}

//nCk
vi mulmod(500001);//0!,1!,2!,3!,4!,,,,
void first_nCk(){
  mulmod[0]=1LL;
  for(ll i=1;i<500001;i++){
    mulmod[i]=mulmod[i-1]*i%MOD;
  }
}
ll nCk(ll nn,ll kk){
  return moddiv(mulmod[nn],mulmod[kk]*mulmod[nn-kk]%MOD,MOD);
}

ll modinv(ll a,ll b){
  return moddiv(1,a,b);
}

ll garner(ll a,ll b,ll ar,ll br){
  return ar+(br-ar+b)%b*modinv(a,b)%b*a;
}
ll garner2(ll a,ll b,ll ar,ll br){
  ar%=a;
  br%=b;
  ll ret=(ar+(br-ar)%b*((moddiv(1,a,b)+b)%b)%b*a+a*b)%(a*b);
  return ret;
}

ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0LL){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}





int main(){
  ll ans=0;
  cin >> n;

  if (n==1){
    cout<<1<<endl;
    return 0;
  }
  if (n%2==0){
    ans=2*n-1;
  }else{
    ans=n-1;
  }

  n*=2;
  for(ll i=2;i<=n+2;i++){
    if (i*i>n)break;
    if (n%i==0){
      ll val0=i;
      ll val1=n/i;
      if (val0==1)continue;
      if (val1==1)continue;
      if (gcd(val0,val1)==1){
        ll ans0=garner2(val0,val1,1,0)-1;
        ll ans1=garner2(val0,val1,0,1)-1;
        //ans0%=val0*val1;
        //ans1%=val0*val1;
        if (ans0>1)
          ans=min(ans,ans0);
        if (ans1>1)
          ans=min(ans,ans1);
      }
    }
  }


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

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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  cerr << setprecision(10);
  int N; 
  ll K;
  cin >> N >> K;

  vector<double> A(N,0);

  long double max_len = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    max_len = (max_len > A[i] ? max_len : A[i]);
  }

  // cerr << "max_len" << max_len << endl;

  long double right = max_len;
  long double mid;
  long double eps = 0.00001;
  long double left = eps;

  while(right - left > eps){
    // cerr << left << " " << right << endl;
    mid = (right + left)/2;

    ll tmp = 0;
    for(int i= 0; i < N; i++){
      tmp += floor(A[i]/mid);
    }
    if(tmp > K){
      left = mid;
    } else {
      right = mid;
    }
  }
  // cerr << "right " << right << endl;
  cout << ceil(right-eps) << endl;

}


Measured memory_bytes: 4828
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] A = new int[N+1];
		for (int i=1;i<=N;i++) {
			A[sc.nextInt()] = i;
		}

		for (int i=1;i<N;i++) {
			System.out.print(A[i]+" ");
		}
		System.out.println(A[N]);

//		System.out.println(Arrays.toString(A));
	}

}

Measured memory_bytes: 56656
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    if (n % 2 == 0) {
        cout << n << endl;
    } else {
        cout << 2 * n << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, x, res;

void dfs(int i, int sum, int nn)
{
    if(nn == 3 && sum == x)
    {
      res++;
      return ;
    }
    if(nn == 3 || i > n)return ;
    dfs(i + 1, sum + i, nn + 1);
    dfs(i + 1, sum, nn);
}

int main(void)
{
    while(cin >> n >> x)
    {
        if(n == 0 && x == 0) break;
        res = 0;
        dfs(1, 0, 0);
        cout << res << endl;
    }
    return (0);
}


Measured memory_bytes: 3096
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

from heapq import heapify, heappush, heappop, heappushpop, heapreplace

n, k = map(int, input().split())
r, s, p = map(int, input().split())
point = {'r':p, 's':r, 'p': s}
t = input()
ans = 0
for i in range(k):
    j = i
    prev = False
    while j < n:
        if prev and t[j] == t[j-k]:
            prev = False
        else:
            ans += point[t[j]]
            prev = True
        j += k
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define R register int
#define ll long long
using namespace std;
namespace Luitaryi {
inline ll g() { register ll x=0,f=1;
	register char ch; while(!isdigit(ch=getchar())) f=ch=='-'?-1:f;
	do x=x*10+(ch^48); while(isdigit(ch=getchar())); return x*f;
} const int N=100010;
ll n,m,k,a[N],p[N],stk[N],ans[N]; bool vis[N];
inline void main() {
	n=g(); for(R i=1;i<=n;++i) a[i]=g(),p[i]=i;
	for(R i=n;~i;--i) a[i]-=a[i-1];
	m=g(),k=g(); for(R i=1,x;i<=m;++i) x=g(),swap(p[x],p[x+1]);
	for(R i=1;i<=n;++i) {
		if(!vis[i]) { R top=0;
			for(R j=i;!vis[j];j=p[j]) stk[++top]=j,vis[j]=true;
			for(R j=1;j<=top;++j) ans[stk[j]]=a[stk[(k+j-1)%top+1]];
		}
	} for(R i=1;i<=n;++i) ans[i]+=ans[i-1],printf("%lld.0\n",ans[i]);
}
} signed main() {Luitaryi::main(); return 0;}

Measured memory_bytes: 4736
n = int(input())
length = int(n / 19) + 1
if n > 19 and n % 19 == 0:
    length -= 1
d = []
for i in range(length):
    d += list(map(int, input().split()))
start, end = 1, 10
l = []
flag = False
for j in range(1, len(d)+1):
    for i in range(0, len(d)):
        tmp = ''.join(map(str, d[i:i+j]))
        if len(tmp) > 1 and tmp[0] == '0':
            pass
        elif len(tmp) == j:
            l.append(int(tmp))
    l = sorted(set(l))
    if start == 1:
        for k in range(0, 10):
            if k not in l:
                print(k)
                flag = True
                break
    else:
        for k in range(start, end):
            if k not in l:
                print(k)
                flag = True
                break
    if flag:
        break
    start, end = start*10, end*10
    l = []

Measured memory_bytes: 7824
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    count=0
    for i in range(N-2):
        a1,a2,a3=A[i],A[i+1],A[i+2]
        if a1<a2<a3 or a3<a2<a1:
            count+=1
    print(count)
 




if __name__ == "__main__":
    main()

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

using namespace std; 
#define ll long long
#define ld long double

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

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

int main()
{
ll n ;
cin >> n ;
string s[n];
rep(i,n){
  cin >> s[i];
}
vector<vector<ll>> g(n);
rep(i,n)rep(j,n)if(s[i][j]=='1')g[i].push_back(j);
rep(i,n){
  queue<ll> q;
  q.push(i);
  vector<ll> dist(n,-1);
  dist[i]=0;
  bool ok=1;
  while(!q.empty()){
    ll p=q.front(); q.pop();
    bool okk=1;
    rep(i,g[p].size()){
      if(dist[g[p][i]]==-1){dist[g[p][i]]=dist[p]+1;q.push(g[p][i]);}
      else if(!(dist[g[p][i]]==dist[p]-1 || dist[g[p][i]]==dist[p]+1)){okk=0;break;}
    }
    if(!okk){ok=0;break;}
  }
  if(ok){
    ll te=0;
    rep(i,n)te=max(te,dist[i]);
    ans=max(ans,te);
  }
}


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

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n;cin>>n;
  vector<int> a(n);
  rep(i, n)cin>>a[i];

  sort(a.begin(), a.end());
  bool all_same = true;
  rep(i, n-1)if(a[i]!=a[i+1])all_same=false;

  if(all_same){
    if(a[0]==n-1 || a[0]==1 || a[0]*2<=n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
  }

  map<int, int>m;
  rep(i, n)m[a[i]]++;
  if(m.size()>2) { cout<<"No"<<endl; return 0;}
  if(a.back()-a[0]>1) { cout<<"No"<<endl; return 0; }


  if(m[a.back()]==(n-a.back())*2 &&  n-((n-a.back())*2)==m[a[0]])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}

Measured memory_bytes: 5376
#include <stdio.h>
#define N 100
int main(){
  int n;
  int A[N];
  int mini;
  int i,j;
  int a;
  int count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  for(i=0;i<n-1;i++){
    mini=i;
    for(j=i+1;j<n;j++){
      if(A[j]<A[mini]){
	mini=j;
      }
    }
    if(i!=mini){
      a=A[i];
      A[i]=A[mini];
      A[mini]=a;
      count++;
    }
  }
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll res=0;
  cin>>n;
  vector<ll>a(n),suma(n+1);
  rep(i,n){
    cin>>a[i];
  }
  ll summ=0;
  ll tres=0;

  vector<ll>ta=a;
  rep(i,n){
    summ+=a[i];
    if(i%2==0){
      if(summ==0){
        summ++;
        tres++;
      }else if(summ<0){
        tres+=abs(summ-1);
        summ=1;
      }
    }else {
      if(summ==0){
        summ--;
        tres++;
      }else if(summ>0){
        tres+=abs(summ+1);
        summ=-1;
      }
    }
  }
  res=tres;
  tres=0;
  summ=0;
  rep(i,n){
    summ+=a[i];
    if(i%2){
      if(summ==0){
        summ++;
        tres++;
      }else if(summ<0){
        tres+=abs(summ)+1;
        summ=1;
      }
    }else {
      if(summ==0){
        summ--;
        tres++;
      }else if(summ>0){
        tres+=abs(summ+1);
        summ=-1;
      }
    }
    //cout<<summ<<endl;
  }
  chmin(res,tres);
  cout<<res<<endl;



  return 0;

}


Measured memory_bytes: 2560
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque, Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-

import heapq
m = 2 * 10 ** 5
mod = 998244353
N, M, K = map(int, input().split())
ans = 0
A = [0] * (m + 5)
A_inv = [0] * (m+5)
inv = [0] * (m+5)

A[0] = A[1] = 1
A_inv[0] = A_inv[1] = 1
inv[1] = 1
for j in range(2, m+5):
    A[j] = A[j - 1] * j % mod
    inv[j] = mod - inv[mod % j] * (mod // j) % mod
    A_inv[j] = A_inv[j - 1] * inv[j] % mod

def cmb(n, k, mod):
    return A[n] * (A_inv[k] * A_inv[n-k] % mod) % mod
for i in range(K+1):
    ans =  (ans + (cmb(N - 1, i, mod) * M % mod) * (pow(M - 1, N - 1 - i, mod)) % mod) % mod
print(ans)

Measured memory_bytes: 33200
#include<iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    int max=0,sum=0;
    for(int i=0;i<N;i++){
        int temp;
        cin>>temp;
        if(temp>max){
            sum+=max;
            max=temp;
        }
        else{
            sum+=temp;
        }
    }
    if(max<sum)
        cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
 
const int N = int(2e5) + 2;
const int LG = 20;
const ll mod = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const ll linf = 1e18; 
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int n, d, a[20][20];

bool ok (int i, int j){
    int cur = 0;
    for (int k = 1; k <= d; ++k){
        int kek = (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
        cur += kek;
    }
    int sq = sqrt(cur);
    if (sq * sq == cur) return 1;
    return 0;
}

int main (){
    scanf ("%d %d", &n, &d);
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= d; ++j) scanf ("%d", &a[i][j]);
    }
    int res = 0;
    for (int i = 1; i <= n; ++i){
        for (int j = i + 1; j <= n; ++j){
            if (ok(i, j)) res++;
        }
    }
    return !printf ("%d\n", res);
}

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

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    string num;
    cin >> num;
    bool is7=false;

    for(int i=0; i<num.size(); i++){
        if(num.at(i)=='7') is7=true;
    }
    if(is7==true) cout << "Yes";
    else cout << "No";
}



Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
int main() {
	string s, t;
	cin >> s >> t;
    int len = s.length();
	bool f = false; int now = -1;
	for (int i = 0; i < len; i += 2) {
		now++;
		while (now < len&&s[i] != t[now]) {
			now++;
		}
	}
	if (now < len)f = true;
	now = -1;
	for (int i = 1; i < len; i+=2) {
		now++;
		while (now < len&&s[i] != t[now])now++;
	}
	if (now < len)f = true;
	if (f)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;


int main() {
    string res ="NO";
    int A, B, C;
    cin >> A >> B >> C;

    for (int i = 1; i <= B; i++) {
      if ((A*i)%B == C) {
        res = "YES";
        break;
      }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define INF 99999999999
using namespace std;

typedef long long int lli;
int main(void){
	int n,m,a,b,c;
	cin>>n>>m;
	lli dp[n][n];

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)dp[i][j]=0;
			else dp[i][j]=INF;
		}
	}

	for(int i=0;i<m;i++){
		cin>>a>>b>>c;
		dp[a][b]=c;
	}

	for(int k=0;k<n;k++){
		for(int u=0;u<n;u++){
			for(int v=0;v<n;v++){
				if(dp[u][k]!=INF&&dp[k][v]!=INF)dp[u][v]=min(dp[u][v],dp[u][k]+dp[k][v]);
				if(u==v&&dp[u][v]<0){
					cout<<"NEGATIVE CYCLE"<<endl;
					return 0;
				}
			}
		}
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(j!=n-1){
				if(dp[i][j]!=INF)cout<<dp[i][j]<<" ";
				else cout<<"INF"<<" ";
			}
			else{
				if(dp[i][j]!=INF)cout<<dp[i][j];
				else cout<<"INF";
			}
		}
		cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
const int maxn=1e3+5;

bool visited[maxn][maxn];
bool a[maxn][maxn];
int n, m;
set<pair<int, pair<int, int> > >s;

void help(int x, int y, int d){
	if(x > n or y > m or x < 1 or y < 1) return;
	if(!a[x][y]) return;
	if(!visited[x][y]) s.insert({d, {x,y}});
}

bool verify(int x, int y){
	if(x > n or y > m or x < 1 or y < 1) return 0;
	return 1;
}

void add(int x,int y, int d){
	help(x + 1, y, d);
	help(x, y + 1, d);
	help(x - 1, y, d);
	help(x, y - 1, d);
	fo(i, -2, 2){
		fo(j, -2, 2){
			if(i == 0 and j == 0) continue;
			if(!verify(x + i, y + j)) continue;
			if(!a[x + i][y + j] or visited[x + i][y + j]) continue;
			s.insert({d+1, {x + i, y + j}});
		}
	}
}

int32_t main(){
    fast_io;
    cin >> n >> m;
    int stx , sty, ex, ey;
    cin >> stx >> sty >> ex >>ey;
    for (int i = 0; i < n; ++i)
    {
    	string s;
    	cin >> s;
    	for (int j = 0; j < m; ++j)
    	{
    		a[i + 1][j + 1] = (s[j] == '.');
    	}
    }
    s.insert({0, {stx, sty}});
    while(!s.empty()){
    	auto it = s.begin();
    	int dist = (*it).first;
    	int x = (*it).second.first;
    	int y = (*it).second.second;
    	// disp(dist);
    	// let(x, y);
    	visited[x][y] = 1;
    	s.erase(it);
    	if(x == ex and y == ey){
    		show(dist);
    		return 0;
    	}
    	add(x, y, dist);
    }
    show(-1);
    return 0;
}

Measured memory_bytes: 6560
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y==NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u !=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}

void preorder(Node u){
  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

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

long long solve(long long n) {
    long long ret = ((n + 1) / 2) % 2;
    if(n % 2 == 0) ret ^= n;
    return ret;
}

int main() {
    long long A, B;
    cin >> A >> B;
    cout << (solve(A - 1) ^ solve(B)) << endl;
    return 0;
}

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

int main()
{
    string str;
    cin >> str;
    int x = str.size();
    
    int num0 = 0;
    int num1 = 0;
    if(x == 1){
        cout << 0 << endl;
        return 0;
    }
    
    for(int i=0; i < x; i++){
        if(str[i] == '0'){
            num1 += 1;
        }else{
            num0 += 1;
        }
        if(i+1 < x){
            if(str[i+1] == '1'){
                num1 += 1;
            }else{
                num0 += 1;
            }
        }
        i++;
    }
    
    int ans = min(num1 ,num0);
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define N 212345
using namespace std;
int a[N],b[N];
int main()
{
    int i,n,t;
    scanf("%d",&n);
    memset(a,0,sizeof(a));
    long long sum=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&t);
        a[t]++;
    }

    for(i=0;i<N;i++)
        if(a[i])
            sum+=(a[i]-1);
    if(sum&1)sum++;
    printf("%lld\n",n-sum);
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;

int main()
{
  int i = 0;
  string str;
  string freqstr;//最頻文字
  string longest;
  map<string,int> Map;
  while(cin >>str){
    if(i < ++Map[str]){
      i = Map[str];
      freqstr = str;
  }
    if(str.size() > longest.size())
      longest = str;
  }
  cout <<freqstr <<" "<<longest<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

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

	int n, k;
	cin >> n >> k;

	int h[n];
	int ans = 0;
	rep(i, n){
		cin >> h[i];
		if(h[i] >= k) ans++;
	}

	cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> weight(N);
  int sum = 0;
  for(int i = 0; i < N; i++) {
    cin >> weight.at(i);
    sum += weight.at(i);
  }
  int total = 0;
  for(int i = 0; i < N - 1; i++) {
    total += weight.at(i);
    if(2 * total >= sum) {
      cout << min(2 * total - sum, sum - 2 * (total - weight.at(i))) << endl;
      return 0;
    }
  }
  cout << sum - 2 * total << endl;  
}

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

using namespace std;

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

int main() {
    ll n, m, i, j, k;
    cin >> n >> k;
    vector<ll> A(n);
    for(auto& x:A)cin >> x;
    sort(A.rbegin(),A.rend());
    for(i=0;i<min(n,k);i++){
        A[i] = 0;
    }
    ll ret = 0;
    for(i=0;i<n;i++){
        ret+=A[i];
    }
    cout << ret << endl;
    return 0;
}

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

int main(){
  int a,b;
  string s;
  cin>>a>>b>>s;
  if(s[a]!='-'){
    cout<<"No"<<endl;
    return 0;
  }
  int c=0;
  for(int i=0;i<a+b+1;i++){
    if(s[i]=='-'){
      c++;
    }
  }
  if(c!=1){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;


const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int main(){
  string x;
  int year, month, day;
  while(cin >> x) {
    if(x == "#") break;
    cin >> year >> month >> day;
    bool is_new = false;
    if(year > 31) {
      is_new = true;
    } else {
      if(year == 31 && month > 4) is_new = true;
    }
    if(is_new) cout << "?" << " " << year - 30 << " " << month << " " << day << endl;
    else cout << "HEISEI" << " " << year << " " << month << " " << day << endl;
  }
  return 0;
}



Measured memory_bytes: 3112
n,m = map(int,input().split())
h = list(map(int,input().split()))
ma = [0]*(n)
for i in range(m):
  a,b = map(lambda x: int(x)-1,input().split())
  ma[a] = max(ma[a], h[b])
  ma[b] = max(h[a], ma[b])
ans = 0
for i in range(n):
  if h[i]>ma[i]:
    ans+=1
print(ans)


Measured memory_bytes: 19940
// https://atcoder.jp/contests/abc102/tasks/abc102_a

package main

import (
  "bufio"
  "bytes"
  "fmt"
  "os"
  "strconv"
  "strings"
)

func main() {
  io := NewIo()
  N := io.NextInt()

  res := N
  if N % 2 == 1 {
    res = 2 * N
  }
  fmt.Println(res)
}

type Io struct {
  reader *bufio.Reader
  writer *bufio.Writer
  tokens []string
  nextToken int
}

func NewIo() *Io {
  return &Io{
    reader: bufio.NewReader(os.Stdin),
    writer: bufio.NewWriter(os.Stdout),
  }
}

func (io *Io) Next() string {
  if io.nextToken >= len(io.tokens) {
    line := io.NextLine()
    io.tokens = strings.Fields(line)
    io.nextToken = 0
  }

  res := io.tokens[io.nextToken]
  io.nextToken++
  return res
}

func (io *Io) NextInt() int {
  res, err := strconv.Atoi(io.Next())
  if err != nil {
    panic(err)
  }
  return res
}

func (io *Io) NextStrings(n int) []string {
  res := make([]string, n)
  for i := 0; i < n; i++ {
    res[i] = io.Next()
  }
  return res
}

func (io *Io) Println(a ...interface{}) {
  var values []string
  for i := 0; i < len(a); i++ {
    values = append(values, "%v")
  }
  io.Printfln(strings.Join(values, " "), a...)
}

func (io *Io) Printfln(format string, a ...interface{}) {
  fmt.Fprintf(io.writer, format+"\n", a...)
}

func (io *Io) NextLine() string {
  if io.nextToken < len(io.tokens) {
    panic("io.nextToken < len(io.tokens)")
  }

  var buffer bytes.Buffer

  for {
    line, isPrefix, err := io.reader.ReadLine()
    if err != nil {
      panic(err)
    }
    buffer.Write(line)
    if !isPrefix {
      break
    }
  }

  return buffer.String()
}


Measured memory_bytes: 640
#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=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

struct edge{
    ll to,cost;
};

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vector<P> ver;
    vector<ll> p(m),q(m),c(m);
    //頂点生成
    rep(i,m){
        cin>>p[i]>>q[i]>>c[i];
        p[i]--,q[i]--,c[i]--;
        ver.push_back(P(q[i],c[i]));
        ver.push_back(P(p[i],c[i]));
    }
    rep(i,n){
        ver.push_back(P(i,-1));
    }
    //頂点に番号を振る
    sort(begin(ver),end(ver));
    ver.erase(unique(begin(ver),end(ver)),end(ver));
    map<P,ll> id;
    ll sz=ver.size();
    rep(i,sz){
        id[ver[i]]=i;
    }
    //辺を張る
    vector<vector<P>> g(sz);
    rep(i,m){
        ll from=id[P(p[i],c[i])],to=id[P(q[i],c[i])];
        g[from].push_back(P(to,0));
        g[to].push_back(P(from,0));
    }
    rep(i,sz){
        auto [v,c]=ver[i];
        if(c==-1) continue;
        ll from=id[ver[i]],to=id[P(v,-1)];
        g[from].push_back(P(to,0));
        g[to].push_back(P(from,1));
    }
    //01 bfs
    ll st=id[P(0,-1)],go=id[P(n-1,-1)];
    vector<ll> dp(sz,inf);
    deque<ll> que;
    dp[st]=0;
    que.push_back(st);
    while(!que.empty()){
        ll v=que.front();
        que.pop_front();
        for(auto [to,c]:g[v]){
            if(c==1){
                if(chmin(dp[to],dp[v]+1)) que.push_back(to);
            }else{
                if(chmin(dp[to],dp[v])) que.push_front(to);
            }
        }
    }
    if(dp[go]==inf) cout<<-1<<endl;
    else cout<<dp[go]<<endl;
}

Measured memory_bytes: 95720
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int N,M;






int main()
{

	cin >> N >> M;
	int p = pow(2,M);

	int num = (N-M) * 100 + 1900*M;


	cout << num*p << endl;


}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  ll ans = 0;

  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0 && n / i != i && n / i > i + 1) {
      ans += n / i - 1;
    }
  }

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

Measured memory_bytes: 3644
N = int(input())
cnt = N+1-2
for i in range(1,int(N**0.5)+1):
    if N%i == 0:
        if cnt > i+N//i-2:
            cnt = i+N//i-2
    if cnt == N**(0.5) * 2 -2:
        break
print(cnt)

Measured memory_bytes: 2940
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

void f(long long d, long long c, long long int& res, long long int& cc) {
	cc += d * c;
	res += c;
	while (cc > 9) {
		res += cc / 10;
		cc = cc / 10 + cc % 10;
	}
}

int main(int argc, char *argv[]) {
	int n;
	long long int cc = 0;
	long long int res = -1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long int d, c;
		scanf("%lld%lld", &d, &c);
		f(d, c, res, cc);
		// cout << res << " " << cc << endl;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>

int main() {
	std::string W;
	std::string T;
	int count = 0;
	std::cin >> W;
	while (std::cin >> T) {
		transform(T.begin(), T.end(), T.begin(), tolower);
		if (T == W) {
			count++;
		}
	}
	std::cout << count << std::endl;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std ;
#define pb push_back
#define ll long long
#define mod 1000000007
const ll N = 500007 ;
ll fact[N] ;
ll BigMod(ll a, ll b)
{
    if(b==0) return 1;
    ll x=BigMod(a, b/2);
    if(b%2==0) return (x*x)%mod;
    x=(x*x)%mod;
    return (x*a)%mod;
}


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

ll c ( ll n , ll r) {
    ll iv = inv( (fact[r] *fact[n-r])%mod ) %mod  ;
    iv+=mod ;
    iv%=mod ;
    return ( fact[n] * iv )%mod ;

}

void fun (  ) {
    fact[0]= fact[1] = 1 ;
    for (ll i = 2 ; i<N ; i++ ) fact[i] = (i*fact[i-1]) %mod ;
}


int main() {
    fun() ;
    ll n , m , k ,i;

    cin>>n  >> m  ;

    ll ans = 0 , pos = 1  ;
    for (i = 0 ; i<=n ;i++) {
        ans += (( (( (pos * c(n,i) ) %mod)+mod)%mod) * ((c(m-i,n-i)*fact[n-i] )%mod )) ;
        ans %= mod ;
        pos *=-1 ;

    }
    ll ans2 = (c(m,n)*fact[n])%mod ;
    cout << (ans*ans2)%mod << endl ;


}



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

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int n;
  cin>>n;
  int p[n];
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  sort(p,p+n,greater<int>());
  int sum=p[0]/2;
  for(int i=1;i<n;i++) sum+=p[i];
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3556
/*
   Creator - Glitched
   Yeet!!
*/

#include "bits/stdc++.h"
#include "stdlib.h"
using namespace std;
#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)

#define ff first
#define ss second
#define pb push_back
#define elif else if
#define flush cout<<"\n"
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{   
    string a,b,c;
    cin>>a>>b;
    ll x,y;cin>>x>>y>>c;
    if(a==c)
        x--;
    else
        y--;

    cout<<x<<" "<<y;

    
}

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

int main (){
  int A, B, C;
  cin >> A >> B >> C;
  
  string ans;
  ans = "NO";
  
  if(A == 7 && B == 5 && C == 5){
    ans = "YES";
  }
  if(A == 5 && B == 7 && C == 5){
    ans = "YES";
  }
  if(A == 5 && B == 5 && C == 7){
    ans = "YES";
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
char s[15];
int main()
{
    scanf("%s",s);
    LL ans=0;
    int n=strlen(s);
    for(int S=0;S<(1<<(n-1));S++)
    {
        LL now=0;
        for(int i=0;i<n;i++)
        {
            if(i && ((1<<(i-1))&S)) ans+=now,now=s[i]-'0';
            else now=10*now+s[i]-'0';
        }
        ans+=now;
    }
    printf("%lld\n",ans);
}


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

struct Node {
  int key;
  Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;
  z = (Node*)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x!=NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if (y==NIL) {
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void preorder(Node *v) {
  if (v==NIL) {
    return;
  }
  cout << " " << v->key;
  preorder(v->left);
  preorder(v->right);
}

void inorder(Node *v) {
  if (v==NIL) {
    return;
  }
  inorder(v->left);
  cout << " " << v->key;
  inorder(v->right);
}

Node *find(Node *v, int x) {
  if (v==NIL || v->key==x) {
    return v;
  }
  if (v->key < x) {
    return find(v->right, x);
  } else{
    return find(v->left, x);
  }
}

Node *minLeft(Node *v) {
  while (v->left!=NIL) {
    v = v->left;
  }
  return v;
}

void delNode(Node *z) {
  Node *y; // Node to delete
  Node *x; // y's child

  if (z->left==NIL || z->right==NIL) {
    y = z;
  }  else {
    y = minLeft(z->right);
    z->key = y->key;
  }

  // x <- y's child
  if (y->left!=NIL) {
    x = y->left;
  } else {
    x = y->right;
  }

  // x's parent <- y's parent
  if (x!=NIL) {
    x->parent = y->parent;
  }

  // y's parent's child <- x
  if (y->parent==NIL) {
    root = x;
  } else {
    if (y->parent->left==y) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }
  free(y);
}

int main() {
  int n;
  cin >> n;
  int x;
  string com;
  for (int i=0; i<n; i++) {
    cin >> com;
    if (com=="insert") {
      cin >> x;
      insert(x);
    } else if (com=="print") {
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    } else if (com=="find") {
      cin >> x;
      Node *v = find(root, x);
      if (v==NIL) {
        cout << "no" << endl;
      } else {
        cout << "yes" << endl;
      }
    } else if (com=="delete") {
      cin >> x;
      Node *v = find(root, x);
      delNode(v);
    }
  }
  return 0;
}



Measured memory_bytes: 21900
//AC
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0033
//dfs
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
int res = 0;
int num[11];
int T;
int B = 0, C = 0;
void d(int i) {
	if (i == 10) return;
	if (num[i] > B) {
		 B = num[i];
		res++;
	}else if(num[i] > C){
		C = num[i];
		res++;
	}
	d(i + 1);
}
int main() {
	
	while (scanf("%d", &T)!= EOF) {
		
		while (T--) {
			C=B=res = 0;
			for (int i = 0; i < 10; i++) {
				scanf("%d", &num[i]);
			}
			d(0);
			
			printf("%s\n", res==10?"YES":"NO");
		}
	}
	return 0;
}

Measured memory_bytes: 3112
#include <stdio.h>

int main() {
	int L, R, d, ctr = 0;
	scanf("%d %d %d", &L, &R, &d);
	while (L <= R) {
		if (L % d == 0) {
			ctr++;
		}
		L++;
	}
	printf("%d\n", ctr);
	return 0;
}

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

int abs(int a,int b){
	if (a>b) return a-b;
	return b-a;
}

int min(int a,int b){
	if (a>b) return b;
	return a;
}

int main(){
	int n,i,j,k,m;
	cin>>n>>k;
	int h[n],dp[n];
	for(i=0;i<n;i++)cin>>h[i];
	dp[0]=0;
	dp[1]=abs(h[0],h[1]);
	for(i=2;i<n;i++){
		m=dp[i-1]+abs(h[i],h[i-1]);
		for(j=i-2;j>=i-k;j--){
			if (j<0) break;
			m=min(m,dp[j]+abs(h[i],h[j]));
		}
		dp[i]=m;
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
const long long mod = 1000000007;
//const long long mod = 998244353;


int main() {
	int N;
	scanf("%d", &N);
	printf("%d", (N + 1) / 2);
	return 0;
}

Measured memory_bytes: 128
//g++  7.4.0

#include <iostream>
#include<vector>
typedef long long ll ;
using namespace std;
ll minstep(ll i,vector <ll> &arr,ll k,vector <ll> &dp)
{
    if(i<=-1)
       return 999999999;  
    else if(i==0)
        return 0;
    else if(dp[i]!=999999999)
        return dp[i];
    else
        for (int j=i;j>0 && (i-j)<k  ;j--)
    {
            dp[i]=min(dp[i],ll(abs(arr[i]-arr[j-1])+minstep(j-1,arr,k,dp)));
    }
                //cout<<i<<" "<<dp[i]<<endl;
        return dp[i];
}

int main()
{
    int t;
    t=1;
    while(t--)
    {
        ll n,k;
        cin>>n;
        cin>>k;
        vector <ll> arr (n);
        vector <ll> dp (n,999999999);
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }

        cout<<minstep(n-1,arr,k,dp);
    }
}


Measured memory_bytes: 11136
/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
*/

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

bool bd[10005][4];
int dp[10005][5];

signed main() {
	int h,n;
	cin >> h >> n;
	REP (i,10005) {
		REP (j,4) {
			bd[i][j] = true;
		}
	}
	REP (i,n) {
		int x,y;
		cin >> x >> y;
		bd[y][x] = false;
	}
	FOR (i,1,h) {
		if (bd[i-1][0] && bd[i-1][1] && bd[i-1][2] && bd[i-1][3] &&
			  bd[i][0] &&   bd[i][1] &&   bd[i][2] &&   bd[i][3]) {
			dp[i][3] = max(dp[i][3],dp[i-1][0]+2);
		}
		if (bd[i-1][0] && bd[i-1][1] &&
			  bd[i][0] &&   bd[i][1]) {
			dp[i][1] = max(dp[i][1],max(dp[i-1][0],dp[i-1][2])+1);
		}
		if (bd[i-1][2] && bd[i-1][3] &&
			  bd[i][2] &&   bd[i][3]) {
			dp[i][2] = max(dp[i][2],max(dp[i-1][0],dp[i-1][1])+1);
		}
		if (bd[i-1][1] && bd[i-1][2] &&
			  bd[i][1] &&   bd[i][2]) {
			dp[i][4] = max(dp[i][4],dp[i-1][0]+1);
		}
		dp[i][0] = max({dp[i-1][0],dp[i-1][1],dp[i-1][2],dp[i-1][3],dp[i-1][4]});
	}
	int ans = 0;
	REP (i,5) {
		ans = max(ans,dp[h-1][i]);
	}
	cout << ans << endl;
}




Measured memory_bytes: 3532
#include <bits/stdc++.h>
#define HAIRETU(N,A) for(int i=0;i<N;i++) cin >>A[i]
using namespace std;

int ptr, ctr, res;

int main() {
    int N;
    cin >> N;
    
    map<int , int> mp;
    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        mp[a]++;
    }
    
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if ((itr->second) % 2 != 0) {
            ++res;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.{NumericRange, Queue}
import scala.collection.mutable
import scala.io.StdIn.readLine

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    println(math.min(sc.nextInt, sc.nextInt) + math.min(sc.nextInt, sc.nextInt))
  }

  def gcd(i: Long, j: Long): Long = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 25528