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

using namespace std;

#define EPS 1e-9
#define For(i,N) FOR(i,N)
#define Forr(i,a,b) FORR(i,a,b)
#define Fotr(i,a,b,c) FOTR(i,a,b,c)
#define FOR(i,N) FORR(i, 0, N)
#define FORR(i,a,b) FOTR(i, a, b, 1)
#define FOTR(i,a,b,c) for(int i=(a);i<(b);i+=(c))
#define FOREACH(i,x) for(__typeof__((x).begin())i=(x).begin();i!=(x).end();i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define BCHK(a,x) (((a)>>(x))&1)
#define BSET(a,x) ((a)|(1<<(x)))
#define BCLR(a,x) ((a)&(~(1<<(x))))
#define BTGL(a,x) ((a)^(1<<(x)))
#define FMT(...) (sprintf(CRTBUFF, __VA_ARGS__)?CRTBUFF:0)
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define cpp_io() {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define BUFFSIZE 30000
#define INF 1000000000
#define MAX 300010
#define MOD 1000000007
#define pb push_back
#define mkpr make_pair
#define pii pair<int, int>
#define PI acos(-1)
#define ll long long
#define fi first
#define si second
#define all(x) x.begin(), x.end()
#define double long double

char CRTBUFF[BUFFSIZE];
#define dbg(args...) {cerr<<"-->";debugger::call(#args,args);cerr<<"\n";}
struct debugger {
    static void call(const char* it) {}
    template<typename T, typename ... aT>
    static void call(const char* it, T a, aT... rest) {
        string b;
        for (; *it&&*it != ','; ++it) if (*it != ' ')b += *it;
        cerr << b << "=" << a << " ";
        call(++it, rest...);
    }
};

int A[1000];

int main(){
    cpp_io();
    #ifdef LOCAL
        read();
        //write();
    #endif


    int n;
    cin>>n;
    char c;
    while(n--){
        cin>>c;
        A[c] = 1;
    }
    int ans = 0;
    if(A['P'])ans++;
    if(A['W'])ans++;
    if(A['G'])ans++;
    if(A['Y'])ans++;

    if(ans<=3) cout<<"Three\n";
    else cout<<"Four\n";

}





















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

#define ll long long int
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt")  
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007

ll gcd(ll x, ll y){ 
	if(x<y) 
		swap(x,y); 
	if(x%y==0)
		return y;
	return gcd(y, x%y);
}

ll pwm(ll a, ll n){
	ll ans = 1;
	while(n>0){
		if(n%2==1){
			ans = (ans * a)%mod;
		}
		a = (a*a)%mod;
		n /= 2;
	}
	return ans%mod;
}

const int pwn = 100010;
ll pw[pwn];
void pwtwo(){
	pw[0] = 1;
	for(int i=1; i<pwn; i++){
		pw[i] = (pw[i-1]*2)%mod;
	}
}


ll gcdExtended(ll a, ll b, ll *x, ll *y); 
  
ll modInverse(ll a, ll m) 
{ 	
	if(a==1)
		return 1;
	//cout<<"mi "<<a<<" "<<m<<" ";
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1){
        //cout << "Inverse doesn't exist"<<endl; 
        return -1;
    }
    else
    { 
        // m is added to handle negative x 
        ll res = (x%m + m) % m; 
        //cout<<res<<endl;
        return res;
        // cout << "modular multiplicative inverse is " << res; 
    } 
} 
  
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
} 

ll fact[1010];
ll init(){
	fact[0] = 1;
	for(int i=1; i<1010; i++)
		fact[i] = (fact[i-1]*i)%mod;
}

ll ncr(ll n, ll r){
	ll ans = fact[n];

	//if(r!=0)
	ans = (ans*modInverse(fact[r], mod))%mod;
	// if(n-r!=0)
	ans = (ans*modInverse(fact[n-r], mod))%mod;

	return ans;
}

