akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    map<string, int> ball;
    string S, T, U;
    cin >> S >> T;
    cin >> ball[S] >> ball[T];
    cin >> U;
    ball[U]--;
    cout << ball[S] << " " << ball[T] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
const int N=2e5+5;
priority_queue<ii> q;
int k,d[N];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>k; 
	memset(d,0x3f3f3f3f,sizeof(d));
	q.push(ii(-1,1));
	d[1]=1;
	while(!q.empty())
	{
		ii u=q.top();
		q.pop();
		ll val=-u.first,r=u.second;
		if(val>d[r])	continue;
		if(r==0){
			cout<<val<<'\n';
			break;
		}
		for(int i=0;i<10;i++)
		{
			int nr=(r*10+i)%k,nv=val+i;
			if(d[nr]>nv)
			{
				d[nr]=nv;
				q.push(ii(-nv,nr));
			}	
		}
	}
	return 0;
}

Measured memory_bytes: 3188
#include<iostream>
#include<numeric>
#include<vector>
using namespace std;
using ll = long long;

int main(){
    string s;
    cin>>s;
    int n=(int)s.length()+1;
    vector<ll> v(n+1);
    for(int i=0;i<n;i++){
        if(s[i]=='<') v[i+1]=max(v[i]+1,v[i+1]);
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='>') v[i]=max(v[i+1]+1,v[i]);
    }
    cout<<accumulate(v.begin(),v.end(),0LL)<<endl;
}

Measured memory_bytes: 7716
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    char A[H][W];
    bool flag[H][W];

    queue<pair<int, int> > nextQ;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> A[i][j];
            if (A[i][j] == '#') {
                nextQ.push(make_pair(i, j));
                flag[i][j] = true;
            } else {
                flag[i][j] = false;
            }

        }
    }

    int ans = -1;
    while (!nextQ.empty()) {
        ans++;
        queue<pair<int, int> > q(nextQ);
        queue<pair<int, int> > empty;
        swap(nextQ, empty);
        while (!q.empty()) {
            pair<int, int> elem = q.front();
            q.pop();
            int i = elem.first;
            int j = elem.second;

            if (i > 0) {
                A[i-1][j] = '#';
                if (!flag[i-1][j]) {
                    nextQ.push(make_pair(i-1, j));
                    flag[i-1][j] = true;
                }
            }
            if (j > 0) {
                A[i][j-1] = '#';
                if (!flag[i][j-1]) {
                    nextQ.push(make_pair(i, j-1));
                    flag[i][j-1] = true;
                }
            }
            if (i < H-1) {
                A[i+1][j] = '#';
                if (!flag[i+1][j]) {
                    nextQ.push(make_pair(i+1, j));
                    flag[i+1][j] = true;
                }
            }
            if (j < W-1) {
                A[i][j+1] = '#';
                if (!flag[i][j+1]) {
                    nextQ.push(make_pair(i, j+1));
                    flag[i][j+1] = true;
                }
            }
        }
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 18576
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = 1<<18;

int n, h[N], a[N], drz[2*N];

void add(int v, int val) {
  v += N;
  drz[v] = val;
  while (v > 1) {
    v /= 2;
    drz[v] = max(drz[2*v], drz[2*v+1]);
  }
}

int get(int p, int q) {
  p += N;
  q += N;
  int res = max(drz[p], drz[q]);
  while (p/2 != q/2) {
    if (p%2 == 0)
      res = max(res, drz[p+1]);
    if (q%2 == 1)
      res = max(res, drz[q-1]);
    p /= 2;
    q /= 2;
  }
  return res;
}

signed main() {
  init_ios();
  cin >> n;
  for (int i = 1; i <= n; ++i)
    cin >> h[i];
  for (int i = 1; i <= n; ++i)
    cin >> a[i];
  for (int i = 1; i <= n; ++i)
    add(h[i], a[i]+get(1, h[i]));
  cout<<get(1, N-1)<<"\n";
}

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

using namespace std;

long long n, a[105], x;

int main() {

cin >> n >> x;

for (int i = 1; i <= n; ++i){
    cin >> a[i];
}
sort(a + 1, a + 1 + n);

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

if (x != 0) cout << n - 1;
else cout << n;

return 0;

}


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

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

    ll n, ans = 4, _min = 2e15;
    int pos = 0;
    vector<ll> x(5);
    cin >> n;
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
        if (x[i] < _min) {
            pos = i;
            _min = x[i];
        }
    }

    ans += (n % _min) ? (n / _min + 1) : (n / _min);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for(int i = x; i < (int)(n); i++)
#define ALL(n) begin(n), end(n)
//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(nullptr);}}star;
const long long INF = numeric_limits<long long>::max();

