akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define N	 100
void solve(){
	int a, b, c;
	cin>>a>>b>>c;
	if(a==b)cout<<c<<endl;
	else if(a==c) cout<<b<<endl;
	else cout<<a<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
import copy

n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for y in range(m)]
t = copy.copy(array)


def solver(start, array, visited, cnt):
    if visited[start]:
        return cnt
    else:
        visited[start] = True

    for i in array[start]:
        if len(set(visited)) == 1:
            return 1
        else:
            cnt = solver(i, array, visited, cnt)

    return cnt


res2 = 0
for i in range(m):
    tmp = array[:i] + array[i + 1:]
    modify = [[] for x in range(n + 1)]
    for value1, value2 in tmp:
        modify[value1].append(value2)
        modify[value2].append(value1)

    visited = [False if x != 0 and x != 1 else True for x in range(n + 1)]
    if not modify[1]:
        continue

    res = 0
    for i in modify[1]:
        res += solver(i, modify, visited, 0)
    else:
        res2 += 1 if res > 0 else 0

print(m - res2)


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

int main() {
	int a,b,c;
	int n = 0;
	scanf("%d %d %d",&a,&b,&c);

	for (int i = a;i <= b;i++) {
		if (c%i == 0) {
			n++;
		}
	}
	printf("%d\n",n);

	return 0;
}


Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N;
int t[110], v[110];
int sum[200010];
int memo[20010];
int tmpl[200010], tmpr[200010];

int main(void) {
	cin >> N;
	rep(i, N) cin >> t[i];
	rep(i, N) cin >> v[i];
	if(N == 1) {
		double top = (double)t[0] / 2.;
		if(top <= v[0]) {
			printf("%.6f\n", (double)t[0] * top / 2.0);
			return 0;
		}
	}
	sum[0] = 0;
	rep(i, N) sum[i + 1] += sum[i] + t[i];
	rep(i, 20010) memo[i] = INF;
	memo[0] = memo[sum[N]] = 0;
	rep(i, N) {
		reps(j, sum[i], sum[i + 1] + 1) chmin(memo[j], v[i]);
		// reps(j, sum[i], sum[i + 1] + 1) tmp[j] = v[i];
		reps(j, sum[i] + 1, sum[i + 1]) tmpl[j] = tmpr[j] = v[i];
		tmpr[sum[i]] = tmpl[sum[i + 1]] = v[i];
	}
	tmpl[0] = tmpr[0] = tmpl[sum[N]] = tmpr[sum[N]] = 0;

	/*
	printf("sum[N] %d\n", sum[N]);
	rep(i, sum[N] + 1) printf("%d ", memo[i]);
	printf("\n");
	*/

	rep(i, N + 1){
		for (int k = sum[i]; k >= 0; --k) {
			int dist = sum[i] - k;
			int dv = tmpr[sum[i]] + dist;
			if(dv > 100) break;
			chmin(memo[k], dv);
		}
	}
	/*
	printf("\n");
	rep(i, sum[N] + 1) printf("%d ", memo[i]);
	printf("\n");
	*/

	rep(i, N + 1){
		// printf("sum %d tmp %d\n", sum[i], tmpl[sum[i]]);
		for (int k = sum[i]; k <= sum[N]; ++k) {
			int dist = k - sum[i];
			int dv = tmpl[sum[i]] + dist;
			if(dv > 100) break;
			chmin(memo[k], dv);
		}
	}
	/*
	rep(i, sum[N] + 1) printf("%d ", memo[i]);
	printf("\n");

	printf("tmpl\n");
	rep(i, sum[N] + 1) printf("%d ", tmpl[i]);
	printf("\n");
	printf("tmpl\n");
	rep(i, sum[N] + 1) printf("%d ", tmpr[i]);
	printf("\n");
	*/

	double ans = 0;
	rep(i, sum[N] + 1) ans += memo[i];
	rep(i, sum[N]) if(memo[i] == memo[i + 1] && memo[i] < tmpr[i] && memo[i + 1] < tmpl[i + 1]) ans += 0.250;
	printf("%.6f\n", ans);
	return 0;
}

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

