akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
    int n,m,a,b;
    scanf("%d%d",&n,&m);
    int count[n];
    for (int i=0; i<n; i++){
        count[i]=0;
    }
    for (int i=0; i<m; i++){
        scanf("%d%d",&a,&b);
        count[a-1]++;
        count[b-1]++;
    }
    for (int i=0; i<n; i++){
        if (count[i]%2!=0){
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    int n, m; cin >> n >> m;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    arr<int> d(n);

    // rep(i, n) d[i][i] = p[i];
    rep(i, m){
        int a, b; cin >> a >> b;
        a--; b--;
        d[a].push_back(p[b]);
        d[b].push_back(p[a]);
    }

    int ans = 0;
    rep(i, n){
        int t = p[i];
        bool flg = false;
        
        for(int s: d[i]){
            if(t <= s){
                flg = true;
                break;
            }
        }

        if(flg) continue;
        ans++;
    }
    pr(ans);
    return 0;}

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

int main(){
    int n , ans = 0;

    cin >> n;
    int d[n];

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

    for(int i = 0; i < n; i++){
        for (int j = i+1 ; j < n; j++){
            ans += d[i]*d[j];
        }
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
flags = [False] * n
ans = 0
for i in range(n):
    if a[a[i] - 1] - 1 == i and flags[a[i] - 1] == False:
        ans += 1
        flags[a[a[i] - 1] - 1] = True

print(ans)

Measured memory_bytes: 13880
import bisect


def main():
    N, M = list(map(int, input().split(' ')))
    from_1 = list()
    to_n = list()
    for _ in range(M):
        a, b = list(map(int, input().split(' ')))
        if a == 1:
            from_1.append(b)
        elif b == N:
            to_n.append(a)
    from_1.sort()
    for via in to_n:
        index = bisect.bisect_left(from_1, via)
        if index < len(from_1) and from_1[index] == via:
            print('POSSIBLE')
            return
    print('IMPOSSIBLE')


if __name__ == '__main__':
    main()

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

int main()
{
  int OH[4][3][10]={};
  int b,f,r,v,n;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>b>>f>>r>>v;
    OH[b-1][f-1][r-1]+=v;
  }
  for(int k=0;k<4;k++){
    for(int i=0;i<3;i++){
      for(int j=0;j<10;j++){
	cout<<" "<<OH[k][i][j];
      }
      cout<<endl;
    }
    if(k!=3)cout<<"####################"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:05-

            int n = sc.nextInt();
            int d = sc.nextInt();

            int range = 2 * d + 1;
            out.println((n + range - 1) / range);
        }
    }

}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> height{-100001};
    vector<int> count{0};

    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        if (a != height.back()) {
            height.push_back(a);
            count.push_back(1);
        } else {
            *(count.end() - 1) = count.back() + 1;
        }
    }

    int ans[5]{};

    if (height.size() > 3) {
        for (int i = 2; i < height.size() - 1; i++) {
            if (height[i - 1] < height[i] && height[i] > height[i + 1] && count[i] > 1) {
                //高原
                ans[0]++;
            } else if (height[i - 1] > height[i] && height[i] < height[i + 1] && count[i] > 1) {
                //盆地
                ans[1]++;
            } else if (height[i - 1] < height[i] && height[i] < height[i + 1] && count[i] > 1) {
                //山腹(登り)
                ans[2]++;
            } else if (height[i - 1] > height[i] && height[i] > height[i + 1] && count[i] > 1) {
                //山腹(降り)
                ans[2]++;
            } else if (height[i - 1] < height[i] && height[i] > height[i + 1] && count[i] == 1) {
                //峰
                ans[3]++;
            } else if (height[i - 1] > height[i] && height[i] < height[i + 1] && count[i] == 1) {
                //窪地
                ans[4]++;
            }
        }
    }

    cout << ans[0];
    for (int i = 1; i < 5; i++) {
        cout << " " << ans[i];
    }
    cout << endl;
}


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