int main() {
  unsigned long long n;
  scanf("%llu", &n);
  unsigned long long a;
  scanf("%llu", &a);
  unsigned long long b;
  scanf("%llu", &b);

  unsigned long long blue = (n / (a + b)) * a + min(n % (a + b), a);

  printf("%llu\n", blue);
  return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc152/tasks/abc152_d


N = gets.to_i

counts = Array.new(10) { Array.new(10) { 0 } }

('1'.."#{N}").each do |s|
  f = s[0].to_i
  l = s[-1].to_i
  counts[f][l] += 1
end

ans = 0
(0..9).each do |i|
  (0..9).each do |j|
    ans += counts[i][j] * counts[j][i]
  end
end

puts ans


Measured memory_bytes: 1788
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func solve() {
	n := getInt()
	ans := n - 1

	divs := findDivisor(n)
	for _, d := range divs {
		c := n / d
		ans = min(ans, d+c-2)
	}

	fmt.Fprintln(wr, ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func findDivisor(n int) []int {
	ret := make([]int, 0)
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			ret = append(ret, i)
			if i*i != n {
				ret = append(ret, n/i)
			}
		}
	}

	sort.Ints(ret)
	return ret
}

/*
	1	2	3	4	5	6	7
	2	4	6	8	10	12	14
	3	6	9	12	15	18	21
	4	8	12	16	20	24	28
	5	10	15	20	25	30	35
	6	12	18	24	30	36	42
	7	14	21	28	35	42	49
*/

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		int[] a=sc.Ia;
		Array.Sort(a);
		var hs=new Dictionary<int,int>();
		int q=(int)Math.Sqrt(a[0]);
		for(int i = 1;i<=q;i++) {
			if(a[0]%i==0){
				if(hs.ContainsKey(i)){hs[i]++;}
				else{hs.Add(i,1);}
				if(i!=a[0]/i){
					if(hs.ContainsKey(a[0]/i)){hs[a[0]/i]++;}
					else{hs.Add(a[0]/i,1);}
				}
			}
		}
		q=(int)Math.Sqrt(a[1]);
		for(int i = 1;i<=q;i++) {
			if(a[1]%i==0){
				if(hs.ContainsKey(i)){hs[i]++;}
				else{hs.Add(i,1);}
				if(i!=a[1]/i){
					if(hs.ContainsKey(a[1]/i)){hs[a[1]/i]++;}
					else{hs.Add(a[1]/i,1);}
				}
			}
		}
		List<int> kl;
		for(int i = 2;i<n-1;i++) {
			kl=new List<int>(hs.Keys);
			foreach(int k in kl){
				if(a[i]%k==0){hs[k]++;}
				else if(hs[k]<i){hs.Remove(k);}
			}
		}
		kl=new List<int>(hs.Keys);
		int ans=1;
		foreach(int k in kl){
			if(a[n-1]%k==0){hs[k]++;}
			if(hs[k]>=n-1){ans=Math.Max(ans,k);}
		}
		Console.WriteLine(ans);
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}


Measured memory_bytes: 26720
#include<stdio.h>

int main(){
    int x,y,z;

    scanf("%d %d %d",&x,&y,&z);

    if((x == 1 && y == 1) || z == 1){
        printf("Open\n");
    }else{
        printf("Close\n");
    }

    return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

struct Vector {
    double x;
    double y;
    Vector() {};
    Vector( double x, double y ): x( x ), y( y ) {
    }
    double getLength() {
        return sqrt( x * x + y * y );
    }
    Vector operator -( Vector v ) {
        Vector answer( x - v.x, y - v.y );
        return answer;
    }
};

std::ostream& operator << ( std::ostream& out, const Vector& v ) {
    return out << "(" << v.x << ", " << v.y << ")";
}

double getCross( Vector a, Vector b ) {
    return a.x * b.y - a.y * b.x;
}

double getArea( Vector a, Vector b, Vector c ) {
    Vector A = b - a;
    Vector B = c - b;
    Vector C = a - c;
    double z = ( A.getLength() + B.getLength() + C.getLength() ) / 2.0;
    return sqrt( z * ( z - A.getLength() ) * ( z - B.getLength() ) * ( z - C.getLength() ) );
}

const int size = 21;
Vector V[size];
int n;

int main() {
    string line;
    n = 0;
    while ( cin >> line ) {
        replace( line.begin(), line.end(), ',', ' ' );
        istringstream is( line );
        is >> V[n].x >> V[n].y;
        n++;
    }

    bool used[size];
    for ( int i = 0; i < size; ++ i ) {
        used[i] = false;
    }

    double area = 0.0;
    for ( int k = 0; k < n - 2; ++ k ) {
        bool first = true;
        int cand;
        double mind;
        for ( int i = 0; i < n; ++ i ) {
            if ( used[i] ) continue;
            if ( first || V[i].getLength() < mind ) {
                first = false;
                cand = i;
                mind = V[i].getLength();
            }
        }
        int cand2 = ( cand + 1 ) % n;
        int cand3 = cand - 1;
        if ( cand3 < 0 ) cand3 = n - 1;
        while ( used[cand2] ) {
            cand2 = ( cand2 + 1 ) % n;
        }
        while ( used[cand3] ) {
            cand3 = cand3 - 1;
            if ( cand3 < 0 ) cand3 = n - 1;
        }
        used[cand] = true;
        area += getArea( V[cand], V[cand2], V[cand3] );
    }
    cout << area << endl;
    
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>

using namespace std;

void func(int r, int D,int x2000) {
    int last = x2000;
    for (int i = 0; i < 10; ++i) {
        last = r * last - D;
        cout << last << endl;
    }
}

int main() {
    int r, D,x2000;
    cin >> r >> D >> x2000;
    func(r, D,x2000);
    return 0;
}


Measured memory_bytes: 256
import heapq
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
heaplist = []
heapq.heappush(heaplist,-A[0])
ans = 0
for i in range(1,N):
    ans -= heapq.heappop(heaplist)
    heapq.heappush(heaplist,-A[i])
    heapq.heappush(heaplist,-A[i])

print(ans)


Measured memory_bytes: 31864
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N;
  string s;
  cin >> N;
  map<string, int> m;

  rep(i, N){
    cin >> s;
    if(m.find(s) != m.end()){
      m[s]++;
    } else {
      m.insert(make_pair(s, 1));
    }
  }


  cout << m.size() << endl;

}


Measured memory_bytes: 19152
import java.util.Scanner;

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Scanner sc = new Scanner(System.in);

		// ----- main -----
		int ans = 0;
		String s = sc.nextLine();
		for(int i=0; i < s.length(); i++) {
			if('+' == s.charAt(i)) {
				ans++;
			} else {
				ans--;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const [N, M] = lines[0].split(" ").map(v=>v-0);
    const ans = [];
    lines.forEach((v, i)=>{
        const [a, b] = v.split(" ").map(v=>v-0);
        if(i>0){
            ans[a] = (ans[a]||0)+1;
            ans[b] = (ans[b]||0)+1;
        }
    });
    for(let i=1;i<=N;i++){
        console.log(ans[i]||0);
    }
});


Measured memory_bytes: 29928
import sys
from collections import defaultdict
N,S=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())

