akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

/*
struct SegmentTree{
  
  vector<lol> SumV(1000005,0);
  vector<lol> MaxV(1000005,0);
  vector<lol> MinV(1000005,0);
  int N;
  
  void update(int i,int x){
    i += N - 1;
    minv[i] = x;
    maxv[i] = x;
    sumv[i] = x;
    while(i > 0){
      i = (i - 1)/2;
      maxv[i] = max(maxv[i*2+1],maxv[i*2+2]);
      minv[i] = min(minv[i*2+1],minv[i*2+2]);
      sumv[i] = sumv[i*2+1]+sumv[i*2+2];
    }
  }
  
  void add(int i,int x){
    i += N - 1;
    sumv[i] += x;
    maxv[i] += x;
    minv[i] += x;
    while(i > 0){
      i = (i - 1)/2;
      sumv[i] = sumv[i*2+1]+sumv[i*2+2];
      minv[i] = min(minv[i*2+1],minv[i*2+2]);
      maxv[i] = max(maxv[i*2+1],maxv[i*2+2]);
    }
  }
  
  int getmax(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return -INF;
    if(a <= l && r <= b) return maxv[k];
    else{
      int c1 = getmax(a,b,2*k+1,l,(l+r)/2);
      int c2 = getmax(a,b,2*k+2,(l+r)/2,r);
      return max(c1,c2);
    }
  }
  
  int getmin(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return minv[k];
    else{
      int c1 = getmin(a,b,2*k+1,l,(l+r)/2);
      int c2 = getmin(a,b,2*k+2,(l+r)/2,r);
      return min(c1,c2);
    }
  }
  
  int getsum(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return sumv[k];
    else{
      int c1 = getsum(a,b,2*k+1,l,(l+r)/2);
      int c2 = getsum(a,b,2*k+2,(l+r)/2,r);
      return c1+c2;
    }
  }
}
*/

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  lol n, k;
  cin >> n >> k;
  lol a[n + 5];
  reps(i, n){
    cin >> a[i];
  }
  lol memo = 0, now = 1, nasu[n + 5] = {};
  bool isvisited[n + 5] = {false}; 
  while(!isvisited[now]){
    nasu[now] = memo;
    memo ++;
    isvisited[now] = true;
    //    cout << now << " " << nasu[now] << '\n';
    now = a[now];
  }
  swap(nasu[now], memo);
  //cout << now << " " << nasu[now] << '\n';
  if(k <= memo){
    now = 1;
    while(k != 0){
      k --;
      now = a[now];
    }
  } else {
    int sum = 1, na = now;
    while(a[now] != na){
      sum ++;
      now = a[now];
    }
    now = a[now];
    int su = (k - memo) % sum;
    //cout << (k - memo) << " " << sum << '\n';
    while(su != 0){
      su --;
      now = a[now];
    }
  }
  cout << now << '\n';
  return 0;
}


Measured memory_bytes: 6868
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

H,W=mint()
S=[input() for _ in range(H)]
C=[[0]*W for _ in range(H)]
for i in range(H):
    l=0
    for r in range(W):
        if S[i][r]=='.':
            continue
        tmp=r-l
        while l<r:
            C[i][l]+=tmp
            l+=1
        l=r+1
    tmp=W-l
    while l<W:
        C[i][l]+=tmp
        l+=1
for j in range(W):
    l=0
    for r in range(H):
        if S[r][j]=='.':
            continue
        tmp=r-l
        while l<r:
            C[l][j]+=tmp
            l+=1
        l=r+1
    tmp=H-l
    while l<H:
        C[l][j]+=tmp
        l+=1
print(max([max(c) for c in C])-1)   

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

int main() {
int k,x,i,count=0,a;
cin>>k>>x;
i=x-k+1;
a=k*2-1;


while(count<a){
    cout<<i<<" ";
    i++;
    count++;


}

    return 0;
}

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

int main() {
	int A, B, C, D, L, R;
	cin >> A >> B >> C >> D;
	L = A + B;
	R = C + D;
	if (L < R) {
		cout << "Right" << endl;
	}
	else if (L > R) {
		cout << "Left" << endl;
	}
	else {
		cout << "Balanced" << endl;
	}
}

Measured memory_bytes: 3584
#include<iostream>
using namespace std;
int main()
{
	int n;
	string s,t;
	cin>>n;
	cin>>s>>t;
	string h;
	for(int i=0;i<n;i++)
	{
		h=h+s[i]+t[i];
	}
	cout<<h;
}
	

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> A(5);
  REP(i, 5) cin >> A[i];
  int ans = 10000000;

  do {
    int tmp = 0;
    for(int i = 0; i < 4; i++) {
      if(A[i] % 10 == 0) {
        tmp += A[i];
      } else {
        int waru = A[i] / 10;
        tmp += waru * 10 + 10;
      }
    }
    tmp += A[4];
    ans = min(ans, tmp);

  } while(next_permutation(A.begin(), A.end()));

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