using namespace std;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (a != b && a != c)
        cout << a;
    else if (b != a && b != c)
        cout << b;
    else
        cout << c;
}

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

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

int main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=0; i<n; i++){
		int a;
		cin>>a;
		a--;
		ans+=a;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;



int main(){
    ll n; cin >> n;
    string s;cin >> s;
    ll q; cin >> q;
    vector<ll> k(q);
    rep(i,q) cin >> k[i];
    auto f = [](auto a, auto b){
        return a + b;
    };
    
    rep(i,q){
        ll kt = k[i];
        ll cnt = 0;
        ll ans = 0;
        ll num = 0;
        ll d_num = 0, m_num = 0;
        rep(i,n){
            num++;
            if(s[i] == 'D')d_num++;
            if(s[i] == 'M'){
                m_num++;
                cnt += d_num;
            }
            if(num > kt){
                if(s[i-kt] == 'M')m_num--;
                if(s[i-kt] == 'D'){
                    d_num--;
                    cnt -= m_num;
                }
                num--;
            }
            if(s[i] == 'C')ans += cnt;
            // debug(i);debug(s[i]);debug(cnt);debug(ans);
        }
        cout << ans << endl;
    }
}

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 1e2 )+10;
const int MOD  = int( 360 );
const int oo   = INT_MAX;

ll dp[ MAXN ];

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif

  dp[0] = 2; dp[1] = 1;
  for( int i = 2; i < MAXN; ++i ) {
    dp[i] = dp[i-1] + dp[i-2];
  }
  int n;
  while( cin >> n ) {
    cout << dp[n] << '\n';
  }
  return 0;
}


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

using namespace std;

#define lli long long
#define ld long double
#define mod 1000000007 
#define set(n) cout << fixed << setprecision(n)    
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'

const double PI = acos(-1);
const double epsilon = 1e-7;  // floating point precision

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<lli> row(n);
    vector<lli> col(m);
    map<pll, bool> isBomb;
    int q;
    cin >> q;
    lli mxR = 0, mxC = 0;
    while(q --> 0) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        isBomb[{x, y}] = true;
        row[x]++; col[y]++;
        mxR = max(mxR, row[x]);
        mxC = max(mxC, col[y]);
    }
    vector<int> goodRows;
    vector<int> goodCols;
    for(int i = 0; i < n; i++) {
        if(row[i] == mxR) {
            goodRows.push_back(i);
        }
    }
    for(int j = 0; j < m; j++) {
        if(col[j] == mxC) {
            goodCols.push_back(j);
        }
    }
    for(int i = 0; i < goodRows.size(); i++) {
        for(int j = 0; j < goodCols.size(); j++) {
            if(!isBomb[{goodRows[i], goodCols[j]}]) {
                cout << mxR + mxC << endl;
                return 0;
            }
        }
    }
    cout << mxR + mxC - 1 << endl;
}



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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int x1, x2, x3, x4;
    int y1, y2, y3, y4;

    cin >> x1 >> y1 >> x2 >> y2;

    int dx, dy;
    dx = x2 - x1;
    dy = y2 - y1;

    x3 = x2 - dy;
    y3 = y2 + dx;
    x4 = x1 - dy;
    y4 = y1 + dx;

    cout << x3 << " " <<  y3 << " " << x4 << " " << y4 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define M 100

int main(){
  int i, j, N, minj, A[M],v,count=0;

  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj])
	minj=j;
    }
      v=A[i];
      A[i]=A[minj];
      A[minj]=v;
      if(i!=minj)
      count++;
  }
    printf("%d",A[0]);
      for(i=1;i<N;i++)
    printf(" %d",A[i]);
      printf("\n%d\n",count);






  return 0;
  }



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 
const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;

const int inf = 1<<29;
int n,a,b,c;
vector<int> l(10, 0);