int main(){
	// finput;
	// foutput;
	fast;

	int n, x, i, j, k, y, z, w;
	string s;

	cin>>n;
	vector<int> vec;
	for(i=0; i<n; i++){
		cin>>x;
		vec.pb(x);
	}

	// int c = vec[0];
	int ans = 0;
	for(i=1; i<n; i++){
		if(vec[i]==vec[i-1]){
			ans++;
			vec[i] = -1;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import sys
n = int(input())
l = list(map(int,input().split()))

if n == 0:
    if l[0] == 1:
        print('1')
        sys.exit()
    else:
        print('-1')
        sys.exit()

if l[0]  != 0:
    print('-1')
    sys.exit()
    
count = 1
edge = 1
sum_ = sum(l)
for i in range(1,len(l)-1):
#     print(i-1, edge, count)

    sum_ -= l[i]
    
    if l[i] >= edge *2:
        print('-1')
        sys.exit()
    
    if edge * 2 - l[i] <= sum_:
        count += edge * 2
        edge = edge * 2 -l[i]
#         print(i, 'max', edge,count)
        continue

        
    if edge * 2 - l[i] > sum_:
        count += sum_ + l[i]
        edge = sum_
        
#         print(i, 'notmax', edge,count)
        continue

        
        
#n回目の処理
if not   l[len(l)-1] <= edge * 2:
    print('-1')
    sys.exit()
    
else:
    count +=   l[len(l)-1] 
print(count)
        
    
        
    

Measured memory_bytes: 20384
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;
typedef long long ll;

string S;
ll K;

int main() {
	cin >> S >> K;
	if (S[0] == S.back()) {
		if (count(S.begin(), S.end(), S[0]) == S.size()) {
			cout << (S.size() * K) / 2 << endl;
		}
		else {
			ll ans = 0;
			int pointer1 = 0;
			while (pointer1 + 1 < S.size() && S[pointer1] == S[pointer1 + 1])pointer1++;
			ans += (pointer1 + 1) / 2;
			int pointer2 = S.size() - 1;
			while (pointer2 - 1 >= 0 && S[pointer2] == S[pointer2 - 1])pointer2--;
			ans += ((S.size() - pointer2) / 2);
			
			ll cnt = 0;
			for (int i = pointer1 + 1; i <= pointer2 - 1; i++) {
				if (S[i] == S[i - 1]) {
					cnt++;
					i++;
				}
			}
			ans += cnt * K;
			
			ans += ((pointer1 + 1) + (S.size() - pointer2)) / 2 * (K - 1);
			cout << ans << endl;
		}
	}
	else {
		ll cnt = 0;
		for (int i = 1; i < S.size(); i++) {
			if (S[i] == S[i - 1]) {
				cnt++;
				i++;
			}
		}
		cout << cnt * K << endl;
	}
	return 0;
}

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

int main(){
	int n; cin >> n;
	
	int ma = 0;
	for(int i = 0; i < 1000; i++){
		for(int j = 2; j <= 1000; j++){
			if((int)pow(i, j) <= n) ma = std::max(ma, (int)pow(i, j));
			else break;
		}
	}
	
	cout << ma << endl;
	return 0;
}


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

#define int ll
#define FOR(i,n,k) for(int i=n;i<k;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int32_t main()
{
    IOS;
    int n,a = 1,b = 1;
    cin>>n;
    while(n--)
    {
        int x,y,c1,c2,c;
        cin>>x>>y;
        c1 = (a+x-1)/x;
        c2 = (b+y-1)/y;
        c = max(c1,c2);
        a = x*c;
        b = y*c;
    }
    cout<<a+b<<"\n";
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
b = 0
w = s.count(".")
l = [w]
for i in range(1, n + 1):
    if s[i - 1] == "#":
        b += 1
    if s[i - 1] == ".":
        w -= 1
    l.append(b + w)
print(min(l))

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

int main(){
  int N;
  cin >> N;
  vector<int> W(N);
  for(int i=0;i<N;i++){
    cin >> W.at(i);
  }
  vector<int> s(N+1, 0);
  for (int i = 0; i < N; ++i){
    s.at(i+1) = s.at(i) + W.at(i);
  }
  int x,div=1000000;
  int left,right;
  for(int i=1;i<=N;i++){
    left = s.at(i);
    right = s.at(N) - s.at(i);
    if(left <= right){
      x = right-left;
    }
    else{
      x = left-right;
    }
    if(div>=x){
      div=x;
    }
  }
  cout << div << endl;
}

Measured memory_bytes: 256
import numpy

def solve(string):
    n, *p = map(int, string.split())
    p = numpy.asarray(p)
    asc=(p[:-2] < p[1:-1]) & (p[1:-1] < p[2:])
    desc=(p[:-2] > p[1:-1]) & (p[1:-1] > p[2:])
    return str(sum(asc | desc))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 12492
include Math
a, b, h, m = gets.split.map(&:to_f)

hour = 30.0 * h + 0.5 * m
min = 6.0 * m
minm = [hour,min].minmax
ang = minm[1] - minm[0]
h = cos(ang / 180.0 * PI)
ans = sqrt(a**2.0 + b**2.0 - 2.0 * a * b * h)

puts sprintf("%.9f", ans)

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

int main(){
  int x,a,b;
  int a2,a3;
  cin>>x>>a>>b;
  if(a>x)
    a2=a-x;
  else
    a2=x-a;
  if(b>x)
    a3=b-x;
  else
    a3=x-b;
  if(a2>a3)
    cout<<'B'<<endl;
  else
    cout<<'A'<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, A: "List[int]"):
    A = sorted(A)
    accm = A[0]
    accp = A[-1]
    pas = deque(sorted([a for a in A[1:-1] if 0 <= a], reverse = True))
    mas = deque(sorted([a for a in A[1:-1] if a < 0]))

    result = []
    while 0 < len(pas):
        p = pas.popleft()
        result.append("{} {}".format(accm, p))
        accm -= p
    result.append("{} {}".format(accp, accm))
    accp -= accm

    while 0 < len(mas):
        m = mas.popleft()
        result.append("{} {}".format(accp, m))
        accp -= m
    result = [str(accp)] + result
    return result


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    result = solve(N, A)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26520
#include <bits/stdc++.h> 
using namespace std; 
 typedef long long int ll;
ll findTrailingZeros(ll n) 
{ 
    ll count = 0; 
  
    for (ll i = 5; n / i >= 1; i *= 5) 
        count += (n /(i*2)); 
  
    return count; 
} 
int main()
{
    ll n;
    cin>>n;
  if(n%2)
     cout<<0;
  else
    cout<<findTrailingZeros(n);
}

Measured memory_bytes: 256
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, K = getlist()
	A = getlist()
	B = []
	for i in range(N):
		val = abs(A[i])
		if A[i] > 0:
			B.append([val , 1])
		elif A[i] < 0:
			B.append([val, -1])
		else:
			B.append([val, 0])
	B = sorted(B)

	if N == K:
		ans = 1
		for i in range(N):
			ans *= A[i]
			ans %= con
		print(ans)
		return

	M = 0; p = 0; m = 0; Aplus = []; Aminus = []; zerocnt = 0
	for i in A:
		if i == 0:
			zerocnt += 1
		elif i > 0:
			Aplus.append(i)
			M += 1; p += 1
		else:
			Aminus.append(i)
			M += 1; m += 1
	Aplus.sort()
	Aminus.sort()

	# 0が絶対に入る場合
	if K > M:
		print(0)
		return
	# マイナスになるから絶対ゼロを入れる場合
	if zerocnt > 0 and M == m and K % 2 == 1:
		print(0)
		return
	# マイナスのみの時の処理
	if m == N:
		if K % 2 == 0:
			ans = 1
			for i in range(K):
				ans *= Aminus[i]
				ans %= con
			print(ans)
			return
		else:
			ans = 1
			for i in range(K):
				ans *= Aminus[-1 - i]
				ans %= con
			print(ans)
			return

	# マイナスと0のとき
	if m == M:
		if K % 2 == 0:
			ans = 1
			for i in range(K):
				ans *= Aminus[i]
				ans %= con
			print(ans)
			return
		else:
			print(0)
			return

	pindPre = -100; pindAfter = INF
	mindPre = -100;	mindAfter = INF
	# print(B)

	for i in range(N - K):
		if B[i][1] == 1:
			pindPre = i
		elif B[i][1] == -1:
			mindPre = i

	for i in range(N - 1, N - K - 1, -1):
		if B[i][1] == 1:
			pindAfter = i
		elif B[i][1] == -1:
			mindAfter = i

	cnt = 0
	ans = 1
	for i in range(K):
		ans *= B[-1 - i][0]
		ans %= con
		if B[-1 - i][1] == -1:
			cnt += 1

	if cnt % 2 == 0:
		print(ans)
		return
	else:
		# ans *= -1
		ans %= con
		if mindPre >= 0 and pindPre >= 0 and pindAfter <= N and mindAfter <= N:
			if B[mindPre][0] * B[mindAfter][0] <= B[pindPre][0] * B[pindAfter][0]:
				ans *= B[pindPre][0] * pow(B[mindAfter][0], con - 2, con)
				ans %= con
			else:
				ans *= B[mindPre][0] * pow(B[pindAfter][0], con - 2, con)
				ans %= con
			print(ans)
			return

		elif pindPre >= 0 and mindAfter <= N:
			ans *= B[pindPre][0] * pow(B[mindAfter][0], con - 2, con)
			ans %= con
			print(ans)
			return
		elif mindPre >= 0 and pindAfter <= N:
			ans *= B[mindPre][0] * pow(B[pindAfter][0], con - 2, con)
			ans %= con
			print(ans)
			return
		else:
			print(0)
			return


if __name__ == '__main__':
	main()

Measured memory_bytes: 118136
from collections import defaultdict
from bisect import bisect_left

N = int(input())
A = list(map(int, input().split()))

ctr = defaultdict(list)
for i in range(N):
    ctr[i + A[i]].append(i)

ans = 0
for i in range(N):
    v = i - A[i]
    if v in ctr:
        ans += bisect_left(ctr[v], i)

print(ans)


Measured memory_bytes: 119260
X, K, D = map(int, input().split())
X = abs(X)
N = X // D

base = X - min(N, K) * D

if K <= N:
    res = base
else:
    if (K - N) % 2 == 0:
        res = min(base, abs(base - 2 * D))
    else:
        res = min(abs(base - D), base + D)

print(res)

Measured memory_bytes: 9056
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <bitset>
#include <functional>
#include <queue>
#include <utility>
#include <map>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<string, PII> PSI;
const int INF = 1 << 29;	// 十分大きい値にする, INT_MAX にしないのはオーバーフロー対策

void subBin(vector<string> &vec, string str, int n)
{
	if (n == 0)
		vec.push_back(str);
	if (n > 0) {
		subBin(vec, str + "0", n - 1);
		subBin(vec, str + "1", n - 1);
	}
}

void solve()
{
	const int MAX_N = 10, MAX_M = 10;
	int N, M;	// N個のスイッチ、M個の電球
	int k[MAX_M];
	int s[MAX_M][MAX_N];
	int p[MAX_M];
	cin >> N >> M;
	FOR(i, 0, M) {
		cin >> k[i];
		FOR(j, 0, k[i]) {
			cin >> s[i][j];
		}
	}
	FOR(i, 0, M) {
		cin >> p[i];
	}

	vector<string> sw;
	subBin(sw, "", N);	// スイッチのパターンを列挙
	//vector<bool> bl_flag(sw.size(), false);
	// すべてのスイッチパターンを試す
	int ans = 0;
	FOR(i, 0, sw.size()) {
		//dump(sw[i]);
		bool flag = true;
		// すべての電球について調べる
		FOR(j, 0, M) {
			// 電球のすべてのスイッチの和を調べる
			int count = 0;
			FOR(l, 0, k[j]) {
				if (sw[i][s[j][l] - 1] == '1') {
					count++;
				}
			}
			//dump(count);
			//dump(p[j]);
			if (count % 2 != p[j]) {
				flag = false;
				break;
			}
		}
		if (flag == false) {
			sw.erase(sw.begin() + i);
			i--;
		}
	}

	/*
	FOR(i, 0, M) {
		int j;
		for (j = 0; j < sw.size(); j++) {
			int count = 0;
			FOR(l, 0, k[i]) {
				if (sw[j][s[i][l]] == '1') {
					count++;
				}
			}
			if (count / 2 != p[i]) {
				dump(i);
				FOR(m, 0, N) {
					cout << sw[j][m] << " ";
				}
				cout << endl;
				sw.erase(sw.begin() + j);
				j--;
			}
		}
	}
	*/
	cout << sw.size() << endl;
}

int main(void)
{
	solve();

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int x = Integer.parseInt(sc.next());
    int l[] = new int[n];
    int ans = 0;
    int y = 0;
    int cnt = 0;
    
    for (int i=0; i<n; i++) {
      l[i] = Integer.parseInt(sc.next());
    }

    for (int i=0; i<n; i++) {
      y += l[i];
      ans++;
      if (y > x) { break; }
      if (i == n-1) { ans++; }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
import java.util.*;
 
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int hugTime = 0;
    
    int sL = s.length();
    
    for ( int i = 0; i < sL/2; i++){
      char c1 = s.charAt(i);
      char c2 = s.charAt(sL-1-i);
      if(!(c1 == c2)){
        hugTime++;
      }
    }
    
    System.out.println(hugTime);
    
  }
}

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

int main(void){
	int n;
    string s;
  	cin >> n;
  	cin >> s;
  	if(n < s.length()) cout << s.substr(0, n) << "...";
    else cout << s;
	return 0;
}

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

int main()
{

    int A, B;
    cin >> A >> B;
    int ans = 0;
    for (int i = A; i <= B; ++i)
    {
        string S;
        S = to_string(i);
        if ((S[0] == S[4]) && (S[1] == S[3]))
        {
            ++ans;
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define  MAX 10000000

int n;
int A[MAX+1];

void maxheapify( int A[], int i)
{
  int left;
  int right;
  int change;
  int large;
  
  left = 2*i;
  right = 2*i+1;
  
  if( left <= n && A[left] > A[i] ){
    large = left;
  }
  else{
    large = i;
  }
  
  if( right <= n && A[right] > A[large] ){
    large = right;
  }
  
  if( large != i ){
    change = A[i];
    A[i] = A[large];
    A[large] = change;
    maxheapify(A,large);
  }
}



int main()
{
  int i;

  scanf("%d",&n);
  for( i = 1; i <= n ; i++){
    scanf("%d",&A[i]);
  }
  for( i = n/2; i >= 1; i-- ){
    maxheapify(A,i);
  }
  for( i = 1 ; i <= n ; i++){
    printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  return 0;
  
}




Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <tuple>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
//ll mod = 1000000007;
//ll mod = 998244353;

int main() {
	ll n, k;
	cin >> n >> k;
	ll l = -1, r = k + 1;
	while (r - l > 1) {
		ll mid = (l + r) / 2;
		ll cnt = 0;
		ll i = 0;
		ll base = mid;
		while (i < n && base > 0) {
			cnt += base;
			base /= 2;
			i++;
		}
		if (cnt > k) {
			r = mid;
		}
		else l = mid;
	}
	cout << l << endl;
}


Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#include <functional>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0スタート
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1スタート
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからb - 1まで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //aからb - 1まで
#define p(x) cout<<x<<endl  //xを改行付きで出力
const int INF = 1000000007;  //最大値兼MOD
//  cin.tie(0);
//  ios::sync_with_stdio(false);
typedef long long ll;
using namespace std;
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(){
  int n;
  cin >> n;
  int i = 2;
  while(1){
    if(n < pow(2,i)){
      cout<<pow(2,i - 1)<<endl;
      return 0;
    }
    i++;
  }
  return 0;
}


Measured memory_bytes: 3440
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=A*100
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
        cnt_D+=1
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(water,sugar)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define INF 2000000000
#define pb push_back 
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define double long double
 
using namespace std;

int n;
ll d;
pair<ll,ll>arr[200001];
ll A;
ll diff[200001];

int main()
{
    IOS;
    cin >> n >> d >> A;
    for(int i = 1; i <= n; i++)
        cin >> arr[i].first >> arr[i].second;
    sort(arr+1,arr+n+1);
    ll tot = 0;
    int j = 1;
    ll accsum = 0;
    for(int i = 1; i <= n; i++)
    {
        while((j <= n) &&  (abs(arr[j].first - arr[i].first) <= 2*d))
            j++;
        accsum += diff[i];
        ll x = arr[i].second + accsum;
        ll u;
        if(x <= 0)
            u = 0;
        else
            u = (x/A) + (bool(x%A));
        tot += u;
        if(j <= n)
            diff[j] += (A*u);
        accsum -= (A*u);
    }
    cout << tot;
}   

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;
ll mod = 1e9+7;

int main(){
    string s;
    ll d ;
    cin>>s>>d;
    ll n = s.size();
    vector<ll> k(n);
    for(int i=0;i<n;i++) k[i] = s[i]-'0';
    vector<vector<vector<ll> > > dp(n+1,vector<vector<ll> >(d,vector<ll>(2,0) ) );
    dp[0][0][0] = 1;
    for(int i=0;i<n;i++){
	for(int j=0;j<d;j++){
	    for(int l=0;l<10;l++) dp[i+1][(j+l)%d][1] += dp[i][j][1],dp[i+1][(j+l)%d][1]%=mod;
	    for(int l=0;l<k[i];l++) dp[i+1][(j+l)%d][1] += dp[i][j][0],dp[i+1][(j+l)%d][1]%=mod;
	    dp[i+1][(j+k[i])%d][0] += dp[i][j][0];
	    dp[i+1][(j+k[i])%d][0] %= mod;
	}
    }
    cout<<(dp[n][0][0] + dp[n][0][1] -1 + mod )%mod <<endl;
    return 0;
}


Measured memory_bytes: 55680
#include<bits/stdc++.h>
using namespace std;
int lo1, lo2, lo3, lo4, lo5, lo6, lo7, lo8, lo9, lo10, a[100], b[100], c[100], d[100], A[100];
int calc(int n, int q){
    int i, sc=0;
    for(i=0;i<q;i++){
        if(A[b[i]-1]-A[a[i]-1]==c[i]) sc+=d[i];
    }
    return sc;
}
int main(){
    long long n, m, q, sco=0, i, ans=0;
    cin >> n >> m >> q;
    for(i=0;i<q;i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    for(lo1=1;lo1<=m;lo1++){
        A[0]=lo1;
        for(lo2=lo1;lo2<=m;lo2++){
            A[1]=lo2;
            for(lo3=lo2;lo3<=m;lo3++){
                A[2]=lo3;
                for(lo4=lo3;lo4<=m;lo4++){
                    A[3]=lo4;
                    for(lo5=lo4;lo5<=m;lo5++){
                        A[4]=lo5;
                        for(lo6=lo5;lo6<=m;lo6++){
                            A[5]=lo6;
                            for(lo7=lo6;lo7<=m;lo7++){
                                A[6]=lo7;
                                for(lo8=lo7;lo8<=m;lo8++){
                                    A[7]=lo8;
                                    for(lo9=lo8;lo9<=m;lo9++){
                                        A[8]=lo9;
                                        for(lo10=lo9;lo10<=m;lo10++){
                                            A[9]=lo10;
                                            sco=calc(n, q);
                                            ans=max(sco, ans);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val seq = (1 to 6).map(_ => sc.nextInt())
    .groupBy[Int](x => x)
    .toSeq
    .map(_._2.length)
    .sorted

  println(if (seq == Seq(1, 1, 2, 2)) "YES" else "NO")
}


Measured memory_bytes: 25416
import itertools
N = int(input())
ans = 0
for i in range(3, 10):
    product = list(itertools.product(['3', '5', '7'], repeat=i))
    for li in product:
        if len(set(li)) == 3:
            if int(''.join(li)) <= N:
                ans += 1
print(ans)


Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1000000007;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x; cin >> x;
    cout << (x^1) << '\n';
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#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, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );

ll H,W;
vector< vector<char> > field (1005, vector<char>(1005) );
vector< vector<ll> > ans (1005, vector<ll>(1005,0) );
vector< vector<bool> > f_b (1005, vector<bool>(1005,false) );
queue<LP> q;
ll x,y,nx,ny;
ll A;
void solve(){
    A=0;
    while(!q.empty()){
        y=q.front().first;
        x=q.front().second;
        q.pop();
        for(int i=0;i<4;i++){
            nx=x+dx[i];
            ny=y+dy[i];
            if(0<=nx && nx<=W-1 && 0<=ny && ny<=H-1 && f_b[ny][nx]==false){
                //cout<<nx<<' '<<ny<<endl;
                f_b[ny][nx]=true;
                ans[ny][nx]=ans[y][x]+1;
                A=max(ans[ny][nx],A);
                q.push({ny,nx});
            }
        }
    }
}





int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>H>>W;
    FOR(i,0,H){
        cin>>s;
        FOR(j,0,W){
            field[i][j]=s[j];
            if(field[i][j]=='#'){
                //cout<<'!'<<endl;
                q.push({i,j});
                f_b[i][j]=true;
            }
        }
    }
    solve();
    cout<<A<<endl;
    /*cout<<endl;
    FOR(i,0,H){
        FOR(j,0,W){
            cout<<ans[i][j];
            if(j==W-1) cout<<endl;
        }
    }*/
}

Measured memory_bytes: 25780
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

class UnionFind {
private:
	int n, s;
	vector<int> p_id;
	vector<vector<int>> v;
public:
	UnionFind(int n = 0) { init(n); }
	void init(int arg_n) {
		n = s = arg_n;
		p_id.clear();
		v.clear();
		inc(i, n) { p_id.PB(i); v.EB(1, i); }
	}
	int id(int i) { return p_id.at(i); }
	bool same(int x, int y) { return (id(x) == id(y)); }
	bool unite(int x, int y) {
		x = id(x);
		y = id(y);
		if(x == y) { return false; }
		if(v[x].size() < v[y].size()) { swap(x, y); }
		for(auto & e: v[y]) { v[x].PB(e); p_id[e] = x; }
		v[y].clear();
		s--;
		return true;
	}
	const vector<int> & operator[](int i) { return v[id(i)]; }
	int size() { return s; }
	int get_n() const { return n; }
	const vector<vector<int>> & get_v() const { return v; }
};
ostream & operator<<(ostream & os, const UnionFind & uf) {
	inc(i, uf.get_n()) { os << i << ": "; for(auto & e: uf.get_v()[i]) { os << e << " "; } os << "\n"; }
	return os;
}

// ---- ----

const int M = 100000;
LL n, m, a[M], b[M], ans[M];

int main() {
	cin >> n >> m;
	inc(i, m) { cin >> a[i] >> b[i]; a[i]--; b[i]--; }
	
	UnionFind uf(n);
	LL s = n * (n - 1) / 2;
	dec(i, m) {
		ans[i] = s;
		if(! uf.same(a[i], b[i])) { s -= SI(uf[a[i]]) * SI(uf[b[i]]); }
		uf.unite(a[i], b[i]);
	}
	
	inc(i, m) { cout << ans[i] << "\n"; }
	
	return 0;
}


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

int main() {
  
  int N;
  cin >> N;
  
  // fを求める
  
  int M = N;
  int x = 100000000;
  int f = 0;
  
  for (int i = 0; i < 9; i++) {
    f += M / x;
    M -= (M / x) * x;
    if (i == 8) break;
    x /= 10;
  }
  
  // 倍数判定
  
  if (N % f == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
    n, a, b, c, d, e = map(int, readlines())
    mint = min(a, b, c, d, e)
    if n <= mint:
        r = 5
    else:
        r = 4 + ceil(n / mint)
    print(r)

if __name__ == '__main__':
    main()


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

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

  int l = (n - 1) * (n - 2) / 2;
  if (k > l) {
    cout << -1 << endl;
    return 0;
  }

  vector<pair<int, int>> uv;
  for (int i = 2; i <= n; i++) {
    uv.push_back(make_pair(1, i));
  }

  int cnt = 0;
  int c = 0;
  while (cnt < l - k) {
    int a = c / (n - 1) + 2;
    int b = c % (n - 1) + 2;
    if (a < b) {
      uv.push_back(make_pair(a, b));
      cnt++;
    }
    c++;
  }

  cout << uv.size() << endl;
  rep(i, uv.size()) printf("%d %d\n", uv[i].first, uv[i].second);
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	
	int N;
	cin>>N;
	if(N==1){
		cout<<"1"<<endl;
		return 0;
	}
	if(N>=2 && N<4){
		cout<<"2"<<endl;
		return 0;
	}
	if(N>=4 && N<8){
		cout<<"4"<<endl;
		return 0;
	}
	if(N>=8 && N<16){
		cout<<"8"<<endl;
		return 0;
	}
	if(N>=16 && N<32){
		cout<<"16"<<endl;
		return 0;
	}
	if(N>=32 && N<64){
		cout<<"32"<<endl;
		return 0;
	}
	if(N>=64){
		cout<<"64"<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pi 3.1415926536
#define loopj(n) for(int j=0;j<n;j++)
#define loopi(a,b,k) for(int i=a;i<b;i=i+k)
#define  deb(x) cout<<#x<<"  "<<x<<endl
int main()
{
	 int n=0,x=0,t=0;
	 cin>>n>>x>>t;
	 int q=n/x;
  		if((n%x)!=0)
          q++;
	 cout<<(q*t);
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
#define INF (1<<20)
typedef pair<int,int> P;
vector<P> node[5];
int X,Y;
char fie[1001][1001];
int gx,gy;

int vnums[5];

int dp[6][1001][1001];

inline int ab(int a){return a<0?-a:a;}

int solve(int no,int id,int zen,int zenid,int syo){
  //int ind=(no+syo+1)%5;
  //int k=(no+syo)%5;
  int res=INF;
  if(dp[no][id][zenid]!=-1) return dp[no][id][zenid];
  if(syo==4)
    return ab(gx-node[zen][zenid].first)+ab(gy-node[zen][zenid].second);
  if(id>=vnums[no])
    return dp[no][id][zenid]=INF;
  res=min(
	  solve((no+1)%5,1,no,id,syo+1)
	  +ab(node[zen][zenid].first-node[no][id].first)
	  +ab(node[zen][zenid].second-node[no][id].second),
	  solve(no,id+1,zen,zenid,syo)
	  );
  return dp[no][id][zenid]=res;
}

main(){
int sx,sy;
  while(1){
    scanf("%d %d",&X,&Y); getchar();
    if(!X && !Y) break;

    for(int i=0;i<Y;i++){
      for(int j=0;j<X;j++){
	//cin >> fie[j][i];
	//scanf(" %c",fie[j]+i);
	while((fie[j][i] = getchar())=='\n');
	if(fie[j][i]=='S'){
	  sx=j;
	  sy=i;
	  for(int k=0;k<5;k++)
	    node[k].push_back(P(sx,sy));
	}
      }
    }

    for(int i=0;i<Y;i++){
      for(int j=0;j<X;j++){

	if(fie[j][i]>='1' && fie[j][i]<='5') {
	  node[fie[j][i]-'1'].push_back(P(j,i));
	}

	if(fie[j][i]=='G'){
	  gx=j;
	  gy=i;
	}

      }
    }

    for(int i=0;i<5;i++) {
      vnums[i]=node[i].size();
      /*
      for(int ii = 0; ii < vnums[i]; ii++) {
	printf("(%d,%d) ", node[i][ii].first, node[i][ii].second);
      }
      puts("");
      */
    }

    int aaaa;
    int res=INF;
    for(int i=0;i<5;i++){
      memset(dp,-1,sizeof(dp));
      int ret = solve((i+1)%5,1,i,0,0);
      if( res > ret ) {
	res = ret;
	aaaa = i+1;
      }
    }

    if(res==INF) {
      puts("NA");
    } else {
      printf("%d %d\n",aaaa,res);
    }
    for(int i = 0; i < 5; i++) node[i].clear();
  }
}

Measured memory_bytes: 26088
#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define pc _putchar_nolock
#define mp make_pair
#define mt make_tuple
#define um unordered_map
#define inf (ll)9223372036854775807
#define sz(x) (int)x.size()
using namespace std;
using ll=long long int;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
void input(vector<int>&a,int n)
{
   rep(i,1,n)
   cin>>a[i];
}
void solve()
{
  int n; cin>>n; vector<int>d(n+1); input(d,n); 
  sort(all(d)); int k=n/2;
  cout<<d[k+1]-d[k]<<"\n"; return; 
  
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  while(t--)
  {
	 solve();
  }
  return 0;
}


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


void solve(long long N, long long K, std::vector<long long> p){
    long long sum = 0;
    for (int j = 0; j < K; j++) {
        sum += p[j] + 1;
    }
    long long result = sum;
    for (int i = 1; i < N - K + 1; i++)  {
        sum -= p[i - 1] + 1;
        sum += p[i + K - 1] + 1;
        result = max(result, sum);
    }
    printf("%lf\n", (double) result / 2);
}

// 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 N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll  unsigned long long
#define pub push_back
#define mp  make_pair  
using namespace std; 
ifstream fin("input.txt");

  
int main()
{
    int n ; 
  cin >> n ;
  map<string , int> mp ;
  while (n--)
  {   string str;
      cin >> str;
      mp[str]++;
  }
  
  cout<<"AC x "<<mp["AC"]<<endl;
  cout<<"WA x "<<mp["WA"]<<endl;
  cout<<"TLE x "<<mp["TLE"]<<endl;
  cout<<"RE x "<<mp["RE"]<<endl;
    
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
const int maxn = 333;
long long f[maxn][maxn], g[maxn][maxn];
int main(){
  int n; cin >> n;
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) {
    cin >> f[i][j]; g[i][j] = f[i][j];
  }
  for(int k = 0; k < n; k++) for(int i = 0; i < n; i++) for(int j = 0; j < n; j++)
    g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
  bool good = true;
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) good &= f[i][j] == g[i][j];
  if(!good) cout << -1 << endl;
  else {
    long long ans = 0;
    for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) {
    	bool someone = false;
      	for(int k = 0; k < n; k++) if(k != i && k != j){
          if(f[i][k] + f[k][j] == f[i][j]) someone = true;
        }
      	if(!someone) ans += f[i][j];
    }
    cout << ans/2 << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
template <class X> void print(X x) { cout << x << endl; }
void print(vl x) {
    for(ll i : x) {
        cout << i << " ";
    }
    cout << endl;
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
ll codeforces = 1;
string S, T;
vl A, B;
void input() {
cin>>n>>k;
rep(i,n){
    cin>>a;
    A.pb(a);
}
}
void solve() {
    rep(i,n-k){
        if(A[i]<A[i+k])print("Yes");
        else print("No");
    }
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    while(codeforces--) {
        solve();
    }
}

Measured memory_bytes: 5320
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int n, int left, int mid, int right){
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(i = 0; i < n1; i++) L[i] = A[left + i];
  for(i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k = left; k < right; k++){
    if(L[i].value <= R[j].value) A[k] = L[i++];
    else A[k] = R[j++];
  }
}

void mergeSort(struct Card A[], int n, int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int partition(struct Card A[], int n, int p, int r){
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p - 1;
  for(j = p; j < r; j++){
    if(A[j].value <= x.value){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i + 1];
  A[i + 1] = A[r];
  A[r] = t;
  return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r){
  int q;
  if(p < r){
    q = partition(A, n, p, r);
    quickSort(A, n, p, q - 1);
    quickSort(A, n, q + 1, r);
  }
}

int main(){
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A, n, 0, n);
  quickSort(B, n, 0, n - 1);

  for(i = 0; i < n; i++){
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable == 1) printf("Stable\n");
  else printf("Not stable\n");
  for(i = 0; i < n; i++){
    printf("%c %d\n", B[i].suit, B[i].value);
  }

  return 0;
}

Measured memory_bytes: 2952
#include<stdio.h>
int main(){
	int m,f,r;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r==-1)break;
		if(m==-1 || f==-1)printf("F\n");
		else if(m+f>=80)printf("A\n");
		else if(m+f>=65 && m+f<80)printf("B\n");
		else if(m+f>=50 && m+f<65)printf("C\n");
		else if(m+f>=30 && m+f<50){
			if(r>=50)printf("C\n");
			else printf("D\n");
		}
		else if(m+f<30)printf("F\n");
	}
	return 0;
}

Measured memory_bytes: 2656
class UnionFind:
  def __init__(self,n):
    *self.table,=range(n)
    self.rank=[1]*n
  def root(self,x):
    if self.table[x]==x:
      return x
    else:
      self.table[x]=self.root(self.table[x])
      return self.table[x]
  def unite(self,x,y):
    x=self.root(x)
    y=self.root(y)
    if x!=y:
      if self.rank[x]<self.rank[y]:
        x,y=y,x
      self.rank[x]+=self.rank[y]
      self.table[y]=x
  def same(self,x,y):
    return self.root(x)==self.root(y)
  def size(self,x):
    return self.rank[self.root(x)]
(n,m),_,*e=[map(int,t.split())for t in open(0).readlines()]
u=UnionFind(n)
a=[n*~-n//2]
for x,y in e[::-1]:
  x,y=x-1,y-1
  t=a[-1]
  if not u.same(x,y):
    t-=u.size(x)*u.size(y)
  a.append(t)
  u.unite(x,y)
print(*a[::-1],sep='\n')

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

int main(){
    int n,d;
    cin>>d>>n;
    if(d==0){
        if(n!=100)cout<<n<<endl;
        else cout<<101<<endl;
    }
    else if(d==1){
        if(n!=100)cout<<100*n<<endl;
        else cout<<10100<<endl;
    }
    else if(d==2){
        if(n!=100)cout<<10000*n<<endl;
        else cout<<1010000<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,a[300000],ans=0;
  cin>>n;
  for(int i=0;i<3*n;i++)cin>>a[i];
  sort(a,a+3*n);
  for(int i=n;i<3*n;i+=2)
    ans+=a[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    long sum = 0;
    long[] l = new long[c.length+1];
    long[] r = new long[c.length+1];
    for(int i=1;i<=c.length;i++)if(c[i-1]=='<')l[i]=l[i-1]+1;
    for(int i=c.length-1;i>=0;i--)if(c[i]=='>')r[i]=r[i+1]+1;
    for(int i=0;i<=c.length;i++)sum+=Math.max(l[i],r[i]);
    System.out.println(sum);
  }
}


Measured memory_bytes: 37004
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  int a[n];
  rep(i,n) cin>>a[i];
  int cnt = 1;
  int diff;
  int up = 1;
  FOR(i, 1, n) {
    if(i == 1) {
      diff = a[1] - a[0];
    } else {
      if((diff < 0 && (a[i] - a[i-1]) > 0) || (diff > 0 && (a[i] - a[i-1]) < 0)) {
        cnt++;
        if(i < n-1) diff = a[i+1] - a[i];
      } else if((a[i] - a[i-1] != 0)){
        diff = a[i] - a[i-1];
      }
    }
  }
  cout << cnt << endl;

  return 0;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/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);}
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;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	string s, t;
	cin >> s >> t;
	yorn(s == t.substr(0, s.size()));
	return 0;
}

Measured memory_bytes: 3652