Measured memory_bytes: 256
# coding: utf-8

II = lambda: int(input())
MI = lambda: map(int, input().split())


def main():
    N, M, X, Y = MI()
    x = max(MI())
    y = min(MI())
    if not x < Y: return False
    if not X < y: return False
    if not x < y: return False
    return True


if __name__ == "__main__":
    print(["War", "No War"][main()])


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double n, m; cin >> n >> m;
    double sum = 0;
    vector<double> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(all(a), greater<double>());
    if(a[m-1] >= sum/(4*m)) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll gcd(ll a,ll b){
        if(b==0)return a;
        else return gcd(b,a%b);
}
mp hiku(ll p,ll q,ll a,ll b){
        ll m  = q*b;
        ll res = p*b-a*q;
        if(res == 0) {
                return mp(0,0);
        }
        //cout<<m<<" "<<res<<"hiku"<<endl;
        if(res<0)return mp(-1,0);
        //ll g = gcd(res,m);
        //cout<<g<<endl;
        return mp(res,m);
}

void dfs(ll p,ll q,ll a,ll n,ll seki,ll &cnt,ll s){
        //cout<<p<<' '<<q<<endl;
        if(seki > a) return;
        if(p==0){
        //      cout<<"OK"<<endl;
                cnt++;
                return ;
        }
        if(p<0)return;
        if(n==0)return;
        for(ll i=s;i*seki <= a;i++){
                mp in = hiku(p,q,1,i);
                dfs(in.first,in.second,a,n-1,seki*i,cnt,max(s,i));
        }

}

int main(){
        while(1){
                ll p,q,a,n;
                cin>>p>>q>>a>>n;
                if(p==0)break;
                ll cnt = 0;
                dfs(p,q,a,n,1,cnt,1);
                cout<<cnt<<endl;
        }
        return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <vector>
#include <tgmath.h>

using namespace std;


void solve(long long r){
    cout << r*r << endl;
    return;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long r;
    scanf("%lld",&r);
    solve(r);
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static long mod = (long) (1e9+7);
	public static long[] fac,inv;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
	    String s = sc.next();
	    String t = sc.next();
	    int a = sc.nextInt();
	    int b = sc.nextInt();
	    String u = sc.next();
	    if(u.equals(s)) --a; else --b;
	    out.print(a+" "+b);
	    out.close();

	}
	

}


Measured memory_bytes: 21716
#include <stdio.h>
#define rep(i,n)for(int i=0;i<n;i++)
int main(){
	int n,d,c[101]={0},a=0;
	scanf("%d",&n);
	rep(i,n){scanf("%d",&d);c[d]++;}
	rep(i,101)if(c[i]>0)a++;
	printf("%d",a);
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline

MOD = 998244353
n = int(input())
xy = []
y_index = dict() 
for i in range(n):
    x, y = [int(item) for item in input().split()]
    xy.append((x, y))
xy.sort(key=lambda x: x[1])
for i, (_, y) in enumerate(xy):
    y_index[y] = i
xy.sort()

cnt = [0] * (n+1)
def BIT_sum(i):
    ret = 0
    while i > 0:
        ret += cnt[i]
        i -= i & -i
    return ret

def BIT_add(i):
    while i <= n:
        cnt[i] += 1
        i += i & -i
    return

points_in_quad = [[0] * n for _ in range(4)]
seen = 0
for i, (x, y) in enumerate(xy):
    index = y_index[y]
    points_in_quad[2][i] = BIT_sum(index + 1)
    points_in_quad[1][i] = seen - points_in_quad[2][i] 
    BIT_add(index + 1)
    seen += 1
seen = 0
cnt = [0] * (n+1)
for i, (x, y) in enumerate(xy[::-1]):
    index = y_index[y]
    points_in_quad[3][n - 1 - i] = BIT_sum(index + 1)
    points_in_quad[0][n - 1 - i] = seen - points_in_quad[3][n - 1 - i] 
    BIT_add(index + 1)
    seen += 1

pow2 = []
a = 1
for i in range(n+1):
    pow2.append(a)
    a *= 2
    a %= MOD

ans = 0
for i in range(n):
    # target not included, n >= 2 selected
    free1 = pow2[points_in_quad[0][i]]
    free2 = pow2[points_in_quad[1][i]]
    free3 = pow2[points_in_quad[2][i]]
    free4 = pow2[points_in_quad[3][i]]
    fix24 = (free2 - 1) * (free4 - 1) % MOD
    fix13 = (free1 - 1) * (free3 - 1) % MOD
    ans -= fix24 * fix13 % MOD
    ans += ((free1 * free3) % MOD) * fix24 % MOD
    ans += ((free2 * free4) % MOD) * fix13 % MOD
    ans %= MOD
# target included, n >= 2 selected
ans += pow2[n-1] * n % MOD
print(ans % MOD)

Measured memory_bytes: 113876
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n == 0)
			break;
		
		
		vector <int> s(n);
		int M, m;
		int sum = 0;
		for(int i = 0; i < n; i++){
			cin >> s[i];
			sum += s[i];
			if(i == 0){
				M = s[i];
				m = s[i];
			}
			else{
				M = max(M, s[i]);
				m = min(m, s[i]);
			}
		}
		
		sum -= M + m;
		
		
		cout << sum / (n - 2) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1196
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String f = s.substring(0, 1);
        String l = s.substring(s.length() - 1, s.length());
        int m = s.substring(1, s.length() - 1).length();
        System.out.println(f + m + l);
    }
}