int dfs(int cnt, int A, int B, int C){
    if(cnt == n){
        if(A != 0 && B != 0 && C != 0){
            return abs(a-A) + abs(b-B) + abs(c-C) - 30;
        }
        else return inf;
    }

    int res = inf;
    chmin(res, dfs(cnt+1, A+l[cnt], B, C)+10);
    chmin(res, dfs(cnt+1, A, B+l[cnt], C)+10);
    chmin(res, dfs(cnt+1, A, B, C+l[cnt])+10);
    chmin(res, dfs(cnt+1, A, B, C));

    return res;
}

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

    cin >> n >> a >> b >> c;
    for(int i=0; i<n; ++i) cin >> l[i];
    
    cout << dfs(0, 0, 0, 0) << endl;
    
    return 0;
}

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

signed main(){
  int N,M;
  cin>>N>>M;
  int A[50];
  for(int i=1;i<=50;i++)A[i]=0;
  rep(i,M){
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=N;i++){
      if(i==a||i==b)A[i]+=1;
    }
  }
  for(int i=1;i<=N;i++)cout<<A[i]<<endl;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

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

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

  LCIN(N);
  ll ans = 0ll;
  REP(i, MAX_N) {
    if ((ll)i * (ll)i > N) break;
    ans = i * i;
  }

  cout << ans << endl;

  return 0;
}



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

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n,m;string s;
// cin>>t;
// while(t--){
cin>>n;
m=ceil(double(n)/double(1000));
cout<<abs(n-(m*1000))<<endl;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int i=0;
  int j=0;
  int k=B-A+1;
	for(i=0;i<k;i++){
     int N=A+i;
      if(N%10==N/10000 && ((N%100)-(N%10))/10==N/1000-(N/10000)*10){
     j++;}
    }
  cout<<j<<endl;
}



Measured memory_bytes: 3636
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

####

from collections import defaultdict as ddic


s = rr()
if s.isupper():
    print 'A'
else:
    print 'a'