int main() {
  int H, W;
  
  cin >> H >> W;

  string m = "";
  for (int i = 0; i < H; i++) {
    string s;

    cin >> s;

    m += s;
  }

  for (int i = 0; i < H * W; i++) {
    if (m.at(i) == '#') {
      cout << '#';
    } else if (m.at(i) == '.')  {
      int count = 0;
      int x = i % W;
      int y = i / W;

      if (x - 1 >= 0 && y - 1 >= 0 && m.at(x - 1 + (y - 1) * W) == '#') {
        count++;
      }
      if (y - 1 >= 0 && m.at(x + (y - 1) * W) == '#') {
        count++;
      }
      if (x + 1 < W && y - 1 >= 0 && m.at(x + 1 + (y - 1) * W) == '#') {
        count++;
      }
      if (x - 1 >= 0 && m.at(x - 1 + y * W) == '#') {
        count++;
      }
      if (x + 1 < W && m.at(x + 1 + y * W) == '#') {
        count++;
      }
      if (x - 1 >= 0 && y + 1 < H && m.at(x - 1 + (y + 1) * W) == '#') {
        count++;
      }
      if (y + 1 < H && m.at(x + (y + 1) * W) == '#') {
        count++;
      }
      if (x + 1 < W && y + 1 < H && m.at(x + 1 + (y + 1) * W) == '#') {
        count++;
      }

      cout << count;
    }

    if ((i + 1) % W == 0) {
      cout << endl;
    }
  }
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

	ll cnt=0;
	while(1){
		if(a%2!=0||b%2!=0||c%2!=0){
			cout<<cnt<<endl;
			break;
		}
		if(a==b&&b==c){
			cout<<-1<<endl;
			break;
		}
		ll aa = (b+c)/2;
		ll bb = (c+a)/2;
		ll cc = (a+b)/2;
		a=aa;b=bb;c=cc;
		cnt++;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#include <vector>

// constexpr std::int64_t INF = 1ull << 50;
constexpr int INF = 1 << 20;

auto main() -> int {
  int X;
  std::cin >> X;

  if (X == 7 || X == 5 || X == 3) {
    std::cout << "YES\n";
  } else {
    std::cout << "NO\n";
  }
}


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

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

int N, M, h[100], m[100], s[100], k[100], g[100], t[100], x[200];

void solve() {
    cin >> N; rep(i, N) cin >> h[i] >> m[i];
    cin >> M; rep(i, M) cin >> k[i] >> g[i];
    rep(i, N) s[i] = h[i] * 60 + m[i];
    rep(i, M) t[i] = k[i] * 60 + g[i];
    merge(s, s+N, t, t+M, x);
    int t = unique(x, x+N+M) - x;
    rep(i, t) {
        printf("%0d:%02d", x[i]/60, x[i]%60);
        printf("%c", " \n"[i==t-1]);
    }
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    solve();
}


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

int main() {
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (a.at(i) == b.at(i) && b.at(i) == c.at(i)) continue;
        else if (a.at(i) == b.at(i) || a.at(i) == c.at(i) || b.at(i) == c.at(i)) cnt++;
        else cnt += 2;
    }
    cout << cnt << endl;
}   

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

typedef long long ll;
const int N = 1e5+5 , MOD = 1e9+7;
const ll inf = 1e16;






int main(void){

	ll n,cnt=0;

	cin >> n;

	while(n--){

		ll l,r;

		cin>>l>>r;

		cnt+=r-l+1;

	}

	cout<<cnt;
   
  	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
main(){
	int n;
	while(cin>>n){
		int d[n],d2[n],def,a[2];
		for(int i=0;i<=n;++i)cin>>d[i];
		for(int i=0;i<=n;++i){
			for(int j=0,c=0;j<=n;++j){
				if(i!=j){
					d2[c]=d[j];
					c++;
				}
			}
			for(int j=0;j<n-1;++j){
				if(j==0)def=d2[j+1]-d2[j];
				else if(def!=d2[j+1]-d2[j])break;
				if(j==n-2){
					cout<<d[i]<<endl;
					i=n+1;
				}
			}
		}
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long
#define pb push_back
const ll mod=1e9+7;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i>=b;i--)
int a[55];
int main(int argc, char** argv) {
	ll n,a,b;
	cin>>n>>a>>b;
	if(a%2==b%2)
	{
		cout<<abs(b-a)/2;
	}
	else
	{
		ll ans=min(max(n-b,n-a),max(a-1,b-1));
		ans=min(ans,min(n-b,n-a)+1+(abs(b-a)-1)/2);
		ans=min(ans,min(a-1,b-1)+1+(abs(b-a)-1)/2);
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 256
from math import gcd
from functools import reduce
N = int(input())
*A, = map(int, input().split())

MAX_N = max(A)+5
primes = list(range(MAX_N+1))
for i in range(2, int(MAX_N**0.5)+1):
    if primes[i] < i:
        continue
    for j in range(2*i, MAX_N+1, i):
        primes[j] = i


def check():
    S = set()
    for a in A:
        T = set()
        while True:
            p = primes[a]
            if p != 1 and p in S:
                return False
            T.add(p)
            if p == a:
                break
            a //= p
        S |= T
    return True


if check() or all(a == 1 for a in A):
    print('pairwise coprime')
elif reduce(gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 199368
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int start, end;
	start = max(a, c);
	end = min(b, d);

	cout << max(0, end - start) << endl;

	return 0;
}

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

using namespace std;

int descrescator(int a, int b)
{
    return a > b;
}

int doiLaN;
vector <int> s(1 << 18), goodSlimes, viz(1 << 18, 0);

int checkFather(int l)
{
    int length = l, weAreGoodHere = 0;
    int poz = 0, nr = 0, n = doiLaN;
    //cout << length << " " << n << "\n";

    for (int i = n - 1; i >= 0; i--)
    {
        //cout << viz[i] << " " << i << "\n";
        if (viz[i] == 0)
        {
            //cout << goodSlimes[poz] << " " << s[i] << "\n";
            if (goodSlimes[poz] > s[i])
            {
                goodSlimes.push_back(s[i]);
                viz[i] = 1;
                poz++;
            }
            if (poz == length)
            {
                return 1;
                i = n + 1;
            }
        }
        if (i == 0)
        {
            return 0;
        }


    }

    sort(goodSlimes.begin(), goodSlimes.end(), descrescator);
    return 1;
}

int main()
{
    int n;

    cin >> n;

    doiLaN = 1 << n;

    for (int i = 0; i < doiLaN; i++)
    {
        cin >> s[i];
    }
    //cout << s[0] << " ";

    sort(s.begin(), s.begin() + doiLaN);

    //cout << s[0];
    int poz = 0;
    goodSlimes.push_back(s[doiLaN - 1]);
    viz[doiLaN - 1] = 1;

    while(poz < n)
    {
        int l = goodSlimes.size();
        if (checkFather(l) == 0)
        {
            cout << "No\n";
            return 0;
        }
        sort(goodSlimes.begin(), goodSlimes.end(), descrescator);
        poz++;
    }

    cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<double> x(N);
  for(int i=0; i<N; i++){
    cin >> x.at(i);
  }

  double p = accumulate(x.begin(), x.end(), 0) / N;
  int int_p1 = (int)p;
  int int_p2 = int_p1 + 1;

  int ans1 = 0;
  int ans2 = 0;
  for(int i=0; i<N; i++){
    ans1 += (x.at(i) - int_p1)*(x.at(i) - int_p1);
    ans2 += (x.at(i) - int_p2)*(x.at(i) - int_p2);
  }

  cout << min(ans1,ans2) << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int n, a, cnt = 0;
    cin >> n;
    rep(i, n) {
        cin >> a;
        if (i % 2 == 0)if (a % 2 == 1)cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3632
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int a=s.nextInt();
		for(int i=0;i<a;i++){
			String command=s.next();
			String str=s.next();
			for(int j=command.length()-1;j>=0;j--){
				switch(command.charAt(j)){
					case 'J':
						str=str.charAt(str.length()-1)+str.substring(0,str.length()-1);
						break;
					case 'C':
						str=str.substring(1)+str.charAt(0);
						break;
					case 'E':
						if(str.length()%2==0)
							str=str.substring(str.length()/2)+str.substring(0,str.length()/2);
						else str=str.substring(str.length()/2+1)+str.charAt(str.length()/2)+str.substring(0,str.length()/2);
						break;
					case 'A':
						String n="";
						for(int k=str.length()-1;k>=0;k--)n+=str.charAt(k);
						str=n;
						break;
					case 'P':
						for(int k=0;k<str.length();k++){
							if('1'<=str.charAt(k)&&str.charAt(k)<='9'){
								str=str.substring(0,k)+(char)(str.charAt(k)-1)+str.substring(k+1);
							}else if(str.charAt(k)=='0')str=str.substring(0,k)+'9'+str.substring(k+1);
						}
						break;
					case 'M':
						for(int k=0;k<str.length();k++){
							if('0'<=str.charAt(k)&&str.charAt(k)<='8'){
								str=str.substring(0,k)+(char)(str.charAt(k)+1)+str.substring(k+1);
							}else if(str.charAt(k)=='9')str=str.substring(0,k)+'0'+str.substring(k+1);
						}
						break;
				}
			}
			System.out.println(str);
		}
	}
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
	int i,j,m,n;
	int A[100][100],b[100],sum[100];
	
	scanf("%d%d",&n,&m);

	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&A[i][j]);
		}
	}

	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}

	for(i=0;i<n;i++){
		sum[i]=0;
		for(j=0;j<m;j++){
			sum[i]+=A[i][j]*b[j];
		}
		printf("%d\n",sum[i]);
	}

	return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    vector<bool>IsPrime(MAX+1,true);
    vector<int>Prime(MAX+1,0); //Primearray
    int Primecounter =0;                  //Primearray counter;
    for(int i = 2; i<MAX+1;i++){
        if(IsPrime[i]){
            for(int j = 2;i*j<MAX;j++)
                IsPrime[i*j] = false;//?´???°??????Primearray???????´??????????????????°?????¨???false???
            Prime[Primecounter] = i;
            Primecounter++;
        }
    }
    int n;
    while(cin>>n,n){
        int maxi=0;
        for(int i=n; i>=2; i--){
            if(IsPrime[i]&&IsPrime[i-2]){
                cmax(maxi,i);
                break;
            }
        }
        cout<<maxi-2<<" "<<maxi<<endl;
    }
}

Measured memory_bytes: 42948
#include "bits/stdc++.h"

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int main() {
	char o[50], e[50];
	scanf("%s %s", o, e);
	rep(i, max(strlen(o), strlen(e))) {
		if (o[i] != '\0') printf("%c", o[i]);
		if (e[i] != '\0') printf("%c", e[i]);
	}
	printf("\n");
	return 0;
}

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

long long GCD(long long x, long long y) {
    return (y ? GCD(y, x%y) : x);
}

int main() {
    long long A, B;
    cin >> A >> B;
    long long G = GCD(A, B);
    cout << A/G * B << endl;
}

Measured memory_bytes: 256
// う　し　た　ぷ　に　き　あ　く　ん　笑
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    int ans = 64;
    for (int i = 0; i < n; i++) {
        int count = 0;
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            count++;
        }
        ans = min(count, ans);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3552
N = int(input())
S = []
for i in range(N):
    temp = input()
    S.append(''.join(sorted(temp)))
S.sort()
row = 1
ans = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        row += 1
    else:
        ans += (row*(row-1) // 2)
        row = 1
if row > 1:
    ans += (row*(row-1) // 2)
print(str(ans))

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

int n;
int main() {
    scanf("%d",&n);
    int ans = n/3;
    if(n%3 == 1 && n%3 == 2) ans++;
    pout(ans);
    return 0;    
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char a[4][105];
int pos[4];
int len[4];
int Next(char a) {
	if(a=='a') return 1;
	if(a=='b') return 2;
	return 3;
}
char na(int x) {
	if(x==1) return 'A';
	if(x==2) return 'B';
	return 'C';
}
int main()
{
	scanf("%s%s%s",a[1],a[2],a[3]);
	for(int i=1;i<=3;i++)
		len[i]=strlen(a[i]);
	int nw,Ne=1;
	while(1) {
		nw=Ne;
		if(pos[nw]==len[nw]) {
			printf("%c",na(nw));
			return 0;
		}
		pos[nw]++;
		Ne=Next(a[nw][pos[nw]-1]);
	}
}

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

using namespace std;

int main() {
  int n;
  string s;
  cin >> n;
  int a = 0, b = 0, c = 0, d = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "AC") a++;
    if (s == "WA") b++;
    if (s == "TLE") c++;
    if (s == "RE") d++;
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;

  return 0;
}

Measured memory_bytes: 3552
#include<stdio.h>
int main()
{
	int A,B,C,D,max,min,s;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	min=B<D?B:D;
	max=A>C?A:C;
	s=min-max;
	if(s>0)  printf("%d\n",s);
	else printf("0\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int N, T;
int main(){
    cin >> N >> T;
    int ans = 1e9;
    for(int i = 0; i < N; i++){
        int c, t;
        cin >> c >> t;
        if(t <= T){
            ans = min(ans, c);
        }
    }
    if(ans == 1e9)cout<<"TLE" << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
function main(input) {

  var input = input.split(' ');

  var answer = Math.pow(100, input[0]) * input[1];
  if(input[1] == 100) {
  	answer += Math.pow(100, input[0]);
  }

  console.log(answer);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
using namespace std;

int n;
int a, cnt;

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	ll g = gcd(x, y);
	return x / g * y;
}

int main(){
	cnt = 0;
	cin >> n;
	lp(n) {
		cin >> a;
		cnt += a;
		cnt--;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
K = [0] * N
A = [None] * N
items = {}

for i in range(1, M+1):
  items[i] = 0

for i in range(N):
  TMP = list(map(int, input().split()))
  K[i] = TMP[0]
  A[i] = TMP[1:]

for i in range(N):
  for j in range(len(A[i])):
    items[A[i][j]] += 1

print(len([v for v in items.values() if v == N]))



Measured memory_bytes: 38256
#include<bits/stdc++.h>
        #define F first
        #define S second
        using ll = long long;
        const ll mod = 1000000007;
        const ll infi = 1000000000000000;
        const ll md = 998244353;
        using namespace std;
        using vl = vector<ll>;
        using pll =  pair<ll,ll>;
      
        
        void  solve(){
          int x,y;
          cin>>x>>y;
          cout<<6-x-y;
        }
      
        int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            
            solve();
            
            return 0;
        }

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

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

//main code

int main(int argc, char const* argv[])
{
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
        
    long long res = 0;
    for (int d = 60; d >= -1; --d) { // d = -1 は X = K の場合
        if (d != -1 && !(K & (1LL<<d))) continue;
        
        long long tmp = 0;
        for (int e = 60; e >= 0; --e) {
            long long mask = 1LL<<e;
            int num = 0;
            for (int i = 0; i < N; ++i) if (A[i] & mask) ++num;
            
            if (e > d) {
                if (K & mask) tmp += mask * (N - num);
                else tmp += mask * num;
            }
            else if (e == d) {
                tmp += mask * num;
            }
            else {
                tmp += mask * max(num, N - num);
            }
        }
        res = max(res, tmp);
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
/*
My heart’s beating faster
I know what I’m after
 
I’ve been standing here my whole life
Everything I’ve seen twice
Now it’s time I realized
It’s spinning back around now
On this road I’m crawlin’
Save me 'cause I’m fallin’
Now I can’t seem to breathe right
'Cause I keep runnin' runnin' runnin' runnin'
Runnin' runnin' runnin' runnin'
Runnin' from my heart
*/
 
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define nt _int128
#define fir first
#define sec second
#define slow_as_snail ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debugged cout<<"debugged\n";
#define inf 0x3f3f3f3f
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end() 
 
const ll mod = 1000000007;
#define mx 10000005
const ll mxi = 100005;

int main()
{
    slow_as_snail;
    ll t;
    cin>>t;
    ll a = 0,b=0,c=0,d=0;
    ll x = t;
    while(t--)
    {
        string str;
        cin>>str;
        if(str=="AC")
        a++;
        else if(str=="WA")
        b++;
        else if(str=="TLE")
        c++;
        else
        d++;
    }
    cout<<"AC x "<<a<<"\n";
    cout<<"WA x "<<b<<"\n";
    cout<<"TLE x "<<c<<"\n";
    cout<<"RE x "<<d<<"\n";
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 3005;

int main() {
   string s;
   cin >> s;
   int ans = 0;
   for(int i=0, j=0; s[i]; i++) {
      if(s[i] == 'R') j++;
      else j = 0;
      ans = max(ans, j);
   }
   cout << ans << endl;
}


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

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

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N; cin >> N;
	double sum = 0;
	for(int i = 0; i < N; i++){
		double A; cin >> A;
		sum += (1 / A);
	}
	
	double ans = 1 / sum;
	cout << ans << endl;
}

Measured memory_bytes: 256
h = int(input())
w = int(input())
n = int(input())

lo = max(h,w)
lp = min(h,w)

cnt_h = 0

cnt = 0
tmp = 0
for _ in range(h*w):
    if tmp < n and cnt_h <= w:
        cnt_h += 1
        tmp += lo
        cnt += 1
    elif tmp < n and cnt_h>w:
        tmp += lp - cnt_h
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int l(int a){int cnt=0;for(;a%2==0;cnt++)a /= 2;return cnt;}
int main(){int n,a,b=32;cin>>n;for(int i=0;i<n;i++){cin>>a;b=min(b,l(a));}cout << b << endl;return 0;}

Measured memory_bytes: 256
import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    A, B = min(a, b), max(a, b)

    while True:
        mod = B % A
        if mod == 0:
            gcd = A
            break
        else:
            A, B = mod, A
    lcm = gcd * (a / gcd) * (b / gcd)

    print '%d %d' % (gcd, lcm)

Measured memory_bytes: 4208
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S, T; cin >> S >> T;
  int n = S.size();
  bool  flag = true;
  REP(i, n){
    if(S[i] != T[i]) flag = false;
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3612
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res


N,K=LI()
PS=LI()

PS.sort()
print(sum(PS[:K]))


Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/apc001_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<ll> a(N), b(N);
  ll suma = 0, sumb = 0;
  rep(i, N) {
    cin >> a[i];
    suma += a[i];
  }
  rep(i, N) {
    cin >> b[i];
    sumb += b[i];
  }

  ll ans = 0;
  ll tot = sumb - suma;
  rep(i, N) {
    if (a[i] < b[i]) ans += ceil((double)(b[i] - a[i]) / 2);
  }

  cout << (ans <= tot ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3784
#pragma GCC optimize("Ofast") 

////////////////////////////////////////////////////////////////////////////////

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define bew ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mod (long)(1e9+7)
#define ip(ar,n) for(int i=0;i<n;++i)cin>>ar[i];
#define op(ar,n) for(int i=0;i<n;++i)cout<<ar[i]<<" ";
#define print(...) for(auto xas:{__VA_ARGS__})cerr<<xas<<" ";
#define test int t;cin>>t;while(t--)
#define tar(x) int x;cin>>x;
#define fil(ar,val) memset(ar,val,sizeof ar)
#define loop(n) for(int i=0;i<n;++i)
#define coutd(x,y) printf("%0.y lf",x);

////////////////////////////////////////////////////////////////////////////////

typedef vector<int> vec; 
typedef pair<int, int> pa; 
typedef vector<pa> vecp; 
typedef set<int> se;
typedef map<int,int> ma;

////////////////////////////////////////////////////////////////////////////////


bool isprime(int n)
{
    if(n<=1)
        return false;
    for(int i=2;i*i<=n;++i)
    if(n%i==0)
        return false;
    return true;
}

int expo(int a,int n)
{
    if(n==0)
        return 1;
    if(n==1)
        return a;
    int tmp=expo(a,n/2);
    tmp=(tmp*tmp)%mod;
    if(n&1)
        tmp=(tmp*a)%mod;
    return tmp;
}


////////////////////////////////////////////////////////////////////////////////



signed main() {
bew;
    tar(n);
    vec ar(n+1,0);
    
    loop(n-1)
    {
        tar(tmp);
        ++ar[tmp];
    }
    
    for(int i=1;i<=n;++i)
    {
        cout<<ar[i]<<endl;
        
        
    }


return 0;
}

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

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());

    vector<int> count(100001);
    int ans=0;
    for(int i=0; i<n; i++){
        if(a.at(i)>100000) ans++;
        else count.at(a.at(i))++;
    }
    
    for(int i=1; i<=100000; i++){
        if(count.at(i)<i) ans+=count.at(i);
        else ans+=count.at(i)-i;
    }

    cout << ans << endl;
}

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

using namespace std;

const int N = 105;

int n, a[N], x;

int main(){
    scanf("%d %d", &n, &x);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);

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

    if (x > 0) ans--;
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int H, W;
  int h, w;

  cin >> H >> W >> h >> w;
  cout << (H * W) - ((h * W) + (w * (H - h))) << endl;
  return 0;
}



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

int main(){
  long long int k, n; cin >> n >> k;
  long long int div = n/k;
  long long int out1 = abs( n - div*k);
  long long int out2 = abs( n - (div+1)*k);
  cout << min(out1,out2) << endl;
  return 0;
 }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <iomanip>

using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
// #define req(j, n) for (ll j = 1; j < (n+1); j++)
// #define rer(k, n) for (ll k = 1; k < (n+1); k++)


int main()
{
    int x;
    cin >> x;
    int k=1;
    bool k_bool = false;
    while (k_bool == false) {
        if (k*x % 360 == 0) {
            cout << k << endl;
            k_bool = true;
        }
        k += 1;
    }
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define re register
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define per(i,n,m) for(int i=m;i>=n;i--)
#define rrep(i,m,n) for(register int i=m;i<=n;i++)
#define rper(i,n,m) for(register int i=m;i>=n;i--)
#define ull unsigned  long long
using namespace std;
const int INF =1e9+10;
const int N = 3e3 + 10;
#define int ll
int r,c,m;
int a[N][N];
int dp[N][N][5];
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>r>>c>>m;
    rep(i,1,m){
        int x,y,z;
        cin>>x>>y>>z;
        a[x][y]=z;
    }
    rep(i,1,r){
        rep(j,1,c){
            rep(k,0,3){
                rep(l,0,3)dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][l]);

                dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k]);
                if(k>0){
                    rep(l,0,3)dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][l]+a[i][j]);
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+a[i][j]);
                }
            }
        }
    }
    int ans=0;

    rep(i,0,3)ans=max(ans,dp[r][c][i]);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 426684
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<cstring>
#define endl "\n"
#define input cin>>
#define output cout<<
#pragma GCC optimize(2)
using namespace std;
string s;
int main(){
	ios::sync_with_stdio(false);
	input s;
	for(int i=0; i<s.length(); i++){
		if(s[i]==s[i+1]) {
			output i+1; 
			output " ";
			output i+2;
			output endl;
			return 0;
		}
		if(s[i]==s[i+2]){
			output i+1; 
			output " ";
			output i+3;
			output endl;
			return 0;
		}
	}
	output "-1 -1\n";
}


Measured memory_bytes: 512
N, A, B, C, D = map(int, input().split())

S = list(input().split()[0])

result = "Yes"
flag = False

for i in range(B, D - 1):
    if S[i] == "#" and S[i + 1] == "#":
        result = "No"
        print(result)
        flag = True
        break
if not flag:
    for i in range(A, C - 1):
        if S[i] == "#" and S[i + 1] == "#":
            result = "No"
            print(result)
            flag = True
            break

if not flag:    
    if A < B and B < D and D < C:
        for i in range(B - 2, D - 1):
            if S[i] == "." and S[i + 1] == "." and S[i + 2] == ".":
                result = "Yes"
                print(result)
                flag = True
                break
            else:
                result = "No"
                flag = False
if not flag:
    print(result)

Measured memory_bytes: 61680
import math
N = int(input())

d = 1
ans = 15
while(d ** 2 <= N):
    if(N % d == 0):
        A = d
        B = N / d
        ans = min(ans,max(math.floor(math.log10(A))+1,math.floor(math.log10(B)) + 1) )
        #print([ans,A,B])

    d += 1
print(ans)

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
        OP("Possible");
    else
        OP("Impossible");

    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define pb push_back
using namespace std;
const int P=139;
const int mod=149;
const int maxn=1e6+5;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
char n[maxn];
ll k,t,res,sum,a[maxn],b[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    int len=strlen(n);
    if(n[len-1]!='s')
        cout<<n<<'s'<<endl;
    else
        cout<<n<<"es"<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

const int N=3009;
const int md=1e9+7;

int n,m;
int f[N][N][2];

inline void add(int &a,int b)
{
	if(b>=md)b-=md;
	a+=b;
	if(a>=md)a-=md;
}

int main()
{
	if(fopen("friend.in","r"))
	{
		freopen("friend.in","r",stdin);
		freopen("friend.out","w",stdout);
	}

	scanf("%d%d",&n,&m);

	memset(f,0,sizeof(f));
	for(int i=1;i<=n;i++)
		f[0][i][0]=1;
	f[0][0][1]=1;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(j==0)
			{
				add(f[i+1][j][1],f[i][j][1]);
				add(f[i+1][j+1][1],f[i][j][1]);
			}

			else if(j==1)
			{
				add(f[i+1][j][1],f[i][j][0]+f[i][j][1]);
				if(j<n)
				{
					add(f[i+1][j][0],f[i][j][0]);
					add(f[i+1][j][1],f[i][j][1]);
					add(f[i+1][j+1][0],f[i][j][0]);
					add(f[i+1][j+1][1],f[i][j][1]);
				}
				add(f[i+1][j-1][1],f[i][j][0]+f[i][j][1]);
			}
			else if(j==n)
			{
				for(int k=0;k<=1;k++)
				{
					add(f[i+1][j][k],f[i][j][k]);
					add(f[i+1][j-1][k],f[i][j][k]);
				}
			}
			else
			{
				for(int k=0;k<=1;k++)
				{
					add(f[i+1][j][k],f[i][j][k]*2);
					add(f[i+1][j-1][k],f[i][j][k]);
					add(f[i+1][j+1][k],f[i][j][k]);
				}
			}
		}
	}

	int ans=0;
	for(int i=0;i<=n;i++)
		add(ans,f[m][i][1]);
	printf("%d\n",ans);
	return 0;
}


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

int main() {
  int N, M; cin >> N >> M;
  int penalty = 0;
  int ac = 0;

  map<int, int> solved;
  map<int, int> missed;

  for (int i = 0; i < M; i++) {
    int p;
    string s;

    cin >> p >> s;
    if (s == "AC" && solved[p] == 0) {
      ac++;
      solved[p]++;
      penalty += missed[p];
    } else if (s == "WA" && solved[p] == 0){
      missed[p]++;
    }
  }

  cout << ac << " " << penalty << endl;
}


Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
//#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long linf = 4523372036854775807;
const int iinf = 1500000000;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	ll sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
 //---------------------------------------------------
 //+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a*n, b) << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>
#include<climits>
#include<tuple>
#include<utility>
#include<cassert>
using namespace std;

//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
#define PB push_back
#define LB lower_bound
#define UB upper_bound


//constant
const int MOD = 1000000007;
const int INF = INT_MAX / 3 - 1;
const double EPS = 1e-9;
const int dx4[4] = { 1,0,-1,0 };
const int dy4[4] = { 0,1,0,-1 };
const int dx8[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy8[8] = { -1,-1,-1,0,0,1,1,1 };

//typedef
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

int main() {
	long long int h, w;
	int n;
	cin >> h >> w >> n;
	vector<pair<int, int>> ab(n);
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		ab[i].first = a;
		ab[i].second = b;
	}
	sort(ALL(ab));
	long long int res[11];
	REP(i, 10)
		res[i] = 0;
	REP(k, n) {
		for(int i=-2;i<=0;i++)
			for(int j=-2;j<=0;j++)
				if (0 <= ab[k].first + i && ab[k].first + i + 2 < h && 0 <= ab[k].second + j && ab[k].second + j + 2 < w) {
					bool isOK = true;
					for (int ii = 0; ii <=2; ii++)
						for (int jj = 0; jj <= 2; jj++)
							if (( ab[k].first+i+ii<ab[k].first || (ab[k].first+i+ii==ab[k].first&& ab[k].second+j+jj<ab[k].second)	)&&binary_search(ALL(ab), make_pair(ab[k].first +i+ ii, ab[k].second +j+ jj)))
								isOK = false;
					if(isOK){
						int cnt = 0;
						for (int ii = 0; ii <= 2; ii++)
							for (int jj = 0; jj <= 2; jj++)
								if (binary_search(ALL(ab), make_pair(ab[k].first + i + ii, ab[k].second + j + jj)))
									cnt++;
						res[cnt]++;
					}
				}

	}
	long long int su = 0;
	REP(i, 9)
		su += res[i + 1];
	cout << (h - 2)*(w - 2) - su << endl;
	REP(i, 9)
		cout << res[i + 1] << endl;


	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int m,int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(m,n / 2);
	x *= x;
	if (n % 2 == 1)x *= m;
	return x;
}
ll max(ll a, ll b) {
	if (a < b)return b;
	else return a;
}
struct edge { int to, cost; };


int main() {
	int n,m;
	cin >> n >> m;
	hei(llint) a(n);
	priority_queue<llint, hei(llint)> s;
	rep(i, 0, n) {
		cin >> a[i];
		s.push(a[i]);
	}
	rep(i, 0, m) {
		llint x = s.top();
		s.pop();
		x /= 2;
		s.push(x);
	}
	llint ans = 0; 
	rep(i, 0, n) {
		ans += s.top();
		s.pop();
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
  int x,y;
  cin>>x>>y;
  string ans="Yes";
  if(y%2==1) ans="No";
  if(y<2*x) ans="No";
  if(4*x<y) ans="No";
  cout<<ans<<endl;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int N[3] = {2, 1, 0};
int A[3][3] = {{0, 0, 0}, {0, 1, 1}, {0, 1, 2}};
int O[3][3] = {{0, 1, 2}, {1, 1, 2}, {2, 2, 2}};

// [b, e)について、論理式を評価する
int calc(int p, int q, int r, string &s, int b, int e){
    if(e - b == 1){
        switch(s[b]){
            case '0': return 0;
            case '1': return 1;
            case '2': return 2;
            case 'P': return p;
            case 'Q': return q;
            case 'R': return r;
            default: cout << "FUCK\n";
        }
    }
    if(s[b] == '-') return N[calc(p, q, r, s, b+1, e)];
    int lv = 0, lhs_e = -1, rhs_b = -1;
    for(int i = b; i < e; ++i){
        if(s[i] == '(')++lv;
        else if(s[i] == ')') --lv;
        else if(lv == 1 && s[i] == '*') return A[calc(p, q, r, s, b+1, i)][calc(p, q, r, s, i+1, e-1)];
        else if(lv == 1 && s[i] == '+') return O[calc(p, q, r, s, b+1, i)][calc(p, q, r, s, i+1, e-1)];
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    while(true){
        string s;
        cin >> s;
        if(s == ".") break;
        int ans = 0;
        for(int p = 0; p < 3; ++p){
            for(int q = 0; q < 3; ++q){
                for(int r = 0; r < 3; ++r){
                    ans += calc(p, q, r, s, 0, s.size()) == 2;
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}


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

signed main()
{
    int s; cin >> s;

    int precedent = s / 100;
    int follow = s % 100;

    if (1 <= precedent && precedent <= 12){
        if (1 <= follow && follow <= 12){
            puts("AMBIGUOUS");
        } else {
            puts("MMYY");
        }
    } else {
        if (1 <= follow && follow <= 12){
            puts("YYMM");
        } else {
            puts("NA");
        }
    }
    return 0;
}


Measured memory_bytes: 256