Measured memory_bytes: 22868
program ABC
    integer(8) a, b, c, d, L
    read*, a, b, c, d
    a = a - 1
    L = c * d / GCD(c, d)
    print"(i0)", ((b - b / c - b / d + b / L) - (a - a / c - a / d + a / L))
contains
    !GCDを求めるよ！
    recursive function GCD (a, b) result (res)
        implicit none
        integer(8) a, b, res
        res = a
        if (b > 0) then
            res = GCD(b, mod(a, b))
        end if
    end function
end program ABC

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
   int N, a, i, j, tmp;

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

   for (i=0; i<N; i++){
      if (i<N-1)
         printf("%d ", A[i]);
      else if (i==N-1)
         printf("%d\n", A[i]);
   }

   for (a=1; a<N; a++){

      for (i=a; i<N; i++){
         tmp = A[i];
         j = i-1;
         while (j>=0 && A[j]>tmp){
            A[j+1] = A[j];
            j--;
         }
      A[j+1] = tmp;

         for (i=0; i<N; i++){
            if (i<N-1)
               printf("%d ", A[i]);
            else if (i==N-1)
               printf("%d\n", A[i]);
         }
      }

   }

   return 0;
}

Measured memory_bytes: 1844
#include <iostream>
using namespace std;
 
int main() {
    int x; cin >> x;
    int ans, flag = 1;
    while (flag) {
        flag = 0;
        for (int i = 2; i*i <= x; i++) {
            if (x % i == 0) {
                flag = 1;
                break;
            }
        }
        x++;
    }
    ans = x - 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    long long x;
    cin >> x;
    int a,b,c;
    a = x/500;
    b = x - (500*a);
    c = b/5;
    int ans = 1000*a + 5*c;
    printf("%d",ans);
    return 0;
}

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

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

    vector< pair< string, pair<int, int> > > v;

    int p;
    string s;
    for(int i=0; i<n; i++){
        cin >> s >> p;
        v.push_back(make_pair(s, make_pair(-p, i+1)));
    }
   
    sort(v.begin(), v.end());

     for(int i=0; i<n; i++){
         cout << v[i].second.second << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include <set>
#include <stack>
#include <sstream>
#include <list>
#include <array>
#include <vector>
#include <queue>
#include <map>
#include <memory>
#include <iterator>
#include <climits>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;

int const maxn = 1e5 + 10;
inline int lc(int x)  {return x << 1;}
inline int rc(int x)  {return x << 1 | 1;}
int vis[10];
int n;

struct point {
    int x, y;
    point(const int &x = 0, const int &y = 0) : x(x), y(y) { }
} a[10];
point b[10];
double ans;
int t;

double dis(point x, point y) {
    return sqrt((x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y));
}

void sovle(int k) {
    if (k == n + 1) {
        t++;
        for (int i = 2; i <= n; i++) {
            ans += dis(b[i - 1], b[i]);
        }
        return;
    }
    for (int i = 1; i <= n; i++) {
        if (vis[i]) continue;
        b[k] = a[i];
        vis[i] = 1;
        sovle(k + 1);
        vis[i] = 0;
    }
}

int main(void) {
    FAST_IO;

    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].x >> a[i].y;
    }    
    sovle(1);
    // for (int i = 1; i <= n; i++) {
    //     for (int j = 1; j <= n; j++) {
    //         if (i == j) continue;
    //         t++;
    //         ans += dis(a[i], a[j]);
    //     }
    // }
    // cout << t << endl;
    cout << fixed << setprecision(10) << ans / t  << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
#define MAX 505
 
typedef long long ll;
 