Measured memory_bytes: 64840
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    a, b, t = get_li()
    print((t // a) * b)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6036
#include <iostream>

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

    if(n % 2 == 1) {
        std::cout << (double)((n / 2) + 1) / (double)n << std::endl;
    } else {
        std::cout << (double)(n / 2) / (double)n << std::endl;
    }
}


Measured memory_bytes: 256
W = input().upper()
ans = 0
while True:
    T = input()
    T_list = T.split(" ")
    for T_current in T_list:
        if T_current == "END_OF_TEXT":
            break
        if T_current.upper() == W:
            ans += 1
    if T_current == "END_OF_TEXT" :
        break
print(ans)



Measured memory_bytes: 5552
#include <stdio.h>
int main()
{
  char s[100001];
  char a[256] = {0};
  scanf("%s",&s);
  int i = 0;
  while (s[i])
  {
    a[s[i]]++;
    i++;
  }
  i = 0;
  while (i < 256)
  {
    if (i >= 'a' && i <= 'z' && a[i] == 0)
    {
      printf("%c",i);
      return (0);
    }
    i++;
  }
  printf("None");
}

Measured memory_bytes: 1712
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <time.h>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long func(long long a,long long b){
    return a/b;
}

int main(){
    long long W,H,x,y; cin >> W >> H >> x >> y;
    bool flg;
    if (2*x == W && 2*y == H){
        flg = true;
    } else {
        flg = false;
    }
    cout << fixed << setprecision(10) << (double)W*H/2 << " " << (flg ? 1 : 0) << endl;
}





Measured memory_bytes: 384
txt = input()
txt_list = list(txt)

count = 0
n_b = 0
n_w = 0
i = 0
for i in range(len(txt_list)):
    if txt_list[i] == 'W':
        n_w += 1
    if (i>=1 and txt_list[i-1] == 'W' and txt_list[i] == 'B') or (i==len(txt_list)-1 and txt_list[i] == 'W'):
        count += n_b * n_w
        n_w = 0
    if txt_list[i] == 'B':
        n_b += 1

print(count)

Measured memory_bytes: 4840
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    string n;
    cin >> n;
    REP(i,n.size()){
        if(n[i]=='7'){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 3600
n,m=map(int,input().split())
l=[input().split() for i in range(m)]
l=[[int(i) for i in j] for j in l]
ans=list(range(1,n+1))
d=dict(zip(ans,[0]*n))

for j in ans:
  for i in l:
    if i[0]==j or i[1]==j:
      d[j]+=1
for i in d:
  print(d[i])



Measured memory_bytes: 38512
n,m=map(int,input().split())
a=list(map(int,input().split()))
sums=sum(a)
hh=1/(4*m)
a.sort(reverse=True)
ans=0
for i in a:
  if hh<=i/sums:
    ans+=1
  else:
    break
if ans>=m:
  print("Yes")
else:
  print("No")
    

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  int max =0;
  if(A>=B && B>=C) max=A*10+B+C;
  if(A>=C && C>=B) max=A*10+B+C;
  if(B>=A && A>=C) max=B*10+A+C;
  if(B>=C && C>=A) max=B*10+A+C;
  if(C>=A && A>=B) max=C*10+A+B;
  if(C>=B && B>=A) max=C*10+A+B;
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
s = list(map(int,input().split()))
count = 0
 
def merge(a, left, mid, right):
    global count
    l = a[left:mid] + [float("inf")]
    r = a[mid:right] + [float("inf")]
    i = j = 0
    for k in range(left, right):
        if l[i] <= r[j]:
            a[k] = l[i]
            i += 1
        else:
            a[k] = r[j]
            j += 1
            count += len(l) - i - 1
def mergeSort(a, left, right):
    if left + 1 < right:
        mid = right + (left - right)//2
        mergeSort(a, left, mid)
        mergeSort(a, mid, right)
        merge(a, left, mid, right)
 
mergeSort(s, 0, n) 
print(count)


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

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

int main(){
	int N, M;
	cin >> N >> M;
	int a;
	rep(i, M) {
		cin >> a;
		N -= a;
	}
	if (N < 0) cout << -1 << endl;
	else cout << N << endl;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

string str(int x) {
  string ret = "00";
  ret[0] += x / 10;
  ret[1] += x % 10;
  return ret;
}

int main() {
  in(string, s);
  bool yymm = false, mmyy = false;
  for (int year = 0; year <= 99; ++year) {
    for (int month = 1; month <= 12; ++month) {
      if (str(year) + str(month) == s) yymm = true;
      if (str(month) + str(year) == s) mmyy = true;
    }
  }
  if (yymm && mmyy) {
    out("AMBIGUOUS");
  } else if (yymm) {
    out("YYMM");
  } else if (mmyy) {
    out("MMYY");
  } else {
    out("NA");
  }
}


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

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

ll r,c,a1,a2,b1,b2;
const ll mod = 1e8+7;

ll combi[3000][3000];

void combi_pre_compute(ll n) {
    for(int i = 0;i <= n;i++) combi[0][i] = (i == 0);
    for(int i = 1;i <= n;i++ ) {
        for(int j = 0;j <= i;j++) {
            combi[i][j] = (combi[i - 1][j] + combi[i - 1][j - 1]) % mod;
        }
    }
}

int main() {
    cin >> r >> c >> a1 >> a2>>b1>>b2;
    combi_pre_compute(r+c);

    ll dr = abs(a1 - b1);
    ll dc = abs(a2 - b2);

    dr = min(dr,r - dr);
    dc = min(dc,c - dc);

    if(dr == r - dr && dc == c - dc) {
        cout << 4 * combi[dr + dc][dr] % mod << endl;
    }else if(dr == r - dr || dc == c - dc) {
        cout << 2 * combi[dr + dc][dr] % mod << endl;
    }else {
        cout << combi[dr + dc][dr] % mod << endl;
    }
}


Measured memory_bytes: 26752
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(){
ll A,N;
cin>>N;
bool APPROVED = true;
for(ll i=0 ; i<N ; i++){
  cin>>A;
  if((A%2==0) && ((A%3!=0) && (A%5!=0))){
    APPROVED = false ;
  }
}if(APPROVED){
  cout<<"APPROVED"<<endl;
}else{
  cout<<"DENIED"<<endl;
}
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int pasta[]=new int[3];
		int juice[] = new int [2];
		for(int i=0;i<3;i++)pasta[i]=in.nextInt();
		for(int i=0;i<2;i++)juice[i]=in.nextInt();
		int p=0,j=0;
		for(int i=1;i<3;i++){
			if(pasta[i]<pasta[p])p=i;
		}
		for(int i=1;i<2;i++){
			if(juice[i]<juice[j])j=i;
		}
		int ans = pasta[p]+juice[j]-50;
		System.out.println(ans);
		
	}

}

Measured memory_bytes: 17232
def solve(a):
    abs_a = [abs(ai) for ai in a]
    ans = sum(abs_a)

    if len([ai for ai in a if ai < 0]) % 2:
        ans -= min(abs_a) * 2

    return ans


if __name__ == '__main__':
    int(input())
    a = list(map(int, input().split()))

    print(solve(a))


Measured memory_bytes: 14412
# DP_動的計画法の基本プロセス

import sys
input = sys.stdin.readline
n = int(input())
h = tuple(map(int,input().split())) # 1_データベースを取得, 後で作業し易い形が良い

dp = [0]*n # 2_DP枠を生成, 問題により２次元以上の複雑な構造もある
#print(dp)

dp[1] = abs(h[1]-h[0]) # 3_最初の固定部分を代入
#print(dp)

for i in range(2,n): # 4_アルゴリズムに従いデータを生成, DP枠を埋める
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
#print(dp)

print(dp[-1]) # 5_DP枠の必要部分を出力


Measured memory_bytes: 14236
D, G = map(int,input().split())
table = []
ans = 0

for i in range(D):
    p,c = map(int,input().split())
    ans += p
    table.append((p,c))


for i in range(2**D):
    score = 0
    n = 0
    solved = [0] * D
    for j in range(D):
        if i>>j & 1:
            p,c = table[j]
            solved[j] = 1
            score += 100*(j+1)*p+c
            n += p
    if score<G:
        for k in range(D-1,-1,-1):
            if solved[k] == 0:
                p = table[k][0]
                for l in range(1,p):
                    score += 100*(k+1)
                    n += 1
                    if score>=G:
                        break
                break

    if score>=G:
        ans = min(n,ans)
print(ans)

Measured memory_bytes: 9236
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,ans,j,k,m=1000000007;
    scanf("%lld",&n);
    long long a[n+4],sum[n+4];
    for(i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    sum[n]=0;
    for(i=n-1;i>0;i--){
        sum[i]=a[i+1]+sum[i+1];
        sum[i]%=m;
    }
    ans=0;
    for(i=1;i<n;i++){
        k=a[i]*sum[i];
        k%=m;
        ans=(ans+k+m)%m;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 6932
n=int(input())

s=list(map(int,input().split()))
sum=0
for i in range(n):
  sum+=s[i]
  
  
m=int(input())

ans=0

for j in range(m):
  p,x=map(int,input().split())
  ans=sum-s[p-1]+x
  print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

using namespace std;


int main() {
	string S;
	int K, N;
	cin >> S >> K;
	N = S.length();
	vector<string> Subs;
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j < N - i + 1; j++) {
			string sub = S.substr(j, i);
			Subs.push_back(sub);
		}
	}
	sort(Subs.begin(), Subs.end());
	Subs.erase(unique(Subs.begin(), Subs.end()), Subs.end());
	cout << Subs[K - 1] << endl;
}

Measured memory_bytes: 1660
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;



void solve() {
	vector<int>a(5);
	REP(i, 5) {
		cin >> a[i];
		if (a[i] == 0) {
			print(i + 1);
		}
	}
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//mt.seed((int)(time(0)));
	//REP(_, 10000)test();
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<limits>
#include<list>
#include <stdio.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n); ++i)
#pragma GCC optimize("Ofast")



int main() {
	ll n, d;
	cin >> n >> d;
	ll dd = d * d;
	ll count=0;
	rep(i,n){
		ll x, y;
		cin >> x >> y;
		ll p = x * x + y * y;
		if (p <= dd)count++;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
 
using namespace std;
long long n,a[10001],b[10001]={0},c=0,s=0;
int main()
{
	   
cin >> n;
for(int i=0;i<n;i++)
{
	cin >> a[i];
 
}
for(int i=0;i<n;i++)
{
		if(a[i]>=1 && a[i]<400)
	b[1]++;
else	if(a[i]>=400 && a[i]<800)
	b[2]++;
else	if(a[i]>=800 && a[i]<1200)
	b[3]++;
else	if(a[i]>=1200 && a[i]<1600)
	b[4]++;
else	if(a[i]>=1600 && a[i]<2000)
	b[5]++;
else	if(a[i]>=2000 && a[i]<2400)
	b[6]++;
else	if(a[i]>=2400 && a[i]<2800)
	b[7]++;
else	if(a[i]>=2800 && a[i]<3200)
	b[8]++;
else if(a[i]>=3200)
	b[9]++;
}
 
for(int i=1;i<=8;i++)
{
	if(b[i]==0)
	continue;
	if(b[i]>=1)
	c++;
}
if(c==0 && c+b[9])
cout<<1<<" "<<c+b[9];
else
cout<<c<<" "<<c+b[9];

 
}

Measured memory_bytes: 256
import copy

def calc_bits(nums, bits):
    nums = copy.deepcopy(nums)
    num0 = nums.pop(0)
    result = num0
    formula = str(num0)
    for num, bit in zip(nums, bits):
        if bit == 0:
            result -= num
            formula += '-' + str(num)
        else:
            result += num
            formula += '+' + str(num)
    formula += '=' + str(result)
    if result == 7:
        return formula
    return None

nums = list(map(int, list(input())))

bits_list = []
for i in range(8):
    bits = []
    for j in range(2, -1, -1):
        bit = (i >> j) & 1
        bits.append(bit)
    bits_list.append(bits)

for bits in bits_list:
    result = calc_bits(nums, bits)
    if result:
        print(result)
        break


Measured memory_bytes: 3444
n=int(input())
s=[0]+[int(input())for i in range(n)]
t=s[1]
k=1
while n:
    if t==2:
        print(k)
        break
    elif t==0:
        print(-1)
        break
    else:
        a=s[t]
        s[t]=0
        t=a
        k+=1

Measured memory_bytes: 7852
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const int MOD = 1e9+7;
vector <int> idx[200005];
int dp[200005];

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

    int n;
    cin >> n;

    int c[n];
    vector <int> prev(n, -1);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        int sz = idx[c[i]].size();
        if (sz) prev[i] = idx[c[i]][sz - 1];
        idx[c[i]].push_back(i);
    }

    dp[0] = 1;
    for (int i = 1; i < n; i++) {
        dp[i] = dp[i-1];

        if (c[i] != c[i-1] && prev[i] != -1) {
            (dp[i] += dp[prev[i]]) %= MOD;
        }
    }

    cout << dp[n-1] << "\n";
    return 0;
}

Measured memory_bytes: 13568
import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];
	static int ans = 0;
	static long n = 0;





	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int t = sc.nextInt()*1000;
		int a = sc.nextInt()*1000;
		int[] h = new int[n];
		for(int i= 0;i < n;i++){
			h[i] =sc.nextInt();
		}
		long ans = 1000000000;
		int num = 0;
		for(int i=0;i < n;i++){
			int k = t - h[i] * 6;
			long m = ans;
			ans = Math.min(ans, Math.abs(a-k));
			if(m!=ans){
				num = i;
			}
		}
		
		System.out.println(num+1);



	}
}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#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 _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  int n;cin>>n;
  int a[n]; rep(i, n){ cin>>a[i]; }
  sort(a,a+n);

  int d = INF;
  int p;
  rep(i, n-1){
    if (abs(a[n-1]-2*a[i])<d){
      p = a[i];
      d = abs(a[n-1]-2*a[i]);
    }
  }
  dump(a[n-1], p);
  cout << a[n-1] << " " << p << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 1024
//\\//\\ * * * //\\// ||
#include <bits/stdc++.h> 

#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << '\n';
  return 0;
}


Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var A = ReadSplitLong();

            var list = A.GroupBy(x => x).Where(y => y.Count() >= 2).OrderByDescending(x => x.Key).ToList();
            if (list.Count == 0)
            {
                Println(0);
                return;
            }

            if (list[0].Count() >= 4)
                Println(list[0].Key * list[0].Key);
            else
                Println(list[0].Key * list[1].Key);
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 37964
n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)

