akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll ans;
    bool f=true;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==0){
            f=false;
            ans=0;
        }
    }
    if(f){
        ans=1;
        for(ll i=0;i<n;i++){
            if(ans>1000000000000000000/a[i]){
                ans=-1;
                break;
            }
            ans*=a[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4048
# 入力
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

# NがK以下ならN泊×X円、NがKより大きいなら(K泊×X円)+((N-K)×Y円)
if N <= K:
    print(N * X)
elif N > K:
    print(K * X + (N - K) * Y)


Measured memory_bytes: 9076
//116 B - Collatz Problem 2019/1/20
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int f(int x){
    if(x%2==0) return x/2;
    else return 3*x+1;
}

int main(){
    int s;
    cin >> s;
    vector<int> a(1000000);
    a[0]=s;
    for(int i=1;i<1000000;++i){
        a[i]=f(a[i-1]);
    }
    rep(i ,100){
        for(int j=i+1;j<100;++j){
            if(a[i]==a[j]) { cout << j+1 << endl; return 0; }
        }
    }
    rep(i ,1000000){
        if(a[i-2]==4 && a[i-1]==2 && a[i]==1) {cout << i+2 << endl; return 0;}
    }
}

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

a = list(map(int, input().split()))
z = []
for i in a:
  if i % 2 == 0:
    z.append(i)


if all(j % 3 == 0 or j % 5 == 0 for j in z):
  print("APPROVED")
else:
  print("DENIED")
    

Measured memory_bytes: 9064
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> init(int size){
  vector<int> par(size,-1);
  return par;
}

int root(int x, vector<int>& par){
  if(par[x] < 0){
    return x;
  }else{
    return par[x] = root(par[x],par);
  }
}

bool same(int x, int y, vector<int>& par){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, vector<int>& par){
  x = root(x, par), y = root(y, par);
  if(same(x,y, par))return;
  par[x] += par[y];
  par[y] = x;
}

int size(int x, vector<int>& par){
  return -par[root(x, par)];
}

int pow(int x, int n){
  if(n == 0)return 1;
  if(n % 2 == 0)return pow(x * x % MOD, n/2);
  else return x * pow(x, n-1) % MOD;
}

signed main(){
  int n;cin>>n;
  //int ans = pow(4, n);cout << ans << endl;
  int aa = 0, cc = 1, gg = 2, tt = 3;
  int dp[4][4][4][4][100];
  rep(a,4)rep(b,4)rep(c,4)rep(d,4)rep(e,100)dp[a][b][c][d][e] = 0;
  rep(i,4)dp[3][3][3][i][0] = 1;
  repd(i,1,n){
    rep(a,4){
      rep(b,4){
        rep(c,4){
          rep(d,4){
            if(d == cc && ((c==gg&&b==aa)||(c==aa&&b==gg)||(c==gg&&a==aa)||(b==gg&&a==aa)))continue;
            if(b == aa && c == cc && d == gg)continue;
            rep(j,4){
              dp[a][b][c][d][i] = (dp[a][b][c][d][i]+dp[j][a][b][c][i-1])%MOD;
            }
          }
        }
      }
    }
  }
  int ans = 0;
  rep(a,4)rep(b,4)rep(c,4)rep(d,4)ans = (ans+dp[a][b][c][d][n-1])%MOD;
  cout << ans << endl;
}


Measured memory_bytes: 384
//q1.cpp

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

typedef long long ll;

using namespace std;


int main(){
    int a,b,c,d,p,x,y;
    
    scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
    
    x=a*p;
    
    if(p<=c)
        y=b;
    else
        y=b+(p-c)*d;
    
    printf("%d\n",min(y,x));
    return 0;
}

Measured memory_bytes: 1188
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
constexpr long long LINF = 1000100010001000100LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() { 
    ll x; cin >> x;
    ll res = 0;
    res += (x/11)*2;
    if(x%11>0 and x%11<7)res++;
    else if(x%11>=7)res +=2;
    cout << res << ln;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> enemy(N);
  for(int i = 0; i < N; ++i) cin >> enemy[i];
  sort(enemy.begin(), enemy.end());
  int remain = N - K;
  if(remain <= 0){
    cout << "0" << endl;
    return 0;
  }
  long long ans = 0;
  for(int i = 0; i < remain; ++i) ans += enemy[i];
  cout << ans << endl;
}

Measured memory_bytes: 1024
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Sun Mar 11 21:29:42 2018
//
package main

import (
	"fmt"
)

var N, M int

func main() {
	fmt.Scan(&N, &M)

	var count int
	if N == 1 && M == 1 {
		count = 1
	} else if N == 1 {
		count = M - 2
	} else if M == 1 {
		count = N - 2
	} else {
		count = (N - 2) * (M - 2)
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

x, y = MAP()

if any(x in k and y in k for k in [A, B, C]):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 5200
#include<iostream>
using namespace std;
int main()
{
  int w,x=0;
  cin>>w;
  while(w!=-1){
    if(w<=10){
      x=1150;
    }else if(w>10&&w<=20){
      x=1150+(w-10)*125;
    }else if(w>20&&w<=30){
      x=1150+10*125+(w-20)*140;
    }else{
      x=1150+10*125+10*140+(w-30)*160;
    }
    cout<<4280-x<<'\n';    
    cin>>w;
  }
  return(0);
}



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

int main(){
        long long int  X,Y;
        cin>>X>>Y;
        long long a = Y/X;
        long long int c=1;
        int ans=0;
        for(int i=1;  c<=a; ++i){
                c*=2;
                ans=i;
        }
        cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n;
int32_t main(){
CODE_START;
cin>>n;
ll x=100;
ll s1=0;
while(x<n){
    x=x+x/100;
    s1++;
}
cout<<s1<<endl;
}


Measured memory_bytes: 3640
N,x= map(int, input().split())
Alist = list(map(int, input().split())) 
res = 0
if Alist[0] >x:
    res = Alist[0]-x
    Alist[0] = x
    
for i in range(0,N-1):    
    if Alist[i] + Alist[i+1] > x:
        de = Alist[i+1] + Alist[i] - x
        Alist[i+1] = Alist[i+1] - de
        res = res + de 

print(res)

Measured memory_bytes: 14052
from collections import defaultdict
s = input()
di = defaultdict(int)
ans = float('inf')
for i in s:
    di[i]+=1
if(len(di)==1):
    print(0)
else:
    for i in di:
        cnt = 0
        now_s = s
        for _ in range(len(s)):
            next_s = ''
            flag = True
            for ind,ss in enumerate(now_s[:-1]):
                if(ss==i or now_s[ind+1]==i):
                    next_s+=i
                else:
                    flag = False
                    next_s+=ss
            cnt+=1
            if(flag):
                break
            else:
                now_s=next_s
        ans = min(cnt,ans)
    print(ans)


Measured memory_bytes: 3316
from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    x_arr = list(map(int, _in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    for i,x in enumerate(x_arr):
        if x==0:
            ans = i+1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 61672
#include "bits/stdc++.h"
using namespace std;

#define ul unsigned long 
#define ull unsigned long long
#define li long long int

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

  string ans="No";
  for (ul i=1;i<=9;i++) for (ul j=1;j<=9;j++) {
    if (n==i*j) {
      ans="Yes";
    }    
  } ; 

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


Measured memory_bytes: 256
import heapq
def set_heapq(que, edge, used, v, add_dist=0):
    '''
    確定地点vからつながる辺を全てqueに設定し、返却する

    Parameters
    que : heapque(touple or list)
        辺を管理するキュー (距離、次の行き先)のtopuleまたはlistにて管理
    edge : list
        全ての辺を格納する二次元のリスト edge[0]にてノード0から伸びる辺であることを表し、
        edge[0] → [距離、次の行き先] を表すlistが格納されている
    v : int
        グラフ上のノード ダイクストラでは確定したノードがvにあたる
    add_dist : int
        確定した地点に足し合わせる距離 スタート地点以外では何かしらの値が追加されることになる

    Returns
    que : heapque(touple or list)
        引数queにvからつながる辺を追加したキュー
    '''
    for a,b in edge[v]:
        if used[b]:
            heapq.heappush(que,(a+add_dist,b))
    return que

def dijkstra_heap(n, s, edge):
    '''
    ダイクストラ法でsで指定された地点からの全てのノードまでの最短距離を返却
    
    Parameters
    n : int
        ノードの数
    s : int
        スタート地点
    edge : list
        全ての辺を格納する二次元のリスト edge[0]にてノード0から伸びる辺であることを表し、
        edge[0] → [距離、次の行き先] を表すlistが格納されている

    Returns
    d : list
        スタート地点から全てのノードの最短距離のリスト
    '''
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s], used[s] = 0, False
    edgelist = set_heapq([], edge, used, s)
    while len(edgelist):
        a, b = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[b]:
            continue
        d[b], used[b] = a, False
        # 確定地点vからつながる辺を全て優先度付きキューに入れる
        edgelist = set_heapq(edgelist, edge, used, b, d[b])
    return d

N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
edge = [[] for _ in range(N)]
for i in range(N-1):
    x, y = i, i+1
    edge[x].append((1, y))
    edge[y].append((1, x))

edge[X].append((1, Y))
edge[Y].append((1, X))

tmp = []
for i in range(N):
    tmp.append(dijkstra_heap(N, i, edge))

#print(tmp)
ans = []
for i in range(N):
    for j in range(i+1,N):
        ans.append(tmp[i][j])

from collections import Counter
c = Counter(ans)
for i in range(1, N):
    print(c[i])


Measured memory_bytes: 203348
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    string str;
    cin >> str;
    if(str == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<stack>
using namespace std;
#define NIL -999
bool mark[105][105];
int n;
int tm = 0;
int d[105] = { 0 };
int f[105] = { 0 };

inline int next(int i) {
	for (int tmp = 1; tmp <= n; ++tmp) {
		if (mark[i][tmp] && !d[tmp]) {
			//cout << endl << i << "的下一个节点是：" << tmp << endl;
			return tmp;
		}
	}
	//cout << endl << i << "的下一个节点是：" << NIL << endl;
	return NIL;
}

void dfs_IN(int i) {
	stack<int> s;
	int now = i, nt;
	d[i] = ++tm;
	s.push(i);
	//	s.push(i);
	//	d[i] = ++tm;
	//first solution
	/*do {
		//		cout<<"visit: "<<now<<endl;
		if (!s.empty()) {
			now = s.top();
			s.pop();
		}
		do {
			//cout << "visit: " << now << endl;
			nt = next(now);
			if (nt != NIL && !d[nt]) {
				s.push(now);
				d[nt] = ++tm;
				now = nt;
			}
			else break;
		} while (true);
		//cout << "end visit:  " << now << endl;
		f[now] = ++tm;
		
	} while (!s.empty());*/
	//solution 2
	while (!s.empty()) {
		now = s.top();
		nt = next(now);
		if (nt != NIL) {
			d[nt] = ++tm;
			s.push(nt);
		}
		else {
			s.pop();
			f[now] = ++tm;
		}
	}
}

void dfs() {
	for (int i = 0; i <= n + 2; ++i)
		for (int k = 1; k <= n + 2; ++k)
			mark[i][k] = false;

	int Node, k, tmp;
	cin >> n;
	for (int l = 0; l<n; l++) {
		cin >> Node >> k;
		for (int x = 0; x<k; x++) {
			cin >> tmp;
			mark[Node][tmp] = true;
		}
	}

	for (int p = 1; p <= n; ++p)
		if(!d[p])dfs_IN(p);

	for (int p = 1; p <= n; ++p)
		cout << p << ' ' << d[p] << ' ' << f[p] << endl;

}

int main() {

	dfs();
	return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;
typedef long long ll;

int main()
{
    int n,a,b;
    cin>>n>>a>>b;

    cout<<min(n*a,b)<<endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
MOD = 10**9 + 7

chars = [1] * 30

for s in S:
    chars[ord(s)-97] += 1
    
#print(chars)

res = 1
for c in chars:
    res = (res*c)%MOD
res = (res-1)%MOD

print(res)


Measured memory_bytes: 3188
n,m=map(int,input().split())
LR=[list(map(int,input().split())) for _ in range(m)]
l,r=LR[0]
ans=r-l+1
for i in range(1,m):
  if l < LR[i][0]:
    l=LR[i][0]
  if r > LR[i][1]:
    r=LR[i][1]
  if l<=r:
    ans=r-l+1
  else:
    ans=0
print(ans)



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

int main()
{
    ll N;

    cin >> N;

    vector<ll> A = vector<ll>(N);

    rep(i, 0, N){
        cin >> A[i];
    }

    ll prev = 0;

    ll ans = 0;

    rep(i, 0, N){
        ll a = A[i];

        if (a < prev){
            ll t = prev - a;
            ans += t;
            a += t;
        }

        prev = a;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 4824
s = input()
chrs = 'abcdefghijklmnopqrstuvwxyz'

p1 = (s[0] == 'A')
p2 = (s[2:-1].count('C') == 1)
p4 = (s[1] in chrs)
p5 = (s[-1] in chrs)

p3 = True
C_found = False
for i in range(2, len(s) - 1):
    if not(s[i] in chrs):
        if (s[i] == 'C'):
            if C_found:
                p3 = False
                break
            else:
                C_found = True
        else:
            p3 = False
            break
        
if p1 and p2 and p3 and p4 and p5 and C_found:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve():
  A, B = map(int, input().split())
  return len(set(prime_factorize(gcd(A, B)))) + 1

print(solve())

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> num(n);
  vector<int> str(n);
  for(int i = 0;i < n;i++) cin >> num[i];
  str = num;
  sort(str.begin(),str.end());
  int ave1 = str.at(n/2-1);
  int ave2 = str.at(n/2);
  for(int i = 0;i < n;i++){
    if(num[i] <= ave1) cout << ave2 << endl;
    else cout << ave1 << endl;
  }
}
  

Measured memory_bytes: 3712
#include <algorithm>
#include <iostream>
#include <cctype>
#include <vector>
#include <string>
using namespace std; 
int main() {
    string s,p;
    cin >> s;
    cin >> p;
    int n = s.length();
    int noflag = 1;
    s = s + s;
    for (int i = 0; i < n; i++)
    {
        if(equal(p.begin(),p.end(),s.begin()+i)){
            cout << "Yes" << endl;
            noflag--;
            break;
        }  
    } 
    if(noflag){
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t h, a;
    cin >> h >> a;

    cout << (h - 1) / a + 1 << endl;
}

Measured memory_bytes: 256
from decimal import *

A, B, C, D = map(int, input().split());

# 最大公約数
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

# 最小公倍数
def lcm(a, b):
  return Decimal(a*b)/gcd(a, b)

# Cで割り切れる数
divC = (B // C) - ((A - 1) // C);
# Dで割り切れる数
divD = (B // D) - ((A - 1) // D);
# CでもDでも割り切れる数
CD = lcm(C, D);
divCD = (B // CD) - ((A - 1) // CD); 
# 答え
N = B - A + 1;
result = N - divC - divD + divCD;
print('{:.50g}'.format(result));


Measured memory_bytes: 5076
#include <iostream>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;

typedef long i32;
typedef long long i64;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rFOR(i,a,b) for(int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()



auto main() -> int
{
  // Fast I/O
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  #ifdef DEBUG
    freopen("input.txt", "r", stdin);
  #endif
  
  int n;
  cin >> n;
  vi arr(n);
  for(auto &i:arr) cin >> i;
  int d = 1;
  int m = arr[0];
  FOR(i,1,n) {
    if(arr[i] <= m) {
      d++;
      m = arr[i];
    }
  }

  cout << d;


  #ifdef DEBUG
    cerr << endl << "Time:" << double(clock()) / CLOCKS_PER_SEC << " seconds!"; 
  #endif
}


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

int main() {

	string s; cin >> s;
	vector<int> existNum(s.size());
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') existNum[i] = 1;
		if (s[i] == 'C') existNum[i] = 1;
		if (s[i] == 'G') existNum[i] = 1;
		if (s[i] == 'T') existNum[i] = 1;
	}
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (existNum[i] == 1) {
			cnt++;
			ans = max(ans,cnt);
		}
		else cnt = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define ll long long

int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	int arr[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &arr[i]);
	}
	for(int j = 0; j < n - k; j++){
//		printf("compare %d < %d (?)\n", arr[j], arr[j + k]);
		if(arr[j] < arr[j + k]){
			puts("Yes");
		}
		else{
			puts("No");
		}
	}
	return 0;
}

Measured memory_bytes: 2436
// CppPractice.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main()
{
	int n, a[1000], b[1000], c[1000];
	int ans = 0;
	string s, t;
	
	cin >> s;
	cin >> t;
	for (int i = 0; i < s.size(); i++) {
		if ((s[i]) == (t[i])) ans += 1;
	}

	cout << ans << endl;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    if (a < b){
        printf("a < b\n");
    }else if (a > b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 1808
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	Random ra=new Random();
	
	int[] a = new int[10];
	
	for(int i=0;i<10;i++)
		a[i]=sc.nextInt();
	Arrays.sort(a);

	for(int i = 9 ; i > 6 ; i--){
	    System.out.println(a[i]);
 	}
	}
	}

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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int d = b+c;

    if(d>a){
        cout << d-a << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
int H,W; cin >> H >> W; vector<string> B(2*H);
  for(int i = 0; i < H; i++){ string S; cin >> S;B[2*i] = S; B[2*i + 1] = S;}
  
  for(int j = 0; j < 2*H; j++){
    cout << B[j] << endl;} return 0;}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int wantUpper = 55555;
        int furui[] = new int[wantUpper + 1];

        for (int i = 2; i <= wantUpper; i++) {
            furui[i] = i;//篩に2~nまでの値を入れる
        }
        for (int i = 2; i <= Math.sqrt(wantUpper); i++) {
            for (int j = i + i; j <= wantUpper; j += i) {//iの倍数は篩落とす
                furui[j] = 0;
            }
        }
        int count = 0;
        for(int i = 2; i <= 55555 && count < n; i++) {
            if(furui[i]==i && i % 10 == 1) {
                System.out.print(i+" ");
                count++;
            }
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n, k;
	cin >> n >> k;
	int now = 0;
	double ans = 0;

	while (now < n){
		now++;
		if (now >= k){
			ans++;
		}
		else {
			int tmp = now;
			int cnt = 0;
			double a = 1;
			while (tmp < k){
				cnt++;
				tmp *= 2;
				a *= 0.5;
			}
			ans += a;
		}
	}

	printf("%.12lf\n", ans / (double)n);





}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

  if(x > 0 && y > 0){
    if(x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }
  
  else{
    printf("No\n");
  }

  return 0; 
}

Measured memory_bytes: 584
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <list>
#include <set>
using namespace  std;

#define int long long int

constexpr int INF = std::numeric_limits<int>::max();

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int T, X;
    cin >> T >> X;

    printf("%lf\n", (double)T/X);
}

Measured memory_bytes: 256
import heapq
N, M = map(int, input().split())
pque = [-int(x) for x in input().split()]
heapq.heapify(pque)

res = M
while res > 0:
    a = heapq.heappop(pque)
    a = -(abs(a) >> 1)
    heapq.heappush(pque, a)
    res -= 1
print(-sum(int(x) for x in pque))


Measured memory_bytes: 14180
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

fn main() {
  let n = read::<usize>();
  let mut v = read_n::<f64>(n);

  v.sort_by(|x, y| x.partial_cmp(y).unwrap());
  let answer = v[1..].iter().fold(v[0], |acc, &x| (acc + x) / 2f64);
  println!("{}", answer);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  int count=0;
  for(int i=0;i<n;i++){
    if(i==0) continue;
    if(i==n-1)break;
    if( vec.at(i) < max(vec.at(i-1),vec.at(i+1)) && 
        vec.at(i) > min(vec.at(i-1),vec.at(i+1))){
        count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;

int main()
{
	int a,b;
	ll ans=0;
	int n=1;
	cin>>a>>b;
	while(n<b)
	{
		n--;
		n+=a;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val k = readInt()
    val (a, b) = readIntList()
    
    for (i in a..b) {
        if (i % k == 0) {
            println("OK")
            return
        }
    }
    println("NG")
}

Measured memory_bytes: 36432
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
string A, B, C;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> A >> B >> C;
    char d = 'A' - 'a';
    cout << char(A[0]+d) << char(B[0]+d) << char(C[0]+d) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
#define pi 3.14159265359
#define ll long long

using namespace std;

int main()
{
    double r;
    cin >> r;
    double c = 2 * pi * r;
    cout << c << endl;
}

Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) cin >> d.at(i);
    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size() << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;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--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n; cin >> n;
    vector<int> a(n), k(n);
    rep(i, n) {
        cin >> a[i] >> k[i];
    }
    ll tot = 0;
    rep(i, n) {
        while(a[i] % k[i] != 0 || a[i] < k[i]) {
            int x = a[i] / k[i];
            int y = a[i] % k[i];
            a[i] -= (x + 1) * (y / (x + 1));
            if(a[i] % k[i] == 0) {
                break;
            }
            a[i] -= (x + 1);
        }
        if(a[i] % k[i] == 0) {
            tot ^= (a[i] / k[i]);
        }
    }
    if(tot == 0) {
        cout << "Aoki" << endl;
    } else {
        cout << "Takahashi" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
import { Hash } from "crypto";
import { access } from "fs";

class Input {
    private lines: string[];
    constructor(lines: string[]) {
        this.lines = lines;
    }

    public string(): string { return this.lines.shift() as string; }
    public int(): number { return parseInt(this.string()); }
    public intArray(): number[] { return this.string().split(" ").map(n => parseInt(n)); }
    public stringArray(): string[] { return this.string().split(" "); }

    public allLines(): string[] { return this.lines; }
    public allLinesInt(): number[] { return this.lines.map(s => parseInt(s)); }
    public allLinesIntArray(): number[][] { return this.lines.map(s => s.split(" ").map(n => parseInt(n))); }
    public allLinesStringArray(): string[][] { return this.lines.map(s => s.split(" ")); }
}


function calc(stdin: Input) {
    return eval(stdin.string())
}

function main(stdin: string) {
    console.log(calc(new Input(stdin.split("\n"))));
}

if (require.main && require.main.filename.indexOf("Main") >= 0) {
    main(require('fs').readFileSync('/dev/stdin', 'utf8'));
} else {
    main(require('fs').readFileSync('input.txt', 'utf8').trim());
}

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

int main() {
  int number;
  cin >> number;
  int YYMM = 0;
  int MMYY = 0;
  int first = number / 100;
  int rear = number - first*100;
  if(1 <= rear && rear <= 12 ){
    YYMM++;
  }
  if(1 <= first && first <= 12){
    MMYY++;
  }
  if(YYMM == 1 && MMYY == 1){
    cout << "AMBIGUOUS" << endl;
  }else if(YYMM == 1){
    cout << "YYMM" << endl;
  }else if(MMYY == 1){
    cout << "MMYY" << endl;
  }else{
    cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 1000000000
#define MAX_N 100005
using namespace std;

int main(){
    int N,W;
    int v[102],w[102];
    int dp[102][10002];
    
    cin>>N>>W;
    rep(i,0,N)cin>>v[i]>>w[i];
    rep(i,0,N)dp[i][0]=0;
    rep(i,0,N)dp[0][i]=0;
    
    rep(i,1,N+1){
        rep(j,1,W+1){
            if(0<=j-w[i-1])dp[i][j]=max(dp[i-1][j],max(dp[i-1][j-w[i-1]]+v[i-1],dp[i][j-w[i-1]]+v[i-1]));
            else dp[i][j]=dp[i-1][j];
        }
    }

    cout<<dp[N][W]<<endl;
    
    return 0;
}

Measured memory_bytes: 7008
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt

def main():
    K = int(input())
    A, B = map(int, input().split())

    flag = False
    k = K
    i = 1
    while k <= B:
        if k >= A:
            flag = True
            break
        i += 1
        k = K * i

    if flag:
        print("OK")
    else:
        print("NG")


if __name__ == '__main__':
    main()

Measured memory_bytes: 65448
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double det(const P &a, const P &b) {
	return (conj(a) * b).imag();
}

int main() {
	double x[4], y[4];
	char c;
	for (; cin >> x[0] >> c >> y[0] ; ) {
		rep (i, 3) cin >> c >> x[i + 1] >> c >> y[i + 1];
		double s = 0.0;
		rep(i, 4) x[i] += 200, y[i] += 200;
		rep (i, 4) s += det(P(x[i], y[i]), P(x[(i + 1) % 4], y[(i + 1) % 4])) / 2.0;
		s = fabs(s);
		double sub_s = 0;
		rep(j, 4) {
			double ss = 0.0;
			rep(i, 4) if (i != j) {
				int idx = (i + 1) % 4;
				if (idx == j) idx = (i + 2) % 4;
				ss += det(P(x[i], y[i]), P(x[idx], y[idx])) / 2.0;
			}
			ss = fabs(ss);
			sub_s = max(sub_s, ss);
		}
		cout << (s >= sub_s ? "YES" : "NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main() {
long mod=1000000007;
    long h, w, r, c[10][10],i,j,k,t[10],f[10];
    for (i = 1; i < 10; i++) {
        for (j = 0; j <= i; j++) {
            c[i][j] = 1;
            for (k = 1; k <= j; k++) {
                c[i][j] = c[i][j] * (i - k + 1);
                c[i][j] = c[i][j] / k;
            }
        }
    }
    t[0] = 1;
f[0]=1;
    for (i = 1; i < 8; i++) {
        t[i] = f[i-1];
f[i]=1;
        for (j = 1; j * 2 <= i; j++){
            f[i] += c[i - j][j];
f[i]=f[i]%mod;
}
t[i]+=f[i];
    }
    scanf("%ld%ld%ld", &h, &w, &r);
    long dp[111][11],odds;
    for (i = 0; i < w; i++) {
        for (j = 0; j <= h; j++)
            dp[j][i] = 0;
    }
    dp[0][0] = 1;
    for (i = 1; i <= h; i++) {
        for (j = 0; j < w; j++) {
            if (j > 0) {
                odds = 1;
                if (j > 1)
                    odds = odds * t[j - 2];
                if (j < w - 1)
                    odds = odds * t[w - j - 2];
odds=odds%mod;
                dp[i][j] += dp[i - 1][j - 1]*odds;
dp[i][j]=dp[i][j]%mod;
            }
            if (j < w-1) {
                odds = 1;
                if (j > 0)
                    odds = odds * t[j - 1];
                if (j < w-2)
                    odds = odds * t[w-j-3];
odds=odds%mod;
                dp[i][j] += dp[i - 1][j + 1] * odds;
dp[i][j]=dp[i][j]%mod;
            }
            odds = 1;
            if (j > 0)
                odds = odds * t[j - 1];
            if (j < w - 1)
                odds = odds * t[w - j - 2];
            dp[i][j] += dp[i - 1][j] * odds;
            dp[i][j] = dp[i][j] % mod;
        }
    }
    printf("%ld\n", dp[h][r - 1]);
    return 0;
}

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

int main(){
    int h1,h2,k1,k2;
    int a,b,c,d;
    cin >> h1 >> h2 >> k1 >> k2;
    cin >> a >> b >> c >> d;
    int s1,s2;
    s1 = a*h1 +b*h2 +(h1/10)*c +(h2/20)*d;
    s2 = a*k1 +b*k2 +(k1/10)*c +(k2/20)*d;
    if(s1>s2){
        cout << "hiroshi" << endl;
    }else if(s1<s2){
        cout << "kenjiro" << endl;
    }else{
        cout << "even" << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include<vector>
#include<climits>
#include<set>
#include<string>
#include<map>
#define ll long long
#define fr(j,p) for (int i=j; i<p ;i++)
#define fastScan ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define inp(x,n) fr(0,n) cin>>x[i];
#define out(x,n) fr(0,n) cout<<x[i]<<" ";
#define test int t; cin>>t; while(t--)
#define YESF if(flag==0)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define yesf if(flag==0)cout<<"Yes"<<endl; else cout<<"No"<<endl; 
const long long md=1e9+7;
using namespace std;
int main()
{
  fastScan
  //test
  {

    string s;
    cin>>s;

    int flag=1;

    if(s[2]==s[3] && s[4]==s[5])
      flag=0;

    yesf

   
      
  } 
     return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define INFTY 1000000000

void merge(int *, int, int, int);
void mergeSort(int *, int, int);

int *S,count=0;
int main(){
  int n,i;
  scanf("%d",&n);
  S=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);

  mergeSort(S,0,n);

  
  for(i=0;i<n;i++){
    printf("%d",S[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}

void merge(int *S, int left, int mid, int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1],R[n2];
  /*L[0...n1], R[0...n2] を生成*/
  for(i=0;i<n1;i++) L[i]=S[left+i];
  for(i=0;i<n2;i++) R[i]=S[mid + i];
 
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      S[k]=L[i];
      i=i+1;
      count++;
    }else{ 
      S[k]=R[j];
      j=j+1;
      count++;
    }
  }
}

void mergeSort(int *S, int left, int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(S, left, mid);
    mergeSort(S, mid, right);
    merge(S, left, mid, right);
  }
}



Measured memory_bytes: 5640
#include <iostream>
#include <algorithm>

int main()
{
	int a, b;
	std::cin >> a >> b;

	int t[] = { a + b, a - b, a * b };
	std::sort( t, t + 3 );
	std::cout << t[ 2 ] << std::endl;
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

result = 0
for i in range(n+1):
    r_sp = i*r
    if r_sp > n:
        break
    for j in range(n+1):
        g_sp = j*g
        if g_sp > n:
            break

        rg = r_sp + g_sp
        if rg > n:
            break

        if (n-rg) % b == 0:
            result += 1

print(result)


Measured memory_bytes: 40688
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }

int main () {
  int n = in();
  map<string,int> mp;
  rep(i,n) {
    string s = in<string>();
    mp[s]++;
  }
  int mx = 0;
  for (auto p : mp) mx = max(mx, p.se);
  for (auto p : mp) {
    if (p.se != mx) continue;
    cout << p.fi << endl;
  }
  return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int const INF = 1000000;
int main(){
    int n;
    cin>>n;
    string s[n];
    rep(i,n){
        cin>>s[i];
    }
    int alpha[26];rep(i,26){alpha[i]=0;}
   
        rep(j,s[0].size()){
            alpha[s[0][j]-'a']++;
        }
    for(int i=1;i<n;i++){
        int al[26];rep(k,26){al[k]=0;}
        rep(j,s[i].size()){al[s[i][j]-'a']++;}
        rep(k,26){if(al[k]<alpha[k]){alpha[k]=al[k];}}
    }
    
    
    string ans;
    rep(i,26){if(alpha[i]!=0){
        while(alpha[i]!=0){
            ans+=char(i+'a');
            alpha[i]--;
        }
    }}
    cout<<ans<<endl;
    return 0;
}

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

int main ()
{
	string s;cin >> s;
	string t;cin >> t;
	int ps = 0;
	int pt = 0;
	int count = 0;
	for (int i = 0;i < s.size();i++)
	{
		if (s[ps] != t[pt])
		{
			++count;
		}
		++ps;
		++pt;
	}
	cout << count;
	return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int n = 0;
  cin >> n;
  cout << ("Christmas ");
  rep(i, 25 - n) cout << ("Eve ");
  return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

void compute() {

}

struct Data {
  int p,y,ID;
  bool operator < ( const Data &d ) const {
    if( y != d.y ) return y < d.y;
    return p < d.p;
  }
};

int main() {
  int n,m;
  cin >> n >> m;
  map<int,int> mp;
  vector<Data> vec(m);
  rep(i,m) {
    cin >> vec[i].p >> vec[i].y;
    vec[i].ID = i;
  }
  sort(ALL(vec));
  vector<string> ans(m);
  rep(i,m) {
    int p = vec[i].p;
    int x = mp[p] + 1;
    ++mp[p];
    string a = to_string(p), b = to_string(x);
    ans[vec[i].ID] = string(6-(int)a.size(),'0') + a + string(6-(int)b.size(),'0') + b;
  }
  rep(i,m) {
    cout << ans[i] << endl;
  }
  
  compute();
  return 0;
}


Measured memory_bytes: 12800
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            long[] res = new long[n + 1];
            res[0] = 2;
            res[1] = 1;

            for (int i = 2; i <= n; ++i) {
                res[i] = res[i - 2] + res[i - 1];
            }

            out.println(res[n]);
        }

    }
}



Measured memory_bytes: 21716
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

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

const int N = 1e5 + 5;

ll x[N], dp[N] = {0};

int main()
{
	int n;
	ll a, b;
	cin >> n >> a >> b;

	for (int i = 1; i <= n; ++i)
		cin >> x[i];

	for (int i = 2; i <= n; ++i)
		dp[i] = dp[i-1] + min(a * (x[i] - x[i-1]), b);

	cout << dp[n];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, 0, n){
        int in;
        cin >> in;
        mp[in]++;
    }
    int ans = 0;
    for(auto it = mp.begin(); it != mp.end(); it++){
        if(it -> first < it -> second) ans += it -> second - it -> first;
        if(it -> first > it -> second) ans += it -> second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6272