int main(int, char**)
{
    string s;
    cin >> s;

    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}

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

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int h,w, a, b;
cin >> h >> w >> a >> b;
for (int i = 0; i < h; i++){
for (int j = 0; j < w; j++){
if (j < a){
if (i < b){ 
cout << 1;
}else{
cout << 0;
}
}else{
if (i < b){
cout << 0;
}else{
cout << 1;
}
}
}
cout << "\n";
}


return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main()
{
  int n,f,b;
  cin>>n;
  f=n/100;
  b=n%100;
  if(b>0&&b<13&&f>0&&f<13)
    cout<<"AMBIGUOUS";
  else if(b>0&&b<13)
    cout<<"YYMM";
  else if(f>0&&f<13)
    cout<<"MMYY";
  else
    cout<<"NA";
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		char c = 'a';

		ArrayList<String> befAry = new ArrayList<String>();
		ArrayList<String> aftAry = new ArrayList<String>();
		befAry.add("a");
		aftAry.add("a");
		for (int i=2; i<=N; i++){
			aftAry = new ArrayList<String>();
			for (int j=0; j<befAry.size(); j++){
				String value = befAry.get(j);
				int kind = kindCount(value);
				for (int k=1; k<=kind + 1; k++){
					aftAry.add(value + String.valueOf((char)(c + (k-1))));
				}
			}
			befAry = aftAry;
		}
		for (int i=0; i<aftAry.size(); i++){
			System.out.println(aftAry.get(i));
		}
	}

	public static int kindCount(String value){
		int cnt = 0;
		HashSet<String> set = new HashSet<String>();

		for (int i=0; i< value.length(); i++){
			set.add(value.substring(i, i+1));
		}
		return set.size();
	}
}

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

int main(){
    int a,b;
    cin >> a >> b;
    for(int i=1;i<=1000;i++){
        if (i*8/100 == a && i / 10 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

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

	for (i = 0; i < 100; i++)
	{
		if (a + (i - 1) * (a - 1) >= b) break;
	}
	cout << i << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int num[100050];

int main()
{
	long long sum=0;
	int N,Q,B,C,a;
	scanf("%d",&N);
	for(int i=0;i<100050;++i)
		num[i]=0;
	for(int i=0;i<N;++i)
	{
		scanf("%d",&a);
		sum+=(long long)a;
		++num[a];
	}
	scanf("%d",&Q);
	for(int i=0;i<Q;++i)
	{
		scanf("%d%d",&B,&C);
		sum+=(long long)(C-B)*num[B];
		num[C]+=num[B];
		num[B]=0;
		printf("%lld\n",sum);
	}
return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <iostream>
using namespace std;

void bubbleSort(int *C, char *S, int N) {
    for (int i=0; i<N; i++) {
        for (int j=N-1; j>i; j--) {
            if (C[j] < C[j-1]) { 
                int tn = C[j];
                C[j] = C[j-1];
                C[j-1] = tn;
                
                char ts = S[j];
                S[j] = S[j-1];
                S[j-1] = ts;
            }
        }
    }
}

void selectionSort(int *C, char *S, int N) { 
    for (int i=0; i<N; i++) {
        int minj = i;
        for (int j=i; j<N; j++) {
            if (C[j] < C[minj]) {
                minj = j;
            }
        }
        int tn = C[i];
        C[i] = C[minj];
        C[minj] = tn;
                
        char ts = S[i];
        S[i] = S[minj];
        S[minj] = ts;
    }
}

void outputArray(int *C, char *S, int N) {
    printf("%c%d",S[0], C[0]);
    for (int i=1; i<N; i++) printf(" %c%d", S[i], C[i]);
    printf("\n");
}

int checkCorrect(char *S1, char *S2, int N){
    int check = 1;
    for (int i=0; i<N; i++) {
        if (S1[i] != S2[i]) check=0;
    }
    return check;
}

int main() {
    int n;
    cin >> n;
    
    char s1[n], s2[n];
    int c1[n], c2[n];
    for (int i=0; i<n; i++) {
        cin >> s1[i] >> c1[i];
        c2[i] = c1[i];
        s2[i] = s1[i];
    }
    
    bubbleSort(c1, s1, n);
    outputArray(c1, s1, n);
    printf("Stable\n");
    
    selectionSort(c2, s2, n);
    outputArray(c2, s2, n);
    int check=checkCorrect(s1, s2, n);
    if(check) printf("Stable\n");
    else printf("Not stable\n");
    
    return 0;
}


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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int main(){
    double r, pi=acos(0)*2;
    cin>>r;
    cout<< 2*r*pi <<endl;
    return 0;
}


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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }

}



Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var abck = Array.ConvertAll(ReadLine().Split(' '), long.Parse);
        if (abck[3] % 2 == 0) WriteLine(abck[0] - abck[1]);
        else WriteLine(abck[1] - abck[0]);

    }

    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 11092
import java.util.Scanner

import Monotonicity._

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val al = Vector.fill(n)(sc.nextInt)

  val res = loop(al).length
  println(res)


  def loop(list: Vector[Int]): Vector[Vector[Int]] = {
    val (res1, res2, _, _) =
      list.tail.foldLeft( (Vector.empty[Vector[Int]], Vector(list.head), list.head, Monotonicity.Unknown: Monotonicity) ){ case ( (acc , stack, pre, state), now) =>
        if(stack.length == 1) { // stack = Vector(pre) である
          if(pre < now )       (acc, stack :+ now, now, Increasing)
          else if( pre > now)  (acc, stack :+ now, now, Decreasing)
          else                 (acc, stack :+ now, now, Unknown)
        }
        else {
          val booby = stack.init.last
          (booby, pre, now, state) match {
            case (b, p, nw, Increasing) if b <= p && p <= nw => (acc, stack :+ nw, nw, Increasing)
            case (_, _, nw, Increasing)                      => (acc :+ stack, Vector(nw), nw, Unknown)
            case (b, p, nw, Decreasing) if b >= p && p >= nw => (acc, stack :+ nw, nw, Decreasing)
            case (_, _, nw, Decreasing)                      => (acc :+ stack, Vector(nw), nw, Unknown)
            case (b, p, nw, Unknown)    if b <= p && p <= nw => (acc, stack :+ nw, nw, Increasing)
            case (b, p, nw, Unknown)    if b >= p && p >= nw => (acc, stack :+ nw, nw, Decreasing)
            case (b, p, nw, Unknown)                         => (acc, stack :+ nw, nw, Unknown)
          }
        }
      }

    res1 :+ res2
  }
}