(0...(n - k)).each { |i|
  # i番目とk+i番目を比較
  puts a[i] < a[k + i] ? "Yes" : "No"
}

Measured memory_bytes: 35988
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string s; cin >> s;
    char right_color=s[s.size()-1];
    int ans=0;
    for(int i=s.size()-1; i>=0; i--){
        if(s[i]!=right_color){ ans++; right_color=s[i]; }
    }
    cout << ans << endl;
}

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

vector<int> string_to_bigint(string S) {
    int N = S.size(); // N = (文字列 S の長さ)
    vector<int> digit(N);
    for(int i = 0; i < N; ++i) {
        digit[i] = S[N - i - 1] - '0'; // 10^i の位の数
    }
    return digit;
}

int main() {
  string S;
  cin >> S;
  int t = 0;
  vector<int> A = string_to_bigint(S);
  for(int i = 0; i < S.size(); i++){
    t += A.at(i);
  }
  
  if(t % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 4516
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

int main() {
  long long x;
  cin >> x;
  long long money = 100;
  long long count = 0;
  while(money < x) {
    count++;
    money *= 1.01;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3624
import collections
N = int(input())
A = list(map(int, input().split()))

#i + Ai
plus = [0] * N
#i - Ai
minus = [0] * N

for i in range(N):
  plus[i] = i + 1 + A[i]
  minus[i] = i + 1 - A[i]
  
#print(plus, minus)  
plus = dict(collections.Counter(plus))
minus = dict(collections.Counter(minus))

#print(plus)
#print(minus)

ans = 0
for i in plus.keys():
  #print(i)
  if i in minus:
    #print(i)
    ans += plus[i] * minus[i]
    #print(ans)

print(ans)


Measured memory_bytes: 72336
n=int(input())
s=input()
prew=[0]*(n+1)
sufw=[0]*(n+1)
for i in range(1,n+1):
    prew[i]+=prew[i-1]
    if(s[i-1]=='W'):
        prew[i]+=1
for i in range(n-1,-1,-1):
    sufw[i]+=sufw[i+1]
    if(s[i]=='W'):
        sufw[i]+=1

ans = n-1-sufw[1]

for i in range(1,n-1):
    ans = min(ans,prew[i]+(n-i-1-sufw[i+1]))

ans=min(ans,prew[n])

print(ans)


Measured memory_bytes: 28944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    char b;
    cin >> b;
    if(b=='A'){
        cout << 'T' << endl;
    }
    else if(b=='T'){
        cout << 'A' << endl;
    }
    else if(b=='G'){
        cout << 'C' << endl;
    }
    else{
        cout << 'G' << endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define mp make_pair
#define v vector
#define inp_push(no, v) \
    ll no;              \
    cin >> no;          \
    v.push_back(no);
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define N 200005
#define mod 1000000009
#define INF INT64_MAX

//////////////////////////IMPORTANT FUNCTIONS/////////////////////////////////////////////

/* Guidlines berfore submitting solution
1. Check N value before submitting
2. Check all constant kind of values you are using. Might give WA. Think
3. Check mod value
*/

v<ll> fact(N);
v<ll> prime_check(1e7 + 2);
v<ll> primes;

long long powmod(long long x, long long y, long long m)
{
    long long res = 1LL;
    while (y)
    {
        if (y & 1)
            res = (res * x) % m;
        x = (x * x) % m;
        y /= 2;
    }
    return res;
}

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

ll C(ll n, ll r)
{
    if (n < r)
        return 0;
    ll temp = fact[n] * powmod(fact[r], mod - 2, mod) % mod;
    temp *= powmod(fact[n - r], mod - 2, mod);
    temp %= mod;
    return temp;
}

void Sieve()
{
    for (ll i = 2; i <= 1e7 + 1; i++)
    {
        if (prime_check[i])
            continue;
        primes.pb(i);
        for (ll j = 2 * i; j <= 1e7 + 1; j += i)
            prime_check[j] = i;
    }
}
ll phi(ll n)
{
    ll i, res = n;
    for (i = 2; i * i <= n; i++)
        if (n % i == 0)
        {
            while (n % i == 0)
                n /= i;
            res -= res / i;
        }
    if (n > 1)
        res -= res / n;
    return res;
}

/////////////////////////////////////START CODE HERE/////////////////////////////////////////////

ll n, q, sum;
v<ll> a(N), c(N);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // init_fact();
    // Sieve();
    cin >> n;
    for (ll i = 1; i <= n; i++)
        cin >> a[i], c[a[i]]++, sum += a[i];
    cin >> q;
    while (q--)
    {
        ll x, y;
        cin >> x >> y;
        ll count = c[x];
        c[x] = 0;
        c[y] += count;
        sum = sum - count * x + count * y;
        cout << sum << "\n";
    }
}

Measured memory_bytes: 85968
n,m=gets.split.map(&:to_i)
edges=Array.new(n){Array.new}
visited=Array.new(n)
coord=Array.new(n)
flag=true
m.times{
  l,r,d=gets.split.map(&:to_i)
  l-=1
  r-=1
  edges[l] << [r,d]
  edges[r] << [l,-d]
}
color=0
n.times{|i|
  next if visited[i]
  color+=1
  coord[i]=0
  q=[i]
  until q.empty?
    k=q.shift
    next if visited[k]
    c=coord[k]
    edges[k].each{|p,d|
      if coord[p]
        if c-coord[p]!=d
          flag=false
          break
        end
      else
        coord[p]=c-d
      end
      if visited[p]
      else
        q.push p
      end
    }
    visited[k]=color
    break unless flag
  end
  break unless flag
}
puts flag ? "Yes" : "No"

Measured memory_bytes: 52092
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N == 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].remove(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == {}:
			
			break
			exit()
		i += 1
	print(len(list(foods)))





Measured memory_bytes: 3064
#include <cstdio>
 using namespace std;

int main(){
    int a, hour, b, minute, second;
	scanf("%d", &a);
	hour = a / 3600;
        b = a % 3600;
	minute = b / 60;
        second = b % 60;
	printf("%d:%d:%d\n",hour, minute, second);
    return 0;
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  vector<vector<int> > f(n + 1, vector<int> (n + 1, 0));
  f[0][0] = 1;
  const int mod = 1000000007;
  for(int i = 1; i < n; i++){
  	vector<int> p(n + 1);
    int sum = 0;
    for(int j = 0; j <= n; j++){
      sum += f[i - 1][j];
      if(sum >= mod) sum -= mod;
      p[j] = sum;
    }
    auto get = [&](int l, int r){
      if(l > r) return 0;
      int res = p[r];
      if(l) res = res + mod - p[l - 1];
      if(res >= mod) res -= mod;
      return res;
    };
    for(int j = 0; j <= i; j++){
      if(s[i - 1] == '>'){
        f[i][j] = get(j, i);
      } else {
        f[i][j] = get(0, j - 1);
      }
    }
  }
  int ans = 0;
  for(int i = 0; i < n; i++){
    ans += f[n-1][i];
    if(ans >= mod) ans -= mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35584