mod=998244353
cur=defaultdict(lambda: 0)
new=defaultdict(lambda: 0)
cur[0]=1

for a in A:
    for i in cur.keys():
        if i+a<=S:
            new[i+a]+=cur[i]*1
            new[i+a]%=mod
        new[i]+=cur[i]*2
        new[i]%=mod
    cur=new
    new=defaultdict(lambda: 0)

print cur[S]


Measured memory_bytes: 124940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n;cin>>n;
  
  string s;cin>>s;

  rep(i,0,siz(s)){
    s[i]=(s[i]+n);
    if(s[i]>'Z')s[i]-=26;
  }
  cout<<s<<endl;

}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

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

int main(void){
    int a,b,k;
    cin>>a>>b>>k;
    if(b-a+1 <=2*k ){
        for(int i=a;i<=b;i++){
            cout<<i<<endl;
        }
    }else{
        for(int i=a;i<a+k;i++){
            cout<<i<<endl;
        }
        for(int i=b-k+1;i<=b;i++){
            cout<<i<<endl;
        }
    }
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int x;
    cin >> x;
    if(x>=30)COUT("Yes");
    else COUT("No");
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    string s;cin>>s;
    vector<int> c(26,0);
    for(int i=0;i<(int)s.length();i++){
        int idx=s[i]-'a';
        c[idx]++;
    }
    for(int i=0;i<26;i++){
        if(c[i]==0){
            cout<<(char)('a'+i)<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cmath>
#include<iomanip>
#include<algorithm>
using namespace std;

class dice{
public:
	int d[6], tmp[6];
	dice(int n[6]){
		for (int i = 0; i < 6; i++){
			d[i] = n[i];
		}
	}
	void throwdice(char c){
		for (int i = 0; i < 6; i++){
			tmp[i] = d[i];
		}
		if (c == 'N'){
			d[0] = tmp[1];
			d[1] = tmp[5];
			d[2] = tmp[2];
			d[3] = tmp[3];
			d[4] = tmp[0];
			d[5] = tmp[4];
		}
		else if (c == 'E'){
			d[0] = tmp[3];
			d[1] = tmp[1];
			d[2] = tmp[0];
			d[3] = tmp[5];
			d[4] = tmp[4];
			d[5] = tmp[2];
		}
		else if (c == 'W'){
			d[0] = tmp[2];
			d[1] = tmp[1];
			d[2] = tmp[5];
			d[3] = tmp[0];
			d[4] = tmp[4];
			d[5] = tmp[3];
		}
		else if (c == 'S'){
			d[0] = tmp[4];
			d[1] = tmp[0];
			d[2] = tmp[2];
			d[3] = tmp[3];
			d[4] = tmp[5];
			d[5] = tmp[1];
		}
		else if (c == 'R'){
			d[0] = tmp[0];
			d[1] = tmp[3];
			d[2] = tmp[1];
			d[3] = tmp[4];
			d[4] = tmp[2];
			d[5] = tmp[5];
		}
	}
};
int main()
{
	int m[6], n[6];
	for (int i = 0; i < 6; i++){
		cin >> m[i];
	}
	dice dice1(m);
	for (int i = 0; i < 6; i++){
		cin >> n[i];
	}
	dice dice2(n);
		bool upsame = false;
		for (int i = 0; i < 4; i++){
			dice1.throwdice('S');
			if (dice1.d[0] == dice2.d[0]){
				upsame = true;
				break;
			}
		}
		if (!upsame){
			while (true){
				dice1.throwdice('W');
				if(dice1.d[0] == dice2.d[0]){
					break;
				}
			}
		}

		for (int i = 0; i < 4; i++){
			dice1.throwdice('R');
			if (dice1.d[1] == dice2.d[1]){
				break;
			}
		}
		bool same = true;
		for (int i = 0; i < 6; i++){
			if (dice1.d[i] != dice2.d[i]){
				same = false;
			}
		}
		if (same){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	

	return 0;
}

Measured memory_bytes: 1160
import sys
input = sys.stdin.readline
n, a, b, c = map(int, input().split())
S = [input().rstrip().replace("AC", "CA") for _ in range(n)]
D = ["AB", "BC", "CA"]
X = [a+b, b+c, c+a]
L = []
for i, s in enumerate(S):
  k = D.index(s)
  if X[k] == 0:
    print("No")
    exit()
  if X[(k+1)%3] == 1 and X[(k+2)%3] == 1 and i < n-1:
    l = D.index(S[i+1])
    if l == (k+1)%3:
      X[(k+1)%3] += 1
      X[(k+2)%3] -= 1
      L.append(s[1])
    else:
      X[(k+2)%3] += 1
      X[(k+1)%3] -= 1
      L.append(s[0])
  else:
    if X[(k+1)%3] < X[(k+2)%3]:
      X[(k+1)%3] += 1
      X[(k+2)%3] -= 1
      L.append(s[1])
    else:
      X[(k+2)%3] += 1
      X[(k+1)%3] -= 1
      L.append(s[0])
print("Yes")
print(*L, sep="\n")

Measured memory_bytes: 18492
#include <bits/stdc++.h>
using namespace std;
int main(){

    int n, x; cin >> n >> x;
    if( x == 1 || x == 2*n-1 ){
        cout << "No\n";
        return 0;
    }

    cout << "Yes\n";

    vector<int>v(2*n-1);
    int c = x;
    for( int i = (2*n -1)/2 ; i < 2*n-1 && c <= 2*n-1 ; ++i ){
        v[i] = c;
        c++;
    }
    c = x-1;
    for( int i = (2*n -1)/2 -1 ; c > 0 && i >= 0 ; i-- ){
        v[i] = c;
        c--;
    }
    c = 1;
    for( int i = 2*n-2 ; v[i] == 0 ; i-- ){
        v[i] = c;
        c++;
    }
    c = v[2*n-2]+1;
    for( int i = 0 ; v[i] == 0 ; ++i ){
        v[i] = c;
        c++;
    }
    for( int i = 0 ; i < 2*n-1 ; ++i ){
        cout << v[i] << '\n';
    }
}
/*
5
6 6
7 6 2
1  2 2
2 3 3
3 4
4
*/


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

int main() {
    string g;
    int y, m, d;
    while (cin >> g) {
        if (g == "#") break;
        cin >> y >> m >> d;
        if (y < 31 || (y == 31 && m < 5)) {
            cout << g << " " << y << " " << m << " " << d << endl;
        } else {
            cout << "? " << (y-30) << " " << m << " " << d << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s, a, b;
    vector<char>first;
    cin >> s;
    int count=0, j=0;
    
    if (s.length() == 1) {
        cout << 0 << endl;
        return 0;
    }
    
    for(int i=0; i<s.length(); i++){
        
        if ( (s.length() % 2 != 0) && i == (s.length() / 2) ){
        } else if (i < (s.length()/2)) {
            first.insert(first.begin(), s[i]);  
        } else {
            if (first[j] != s[i]) {
                count++;
            }
            j++;
        }
    } 
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()

if s == 'SSS':
  print(0)
elif s == 'SSR':
  print(1)
elif s == 'SRS':
  print(1)
elif s == 'SRR':
  print(2)
elif s == 'RSS':
  print(1)
elif s == 'RSR':
  print(1)
elif s == 'RRS':
  print(2)
else:
  print(3)

Measured memory_bytes: 9128
import sys

while 1:
  n=input()+1
  if n==1:break
  A=[''*n]+[' '+raw_input() for i in range(1,n)]
  M=[[0]*n for i in range(n)]
  for i in range(1,n):
    for j in range(1,n):
      if A[i][j]=='.': M[i][j]=min(M[i-1][j-1],M[i-1][j],M[i][j-1])+1
  print max(map(max,M))

Measured memory_bytes: 32980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,x,t;
    cin >> n >> x >> t;
    if(n%x == 0) cout << n/x * t << endl;
    else cout << (n/x + 1) * t << endl;

    return 0;
}

Measured memory_bytes: 3560
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
#define ll long long
int main(){
    double n,m,d;
    cin >> n >> m >> d;
    double a;
    if(d!=0){
        a =2*(n-d)*(m-1.0)/n/n;
    }else{
        a =(n-d)*(m-1.0)/n/n;
    }
    cout << setprecision(12) <<a;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void){
	int t,s,e,n,ans,i,ex;
	char str[21];
	const char *tmp[] = {
		"North","East","South","West","Right","Left",
	};
	for(;;){
		scanf("%d",&n);
		if(n==0)break;
		ans = 0;
		t=1;
		s=2;
		e=3;
		while(n--){
			scanf("%s",str);
			for(i=0;i<6;i++){
				if(strcmp(str,tmp[i])==0)break;
			}
			switch(i){
				case 0:
					ex = t;
					t = s;
					s = 7 - ex;
					break;
				case 1:
					ex = t;
					t = 7 - e;
					e = ex;
					break;
				case 2:
					ex = t;
					t = 7 - s;
					s = ex;
					break;
				case 3:
					ex = t;
					t = e;
					e = 7 - ex;
					break;
				case 4:
					ex = e;
					e = 7 - s;
					s = ex;
					break;
				case 5:
					ex = e;
					e = s;
					s = 7 - ex;
					break;
			}
			ans += t;
			//printf("%d %d %d\n",t,s,e);
		}
		printf("%d\n",ans+1);
	}
	
	return 0;
}

Measured memory_bytes: 1040
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

main()
{

string s,t;
cin>>s>>t;
ll n =s.size();
int ans=10000;
ll m=t.size();
for(int i=0;i<n;i++)
{
	int ta=0;
	for(int j=0;j<m;j++)
	{
		if(i+j>=n)
			{
				ta=1e9;
				break;
			}
		if(s[i+j]!=t[j])
			ta++;
			
	}
	ans=min(ans,ta);
}
cout<<ans<<endl;


}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,cnt=0;
  char s[100][100];
  char mp[100][100];
  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
      s[i][j]=mp[i][j]='!';
    }
  }
  cin>>h>>w;
  int tate[h],yoko[w];
  for(int i=0;i<h;i++){
    tate[i]=0;
  }
  for(int i=0;i<w;i++){
    yoko[i]=0;
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>s[i][j];
      if(s[i][j]=='#') tate[i]=yoko[j]=1;
    }
  }
  int k=0,l=0;
  for(int i=0;i<h;i++){
    if(tate[i]==0) continue;
    for(int j=0;j<w;j++){
      mp[k][j]=s[i][j];
    }
    k++;
  }
  for(int i=0;i<w;i++){
    if(yoko[i]==0) continue;
    for(int j=0;j<k;j++){
      s[j][l]=mp[j][i];
    }
    l++;
  }
  for(int i=0;i<k;i++){
    for(int j=0;j<l;j++){
      cout<<s[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0), ans(n);
    ll sum = 0, res = 0;
    rep1(i, n){
        cin >> a[i];
        sum += a[i];
        if (i%2==1) res += a[i];
    }
    ans[0] = sum - 2*res;
    for (ll i=1; i<(n); i++){
        ans[i] = 2 * (a[i-1] - ans[i-1]/2);
    }
    rep1(i, n){ 
        if (i==n-1) cout << ans[i] << endl;
        else cout << ans[i] << " ";
    }
    //printf("%.12f", ans);
}

Measured memory_bytes: 4788
"use strict";
main(require("fs").readFileSync("/dev/stdin", "UTF-8"));

function main(input) {
  const alphabet = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z"
  ];

  input = input.trim().split("\n")[0];

  let i = 0;
  while (alphabet[i] !== input) i++;

  console.log(alphabet[i + 1]);
}


Measured memory_bytes: 7372
# N = gets.chomp.to_i
# S = gets.chomp.split.map(&:to_i)
S = gets.chomp.chars

def is_palin(s)
  n = s.size()
  l = 0
  r = s.size() - 1
  while (l < r) 
    if (s[l] != s[r]) 
      return false
    end
    l += 1
    r -= 1
  end
  # Here, l >= r
  return true
end

n = S.size
s0 = S[0..((n-1)/2 - 1)]
s1 = S[(((n+3)/2)-1)..-1]
# p s0
# p s1
if is_palin(S) && is_palin(s0) && is_palin(s1)
  print "Yes\n"
else
  print "No\n"
end

Measured memory_bytes: 1788
#include <iostream>
#include <climits>
using namespace std;
long long arr[1000005];

long long gcd(long long a, long long b){
	if(b == 0){
		return a; 
	}
	else{
		return gcd(b, (a%b));
	}
}

bool multiples(long long n, long long min, long long max, long long target){
  long long gcdNum = 0;
	/*
  1. Check for GCD in array
  2. Check if target is divisble by GCD
  */
  for(long long i = 0; i < n; i++){
    gcdNum = gcd(gcdNum, arr[i]);
  }

  bool flag = false; 
  if(target%gcdNum != 0){
    flag = true;
  }
  return flag;
}

int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(); cout.tie();
	long long n, target, min = INT_MAX, max = INT_MIN;
	cin >> n >> target; 
	for(long long i = 0; i < n; i++){
		cin >> arr[i];
		if(arr[i] == target){
			cout << "POSSIBLE" << endl;
			exit(0);
		}
		if(arr[i] < min){
			min = arr[i];
		}
		if(arr[i] > max){
			max = arr[i];
		}
	}
	if(max < target){
		cout << "IMPOSSIBLE" << endl; 
		exit(0);
	}
	if(multiples(n , min, max,target) == true){
		cout << "IMPOSSIBLE" << endl;
	}
	else{
		cout << "POSSIBLE" << endl; 
	}
}

Measured memory_bytes: 3768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramC
    {
        static void Main()
        {
            int n = NextInt;
            System.Console.WriteLine(Enumerable.Range(0, n).Select(_ => Line).Distinct().Count());
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 46176
#include<bits/stdc++.h>
using namespace std;
int r[1000100];
int main()
{//freopen("in.txt","r",stdin);
	int x,n;scanf("%d%d",&x,&n);
	for (int i=1;i<=n;i++) scanf("%d",&r[i]);
	int q,now=1,p=-1,low=x,high=0,ad=0,lst=0;scanf("%d",&q);
	while (q--)
	{
		int t,a;scanf("%d%d",&t,&a);
		while ((now<=n)&&(t>=r[now]))
		{
			int dlt=p*(r[now]-lst);
			ad+=dlt;low=min(x,max(dlt+low,0));high=min(x,max(dlt+high,0));
			lst=r[now];now++;p*=-1;
		}
		printf("%d\n",min(x,max(0,min(low,max(high,a+ad))+p*(t-lst))));
	}
}

Measured memory_bytes: 1536
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;

int main() {
    int N;
    vector<int> d;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int num;
        cin >> num;
        d.push_back(num);
    }
    set<int> s(d.begin(), d.end());
    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	ll h,m;
	cin>>h>>m;
	ll a[10010],b[10010];
	ll ch[20010]={};
	for(ll i=1;i<20010;i++){
		ch[i]=INF;
	}
	for(ll i=0;i<m;i++){
		cin>>a[i]>>b[i];
	}
	ll ans=INF;
	for(ll i=0;i<h;i++){
		for(ll j=0;j<m;j++){
			ll nexa=a[j];
			ll nexb=b[j];
			ch[i+nexa]=min(ch[i+nexa],ch[i]+nexb);
			if(i+nexa>=h){
				ans=min(ans,ch[i+nexa]);
			}
		}
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 3792
use std::vec::Vec;
use std::collections::BinaryHeap;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let (n, m) = {
        let v: Vec<usize> = read_vec();
        (v[0], v[1])
    };
    let a: Vec<usize> = read_vec();

    let mut heap = BinaryHeap::new();
    for e in a {
        heap.push(e);    
    }

    for _ in 0..m {
        let val = match heap.pop() {
            Some(e) => e/2,
            None => panic!(),
        };

        heap.push(val);
    }

    let ans = heap.into_iter().fold(0, |acc, x| acc + x);
    println!("{}", ans);
}


Measured memory_bytes: 9464
N, K, C = map(int, input().split())
S = input()

asc = []
desc = [-1 for _ in range(K)]

rest = 0
for day, job in enumerate(S):
    if job == 'o' and rest == 0:
        asc.append(day)
        rest += C+1
    if len(asc) >= K:
        break
    rest = max(0, rest-1)

cursor = K-1
rest = 0
for day, job in reversed(list(enumerate(S))):
    if job == 'o' and rest == 0:
        desc[cursor] = day
        cursor -= 1
        rest += C+1
    if cursor < 0:
        break
    rest = max(0, rest-1)

ans = []
for i in range(K):
    if asc[i] == desc[i]:
        print(asc[i]+1)

Measured memory_bytes: 33544
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int N, M, X;
int C[12] = { 0 };
int A[12][12] = {{0}};
int minCost = INF;

void dfs(int i, int sumCost, vector<int> sumRikais) {
    if (i == N) {
        bool isOK = true;
        // DEBUG("-------------");
        // DEBUG(sumCost);
        rep(j, M) {
            // DEBUG(sumRikais[j]);
            if (sumRikais[j] < X)  {
                isOK = false;
                break;
            } 
        }

        if (isOK) {
            minCost = min(minCost, sumCost);
        }
        return;
    }
    // 買わない場合
    dfs(i + 1, sumCost, sumRikais);

    // 買う場合
    rep(j, M) {
        sumRikais[j] += A[i][j];
    }
    dfs(i + 1, sumCost + C[i], sumRikais);
}

int main() {
    cin >> N >> M >> X;
    rep(i, N) {
        int Ci;
        cin >> Ci;
        C[i] = Ci;
        rep(j, M) {
            int Aij;
            cin >> Aij;
            A[i][j] = Aij;
        }
    }
    vector<int> sumRikais;
    rep (i, 12) {
        sumRikais.pb(0);
    }
    dfs(0, 0, sumRikais);

    if (minCost == INF) {
        cout << -1 << endl;
    } else {
        cout << minCost << endl;
    }
}


Measured memory_bytes: 3664
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
using namespace std;
#define MOD 1000000007
#define REP(m,n) for(int i=m;i<n;++i)
#define REPj(m,n) for(int j=m;j<n;++j)
#define INF 10000000000000000
#define ll long long
#define mp make_pair

vector<int>v;

int main() {
	int n, ans = 0;
	cin >> n;
	REP(0, n) {
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
		}
	REP(0, v.size()) {
		if (v[i] == i + 1) {
			ans++;
			i++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 892
#!/usr/bin/env python3
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
for x in b:
    for i in range(3):
        for j in range(3):
            if a[i][j] == x:
                a[i][j] = 0
ans = False
if all(a[i][i] == 0 for i in range(3)):
    ans = True
if all(a[i][~i] == 0 for i in range(3)):
    ans = True
for i in range(3):
    if all(a[i][j] == 0 for j in range(3)):
        ans = True
    if all(a[j][i] == 0 for j in range(3)):
        ans = True
print(["No", "Yes"][ans])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double l;
	scanf("%lf",&l);
	double x=l/3;
	l=(l*2.0)/3.0; 
	double sum=(l/2)*(l/2)*x;
	printf("%f\n",sum);
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100000

typedef struct{

  int id;
  int parent;
  int left;
  int right;

} Node;

int n;
Node in[N];

void init();
int depth(int);
int type(int);

int main(){
  int i, j, id2, a, d, k, temp;
  
  init();
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d %d", &id2, &d);
    in[i].id = id2;
    
    for(j = 0; j < d; j++){
      scanf("%d",&a);
      
      if(j == 0){
	in[id2].left = a;
      } else {
	in[temp].right = a;
      } 

      temp = a;
      in[a].parent = id2;

    }

  }
  
  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d, ", i, in[i].parent, depth(i));
    
    if(type(i) == 0){
      printf("root, ");
    }
    if(type(i) == 1){
      printf("leaf, ");
    }
    if(type(i) == 2){
      printf("internal node, ");
    }

    printf("[");
    
    k = in[i].left;

    if(in[i].left != -1){
      
      for(j = 0; k != -1; j++){
	if(in[k].right != -1){
	  printf("%d, ",k);
	} else {
	  printf("%d",k);
	}

	k=in[k].right;

      }
    }

    printf("]\n");
    
  }
  
  return 0;
}


void init(){
  int i;

  for(i = 0; i < N; i++){
    in[i].id = -1;
    in[i].parent = -1;
    in[i].left = -1;
    in[i].right = -1;
  }

}



int depth(int num){
  int i;

  for(i = 0; in[num].parent != -1; i++){
    num = in[num].parent;
  }

  return i;

}


int type(int num){

  if(in[num].parent == -1){
    return 0;
  }

  if(in[num].left == -1){
    return 1;
  }

  return 2;

}

Measured memory_bytes: 1980
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner((os.Stdin))

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	S1, S2 := nextLine(), nextLine()

	fmt.Printf("%d\n", ARC081B(N, S1, S2))
}

// ARC081B ...
func ARC081B(N int, S1, S2 string) (res int) {
	mod := 1000000007
	next, last := 0, ""

	// check first block(s)
	if S1[0] == S2[0] {
		// if the first block is vertical
		res += 3
		next++
		last = "v"
	} else {
		// if the first blocks are horizontal
		res += 6
		next = 2
		last = "h"
	}

	for i := next; i < N; {
		if S1[i] == S2[i] {
			if last == "v" {
				// v -> v
				res = (res * 2) % mod
			} else {
				// h -> v
				res = (res * 1) % mod
			}
			last = "v"
			i++
		} else {
			if last == "v" {
				// v -> h
				res = (res * 2) % mod
			} else {
				// h -> h
				res = (res * 3) % mod
			}
			last = "h"
			i += 2
		}
	}

	return
}


Measured memory_bytes: 1776
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long int LL;
#define fr(i,p,n) for(LL i=p;i<n;i++)
#define fr1(i,p,n) for(LL i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;

using namespace std;
 
int main()
{
        LL n,d;
        cin>>n>>d;
        LL ans=0;
        LL x,y;
        fr(i,0,n){
            cin>>x>>y;
            if(sqrt(x*x+y*y)<=d) ans++;
        }
         cout<<ans<<endl;
    return 0;
}

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

int main() {
  int N,M;
  cin >> N;
  int ans=0;
  vector<string> s(N),t(M);
  rep(i,N) cin >> s.at(i);
  cin >> M;
  rep(i,M) cin >> t.at(i);
  rep(i,N){
    string word = s.at(i);
    int count=0;
    rep(j,N){
      if(s.at(j) == word) count++;
    }
    rep(j,M){
      if(t.at(j) == word) count--;
    }
    ans = max(ans,count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

using namespace std;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0}; //次に行くところ
int dx[] = {0,1,0,-1}; //s上に同じ

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

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {

	ll a, b, x;
	scanf("%lld%lld%lld", &a, &b,&x);


	ll divA;
	if (a == 0) {
		divA = 0;
	}
	else {
		divA = (a - 1) / x + 1;
	}


	ll divB;
	divB = b / x + 1;
	


	printf("%lld", divB - divA);







}


Measured memory_bytes: 128
// Organize Your Train part II

#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

string word;
int answer;

void solve() {
  map<string,int> table;
  string temp[5],str[9];
  answer = 0;
  int length = word.length();
  for (int i=0; i<length; i++){
    // abcd -> temp1 + temp2
    // temp3 : temp1????????¢
    // temp4 : temp2????????¢
    temp[1] = word.substr(i);
    temp[2] = word.substr(0,i);
    temp[3] = temp[1];
    reverse(temp[3].begin(), temp[3].end());
    temp[4] = temp[2];
    reverse(temp[4].begin(), temp[4].end());
    
    str[1] = temp[1] + temp[2];
    str[2] = temp[1] + temp[4];
    str[3] = temp[2] + temp[1];
    str[4] = temp[2] + temp[3];
    str[5] = temp[3] + temp[2];
    str[6] = temp[3] + temp[4];
    str[7] = temp[4] + temp[1];
    str[8] = temp[4] + temp[3];

    for (int i=1; i<=8;i++) {
      if (table[str[i]] == 0) {
        answer++;
        table[str[i]]++;
      }
    }
  }
  cout << answer << endl;
}

int main(){
  int N;
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> word;
    solve();
  }
  return 0;
}

Measured memory_bytes: 1308
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[]a = new int[m*2];
    int[]ans = new int[n];
         
    for(int i=0; i<m*2; i++) {
    	a[i] = sc.nextInt();
    		ans[a[i]-1]++;
    }
    for(int i=0; i<n; i++) {		
          System.out.println(ans[i]);
}
}
    }

Measured memory_bytes: 35928
#include<bits/stdc++.h>
const int N=100007;
int n,a[N];
bool d[N];
#define ret(c) return puts((c)?"First":"Second"),0
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	std::sort(a+1,a+n+1);
	for(int i=1,z=n+1;i<=n;++i){
		if(a[i]==a[i-1])d[i]=!d[i-1];
		else{
			int l=i+a[i-1],r=i+a[i];
			if(l<z&&z<=r)ret(r-z&1);
			if(l==z)ret(!(r-z-1&d[i-1]));
		}
		if(i+a[i]==z)ret(d[i]);
	}
}

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

using namespace std;
int _wno;

int n, m, cnt[26];
int four, two, one;

int main() {
	_wno = scanf( "%d%d", &n, &m );
	memset( cnt, 0, sizeof(cnt) );
	for( int i = 0; i < n; ++i )
		for( int j = 0; j < m; ++j ) {
			char c;
			_wno = scanf( " %c", &c );
			++cnt[c - 'a'];
		}
	if( (n&1) && (m&1) ) {
		four = (n>>1) * (m>>1);
		two = (n>>1) + (m>>1);
		one = 1;
	} else if( (n&1) && !(m&1) ) {
		four = (n>>1) * (m>>1);
		two = m>>1;
		one = 0;
	} else if( !(n&1) && (m&1) ) {
		four = (n>>1) * (m>>1);
		two = n>>1;
		one = 0;
	} else {
		four = (n>>1) * (m>>1);
		two = one = 0;
	}
	for( int i = 0; i < 26; ++i ) {
		if( cnt[i] & 1 ) --one, --cnt[i];
		if( cnt[i] % 4 == 2 ) --two, cnt[i] -= 2;
		int tmp = min(four, cnt[i]>>2);
		four -= tmp, cnt[i] -= tmp<<2;
		two -= cnt[i]>>1;
	}
	puts( one < 0 || two < 0 || four < 0 ? "No" : "Yes" );
	return 0;
}


Measured memory_bytes: 256
X,N=map(int,input().split())
p = list(map(int,input().split()))
#print(p)
ans = 300
for i in range(-200,200):
    #print(i)
    if i not in p:
        #print("False")
        if abs(ans-X) > abs(X-i):
            ans = i
        elif abs(ans-X) == abs(X-i):
            ans
print(ans)


Measured memory_bytes: 61928
<?php

fscanf(STDIN, "%d %d", $n, $q);

$queue = array();
for ($i = 0; $i < $n; $i++) {
    fscanf(STDIN, "%s %d", $name, $time);

    $queue[] = array(
        'name' => $name,
        'time' => $time,
    );
}

$current = 0;

$q_current = $q;

while (count($queue) > 0) {
    $queue_next = array();
    $q_next = PHP_INT_MAX;

    for ($i = 0; $i < count($queue); $i++) {
        $process = $queue[$i];

        if ($process['time'] - $q_current <= 0) {
            $current += $process['time'];
            echo $process['name']." $current\n";

            continue;
        }

        $current += $q_current;
        $process['time'] -= $q_current;

        $queue_next[] = $process;
    }

    $queue = $queue_next;
}

Measured memory_bytes: 46856
#include<cstdio>
#define int long long
inline int sqr(int a,int m){return a*a%m;}
int pow(int a,int n,int m)
{
	if(n<1)return 1;
	if(n&1)return sqr(pow(a,n>>1,m),m)*a%m;
	return sqr(pow(a,n>>1,m),m);
}
int gcd(int a,int b){return !b?a:gcd(b,a%b);}
void gcd(int x,int y,int &a,int &b)
{
	if(!y){a=1;b=0;return;}
	gcd(y,x%y,b,a);b-=x/y*a;
}
int solve(int a,int m)
{
	if(m==1)return 1;
	int phi=m,k=m;
	for(int i=2;i*i<=m;i++)
		if(k%i==0)
		{
			phi=phi/i*(i-1);
			while(k%i==0)k/=i;
		}
	if(k>1)phi=phi/k*(k-1);
	int g=gcd(m,phi),y=solve(a,g),o=((pow(a,y,m)-y)%m+m)%m,p,q;
	gcd(phi,m,p,q);
	p=(p+m)%m*o/g%m;
	int res=(phi*p+y)%(m*phi);
	if(!res)res=m*phi;
	return res;
}
int q,a,m;
signed main()
{
	scanf("%lld",&q);
	while(q--)
	{
		scanf("%lld%lld",&a,&m);
		printf("%lld\n",solve(a,m));
	}
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end



int main(){
    string s; cin>>s;
    int n=s.size(),ans=0;
    rep(i,0,n/2)if(s[i]!=s[n-1-i])ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
	}
	
	mod& operator=(const ll & tx) {
		x = tx;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return (x + m2.x) % MOD;
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return (x - m2.x + MOD) % MOD;
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return (x * m2.x) % MOD;
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return mod(((*this).x * (*this).inv().x) % MOD);
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}

/* TEMPLATE ENDS HERE */

int main() {
	cout << fixed << setprecision(12);	
	string s;
	cin >> s;
	while (s.length() != 15) {
		s += "o";
	}
	int ret = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'o') {
			ret++;
		}
	}
	if (ret >= 8) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3636