sealed trait Monotonicity

object Monotonicity {
  case object Increasing extends Monotonicity
  case object Decreasing extends Monotonicity
  case object Unknown    extends Monotonicity
}


Measured memory_bytes: 82944
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define dum2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define dum3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

int main() {
    int a, b;
    cin >> a >> b;
    if (a + b == 15)cout << '+' << endl;
    else if (a*b == 15)cout << '*' << endl;
    else cout << 'x' << endl;
}



Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
print((a-1)*(b-1))










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

int main() {
	int n;
	cin >> n;
	map<int, int>v;
	map<int, int>w;
	bool vi = true;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (vi) {
			if (v.count(x))v.at(x)++;
			else v[x] = 1;
			vi = false;
		}
		else {
			if (w.count(x))w.at(x)++;
			else w[x] = 1;
			vi = true;
		}
	}
	int mod_odd = 0;
	int mod2_odd = 0;
	int odd_num = 0;
	int even_num = 0;
	for (auto x : v) {
		if (mod_odd <= x.second) {
			odd_num = x.first;
			mod2_odd = mod_odd;
			mod_odd = x.second;
		}
		else if(mod2_odd <=x.second){
			mod2_odd = x.second;
		}
	}
	int mod_even = 0;
	int mod2_even = 0;
	for (auto x : w) {
		if (mod_even <= x.second) {
			even_num = x.first;
			mod2_even = mod_even;
			mod_even = x.second;
		}
		else if (mod2_even <= x.second){
			mod2_even = x.second;
		}
	}
	if (odd_num != even_num) {
		cout << n - mod_odd - mod_even << endl;
	}
	else {
		if (mod2_odd > mod2_even)cout << n - mod2_odd - mod_even << endl;
		else cout << n - mod2_even - mod_odd << endl;
	}
}


Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<utility>
#include<cmath>
#include<map>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define all(v) v.begin(),v.end()
using namespace std;

const double eps = 1e-8;
const double INF = 1e12;

typedef pair<int,int> P;
typedef double Real;
typedef complex<Real> Point;
typedef vector<Point> G;

double cross(const Point& a,const Point& b){//calculate ad-bc(vector product)
	return imag(conj(a)*b);
}

struct L:public vector<Point>{//line data
	L(const Point &a,const Point &b){
		push_back(a);
		push_back(b);
	}
};


int main(){
	string s;
	getline(cin,s);
	int count=0;
	map<string,int> mp;
	vector<string> vec;
	string lenmax="";
	rep(i,s.size()+1){
		if(i==s.size()){
			string sub=s.substr(count,i+1-count);
			count=i+1;
			vec.push_back(sub);
			mp[sub]=0;
			if(lenmax.size()<sub.size()){
				lenmax=sub;
			}
		}else if(s[i]==' '){
			string sub=s.substr(count,i-count);
			count=i+1;
			vec.push_back(sub);
			mp[sub]=0;
			if(lenmax.size()<sub.size()){
				lenmax=sub;
			}
		}
	}
	rep(i,vec.size()){
		mp[vec[i]]++;
	}
	string fremax="";
	rep(i,vec.size()){
		if(mp[vec[i]]>mp[fremax]){
			fremax=vec[i];
		}
	}
	cout<<fremax<<" "<<lenmax<<endl;
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x, y;
  int a[7] = {1, 3, 5, 7, 8, 10, 12};
  int b[4] = {4, 6, 9, 11};
  int c[1] = {2};
  
  cin >> x >> y;
  
  for (int i = 0; i < 7; i++) {
    if (x == a[i]) {
      x = 100;
    } 
    if (y == a[i]) {
      y = 100;
    }
  }
  
  for (int i = 0; i < 4; i++) {
    if (x == b[i]) {
      x = 200;
    }
    if (y == b[i]) {
      y = 200;
    }
  }
  
  if (x == c[0]) {
    x = 300;
  }
  if (y == c[0]) {
    y = 300;
  }
  
  if (x == y) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#ifdef Rahul
# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
# define error(...) 42;
#endif
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/***********************************************************************/
const int N = 2000;
int pc[N];
int32_t main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  for (int i = 1; i < N; ++i) {
    pc[i] = pc[i >> 1] + (i & 1);
  }
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> a(h);
  for (string &s : a) {
    cin >> s;
    for (char &c : s) c -= '0';
  }
  int ans = MOD;
  for (int nask = 0; nask < (1 << (h - 1)); ++nask) {
    int cur = 0, ok = 1;
    array<int, 10> s{};
    for (int i = 0; i < w && ok;) {
      int now = 0, ptr = 0, st = 0;
      for (int j = 0; j < h; ++j) {
        now += a[j][i];
        if ((nask >> j & 1) or j == h - 1) {
          s[ptr] += now;
          if (now > k) ok = 0;
          if (s[ptr] > k) st = 1;
          now = 0;
          ++ptr;
        }
      }
      if (!ok) break;
      if (st) {
        fill(ALL(s), 0);
        ++cur;
      } else {
        ++i;
      }
    }
    if (ok) uin(ans, cur + pc[nask]);
  }
  kek(ans);
}


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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#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 all(x) (x).begin(),(x).end()
int main(){
    int n,y;
    cin>>n>>y;
    REP(i,n+1){
        REP(j,n-i+1){
            if(10000*i+5000*j>y){
                continue;
            }
            int k=(y-10000*i-5000*j)/1000;
            if(i+j+k==n){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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 int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    string s;
    cin >> n >> s;
    string ori = s;
    while(s.size() >= 2) {
        bool cont = false;
        vector<int> v;
        rep(i,s.size()-1) {
            if(s[i] == '(' && s[i+1] == ')') {
                v.pb(i);
                v.pb(i+1);
                cont = true;
            }
        }
        sort(rall(v));
        for(int i : v) {
            s.erase(s.begin()+i);
        }
        if(!cont) break;
    }
    if(s.size() == 0) {
        cout << ori << endl;
        return 0;
    }
    int f=0,b=0;
    for(char c : s) {
        if(c == ')') f++;
        else b++;
    }
    rep(_,f) cout << '(';
    cout << ori;
    rep(_,b) cout << ')';
    cout << endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	rep (i, n) cin >> p[i];
	sort(p.begin(), p.end());
	int res = 0;
	rep (i, k) res += p[i];
	cout << res << endl;
    
    return 0;
}


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

int main(){
  int D;
  cin>>D;
  int C[26];
  for(int i=0;i<26;i++){
    cin>>C[i];
  }
  
  
  
  
  for(int i=0;i<365;i++){
    cout<<1<<endl;
  }
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll powLL(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res *= a;
            res %= mod;
        }
        a = a*a;
        a %= mod;
        n >>= 1;
    }
    return res;
}

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

    string S;
    cin >> S;
    ll N = S.size();
    ll res = 0;
    ll ones = 0;
    REP(i, N){
    	if(S[i] == '1'){
    		ll tmp = powLL(3, N-1-i);
    		tmp *= powLL(2, ones);
    		res += tmp;
    		res %= mod;
    		ones++;
    	}
    }
    res += powLL(2, ones);
    res %= mod;
    cout << res << endl;
    return 0;
}

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

using namespace std;
using i64 = std::int_fast64_t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  i64 N, P;
  cin >> N >> P;
  map<i64, int> cnts;
  for (i64 i = 2; i * i < P + 1; i++) {
    int cnt = 0;
    while (P % i == 0) {
      P /= i;
      cnt++;
    }
    if (cnt > 0) cnts[i] = cnt;
  }
  if (P > 1) cnts[P]++;

  i64 res = 1;
  for (auto it = cnts.begin(); it != cnts.end(); it++) {
    res *= pow(it->first, it->second / N);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


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


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


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


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


def main():
    n = get_int()
    A = []
    B = []
    for _ in range(n):
        a, b = get_int_list()
        A.append(a)
        B.append(b)

    sums = [(i, a + b) for i, (a, b) in enumerate(zip(A, B))]
    sums.sort(key=lambda x: x[1], reverse=True)
    takahashi = [A[i] for i, _ in sums[0::2]]
    aoki = [B[i] for i, _ in sums[1::2]]
    print(sum(takahashi) - sum(aoki))


if __name__ == '__main__':
    main()


Measured memory_bytes: 26692
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cctype>
#include<cstring>
#include<string>
#include<iomanip>

using namespace std;

int main(){
	string word,in;
	int cnt=0;
	cin>>word;
	while(1){
		cin>>in;
		if(in=="END_OF_TEXT")break;
		for(int i=0;i<in.size();i++){
			if(isupper(in[i]))in[i]=tolower(in[i]);
			
		}
		if(word==in)cnt++;
	}
	cout<<cnt<<endl;


	return 0;

}

Measured memory_bytes: 1192
using System;

namespace AtCoder0205
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int T = int.Parse(s[0]);
            int X = int.Parse(s[1]);

            float f = (float)T / (float)X;


            Console.Write(f.ToString());
        }

 
    }
}


Measured memory_bytes: 11092
# coding:utf-8
W = raw_input().lower()
array = []
cnt = 0
while True:
    line = raw_input()
    if line == "END_OF_TEXT":
        break
    split = line.lower().split()
    for s in split:
        array.append(s)
for word in array:
    if W == word:
        cnt += 1
print cnt



Measured memory_bytes: 4636
struct Fraction {
    var numerator: Int      // 分子
    var denominator: Int    // 分母
    // 分数形式の文字列で返す
    var asString: String {
        let hcf = findHCF()
        let str = "\(abs(numerator) / hcf) / \(abs(denominator) / hcf)"
        return numerator * denominator < 0 ? "- " + str : str
    }
    // 最大公約数を求める
    func findHCF() -> Int {
        for var i=max(numerator, denominator); i>=1; i-- {
            if numerator % i == 0 && denominator % i == 0 {
                return i
            }
        }
        return 1
    }
}

/* 分数の足し算　*/
func + (left: Fraction, right: Fraction) -> Fraction {
    let numerator = left.numerator * right.denominator + right.numerator * left.denominator
    let denomitor = left.denominator * right.denominator
    return Fraction(numerator: numerator, denominator: denomitor)
}


let n=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var d : Double = 0
var i = 0
d = Double(1) / Double(arr[i] )
//print(f.asString)  
for i in 1..<n {
  d = d + Double(1) / Double(arr[i] )
	//f = f + Fraction(numerator: 1, denominator: arr[i])
  	//print( f.findHCF() )
	//print(f.asString)     // -> 2 / 5
}

print( Double(1) / d )

Measured memory_bytes: 4208
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <map>
using namespace std;
#define N 200500
#define M 12000050
int n,head[N],nxt[M],cnt,lf[N],a[N],b[N];
int dfn[N],low[N],S[N],top,bel[N],tot,ins[N],scc,to[M],la,ls[N],rs[N],root,c[N];
struct A {
	int x,type,id;
	bool operator < (const A &u) const {
		return x<u.x;
	}
}d[N];
inline void add(int u,int v) {
	to[++cnt]=v; nxt[cnt]=head[u]; head[u]=cnt;
}
inline void upd(int &x,int y) {if(x>y)x=y;}
void build(int l,int r,int &p) {
	if(!p) p=++tot,ls[p]=rs[p]=0;
	if(l==r) {
		lf[l]=p; return ;
	}
	int mid=(l+r)>>1;
	build(l,mid,ls[p]); build(mid+1,r,rs[p]);
}
void link(int l,int r,int p) {
	if(l==r) return ;
	add(p,ls[p]); add(p,rs[p]);
	int mid=(l+r)>>1;
	link(l,mid,ls[p]); link(mid+1,r,rs[p]);
}
void update(int l,int r,int x,int y,int p,int id) {
	if(x<=l&&y>=r) {
		add(id,p); return ;
	}
	int mid=(l+r)>>1;
	if(x<=mid) update(l,mid,x,y,ls[p],id);
	if(y>mid) update(mid+1,r,x,y,rs[p],id);
}
void dfs(int x) {
	int i;
	dfn[x]=low[x]=++dfn[0];
	S[++top]=x; ins[x]=1;
	for(i=head[x];i;i=nxt[i]) {
		if(!dfn[to[i]]) {
			dfs(to[i]);
			upd(low[x],low[to[i]]);
		}else if(ins[to[i]]) {
			upd(low[x],dfn[to[i]]);
		}
	}
	if(dfn[x]==low[x]) {
		int t=S[top--]; ins[t]=0; bel[t]=++scc;
		while(t!=x) {
			t=S[top--]; ins[t]=0; bel[t]=scc;
		}
	}
}
void fuck(int id,int x,int ans) {
	int l=x+1,r=la+1;
	while(l<r) {
		int mid=(l+r)>>1;
		if(c[mid]-c[x]<ans) l=mid+1;
		else r=mid;
	}
	if(x+1<l) update(1,la,x+1,l-1,root,id);

	l=1,r=x;
	while(l<r) {
		int mid=(l+r)>>1;
		if(c[x]-c[mid]<ans) r=mid;
		else l=mid+1;
	}
	if(l<x) update(1,la,l,x-1,root,id);
}
bool check(int mid) {
	int i;
	memset(head,0,sizeof(head)); cnt=0;
	memset(dfn,0,sizeof(dfn)); top=0;
	memset(ins,0,sizeof(ins)); scc=0;
	memset(bel,0,sizeof(bel));
	link(1,la,root);
	for(i=1;i<=n;i++) {
		add(lf[b[i]],i);
		add(lf[a[i]],i+n);
		fuck(i,a[i],mid);
		fuck(i+n,b[i],mid);
	}
	for(i=1;i<=tot;i++) if(!dfn[i]) dfs(i);
	for(i=1;i<=n;i++) if(bel[i]==bel[i+n]) return 0;
	return 1;
}
void solve() {
	int i,x,y; la=0;
	for(i=1;i<=n;i++) {
		scanf("%d%d",&x,&y);
		if(x>y) swap(x,y); 
		d[++la]=(A){x,0,i};
		d[++la]=(A){y,1,i};
	}
	sort(d+1,d+la+1);
	for(i=1;i<=la;i++) {
		if(d[i].type==0) a[d[i].id]=i;
		else b[d[i].id]=i;
		c[i]=d[i].x;
	}
	// for(i=1;i<=la;i++) printf("%d\n",c[i]);
	tot=la;
	build(1,la,root);

	// printf("%d\n",check(0)); return ;
	int d,p;
	for(d=1;check(d);d<<=1); d>>=1;
	for(p=d;d;d>>=1) if(check(p+d))p+=d;
	printf("%d\n",p);
}
int main() {
	// freopen("plane.in","r",stdin);
	// freopen("plane.out","w",stdout);
	while(scanf("%d",&n)!=EOF) {
		solve();
	}
}
/*
10
44 156
153 182
48 109
160 201
55 186
54 207
55 165
17 58
132 160
87 197
*/


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

/* 配列の要素を順番に出力 */
void trace(int A[], int N) {
    for ( int i = 0; i < N; i++ ) {
        if ( i > 0 ) cout << " ";
        cout << A[i];
        // cout << A[i] << " ";
    }
    cout << endl;
}

/* 挿入ソート（0オリジン配列） */
void insertionSort(int A[], int N) {
    for ( int i = 1; i < N; i++ ) {
        int v = A[i];
        int j = i - 1;
        while ( j >= 0 && A[j] > v ) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A, N);
    }
}

int main() {
    int A[100], N;

    cin >> N;
    for ( int i = 0; i < N; i++ ) cin >> A[i];

    trace(A, N);
    insertionSort(A, N);

    return 0;
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
using namespace std;
ll n,t,x,y,m,q;

int main(){
      ios_base::sync_with_stdio(false); cin.tie(NULL);
      cin>>n>>x>>y;

      if(n<=x*y)cout<<"Yes";
      else cout<<"No";
      
}

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

using namespace std;

int main(void){
string S;
//int N[2];

/*for(int i = 0; i < 2; i++){
  cin >> S[i];
}

for(int i = 0; i < 2; i++){
  cin >> N[i];
}*/

cin >> S;
for(int i=0; i < S.size(); i++){
  S[i] = 'x';
}

cout << S << endl;
return 0;
}


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

int main(){
  int N,M;
  cin >> N >> M;
  int sum=0;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
    sum += A[i];
  }
  
  int X = sum/(4*M), count=0;
  if(sum%(4*M)!=0) X++;
  for(int i=0;i<N;i++){
    if(A[i]>=X) count++;
  }
  
  if(count>=M) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256