akhauriyash/Code-Regression huggingface dataset:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    d = dict()
    k = ni()
    c = 7 % k
    x = d[c] = 1
    while True:
        c = (c * 10 + 7) % k
        if c in d:
            break
        x += 1
        d[c] = x
    print(d.get(0, -1))
    return

solve()


Measured memory_bytes: 114648
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		sc.close();
		String[] num_str = str.split(" ");

		if(Float.parseFloat(num_str[0]) / Float.parseFloat(num_str[1]) <= Float.parseFloat(num_str[2])){		
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35820
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define p_b push_back
#define e_b emplace_back
#define m_p make_pair
#define m_t make_tuple

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	int mdiff = t.size(), diff = 0;

	rep(i, s.size() - t.size()+1) {
		rep(j, t.size()) {
			if (s[i + j] != t[j]) diff++;
		}
		mdiff = min(diff, mdiff);
		diff = 0;
	}

	cout << mdiff << endl;
}

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

#define DIV 1000000007
#define GIRI 1
#define LESS 0

//             pos , giri?
long long dp[100005][2];
string S;

int main(){
	cin >> S;
	dp[S.size()][GIRI] = 1;

	for(long long i = S.size() - 1; i >= 0; i--){
		if(S[S.size() - 1 - i] == '0'){
			//giri -> giri: 0,0
			dp[i][GIRI] += dp[i+1][GIRI];

			//less -> less: 1,0 0,1 0,0
			dp[i][LESS] += 3*dp[i+1][LESS];
		}else{
			//giri -> giri: 0,1 1,0
			dp[i][GIRI] += 2*dp[i+1][GIRI];

			//giri -> less: 0,0
			dp[i][LESS] += dp[i+1][GIRI];

			//less -> less: 1,0 0,1 0,0
			dp[i][LESS] += 3*dp[i+1][LESS];
		}
		dp[i][LESS] %= DIV;
		dp[i][GIRI] %= DIV;
	}
	//for(long long i = S.size() - 1; i >= 0; i--){
	//	cout << "dp[" << i << "][GIRI] = " << dp[i][GIRI] << endl;
	//	cout << "dp[" << i << "][LESS] = " << dp[i][LESS] << endl;
	//}
	cout << (dp[0][GIRI] + dp[0][LESS])%DIV << endl;

}


Measured memory_bytes: 2048
n = int(input())
h = list(map(int,input().split()))

mean_a = int(sum(h)/len(h))
mean_b = int(sum(h)/len(h))+1
#print(mean)
dist_a = 0
dist_b = 0
for i in range(len(h)):
    dist_a += (h[i]-mean_a)**2
    dist_b += (h[i]-mean_b)**2

print(min(dist_a,dist_b))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

ll popcount2(ll x) {  
    ll ret = 0;  
    while (x) {  
        x &= x-1;  
        ++ret;  
    }  
    return ret;  
} 

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    ll cnt = 0;
    for(int i=0;i<N;i++){
        if(S[i]=='1') cnt++;
    }
    if(cnt==0){
        rep(i,N) cout << 1 << endl;
        return 0;
    }
    vector<ll> amari_p(N),amari_m(N);
    ll num_p=1;
    ll num_m=1;
    ll cntp = cnt+1;
    ll cntm = cnt-1;
    for(int i=N-1;i>=0;i--){
        amari_p[i] = num_p%cntp;
        num_p = (num_p%cntp)*2;
        if(cntm<=0) continue;
        amari_m[i] = num_m%cntm;
        num_m = (num_m%cntm)*2;
    }
    // rep(i,N) cout << amari_p[i] << "-" << amari_m[i] << endl;
    // 元の数を割った余りを出しておく
    ll ori_p,ori_m;
    ll tmp_p=0,tmp_m=0;
    rep(i,N){
        if(S[i]=='1'){
            tmp_p += amari_p[i];
            tmp_m += amari_m[i];
            tmp_p%=cntp;
            if(cntm<=0) continue;
            tmp_m%=cntm;
        }
    }
    ori_p = tmp_p;
    ori_m = tmp_m;
    
    for(int i=0;i<N;i++){
        ll ans = 0;
        ll cnt2 = cnt;
        ll num;
        ll t_p = ori_p;
        ll t_m = ori_m;
        if(S[i]=='0'){
            t_p += amari_p[i];
            t_p %= cntp;
            num = t_p;
            ans++;
        }else{
            if(cnt==1){
                cout << 0 << endl;
                continue;
            }
            t_m -= amari_m[i];
            t_m += cntm;
            t_m %= cntm;
            num = t_m;
            ans++;
        }
        cnt2 = popcount2(num);
        while(num>0){
            num%=cnt2;
            cnt2 = popcount2(num);
            ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 6740
// cout << "Case #" << test << ": ";
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    for(int i = 0; i < 10000; i++) {
        if(i % 2 == 0) {
            c -= b;
            if(c <= 0) {
                cout << "Yes" << endl;
                return 0;
            }
        } else {
            a -= d;
            if(a <= 0) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         long N=gl();
         long a=gl();
         long b=gl();

         long ans=0;
    	 if((b-a)%2==0) {
    		 ans=(b-a)/2;
    	 } else {
    		 ans=(b-a-1)/2;
    		 ans+=Math.min(N-b+1, a);
    	 }
         System.out.println(ans);
     }


     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 35756
ans n = length $ [ (a,b,c,d) | a<-[0..9], b<-[0..9], c<-[0..9], d<-[0..9], a+b+c+d==n ]

main :: IO ()
main = do
    l <- getContents
    let i = map read $ lines l
        o = map ans i
    mapM_ (print) o

Measured memory_bytes: 3948
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
b = np.abs(A)
if np.count_nonzero(A < 0) % 2 == 0:
    print(np.sum(b))
else:
    print(np.sum(b)-np.min(b)*2)

Measured memory_bytes: 23272
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
while True:
    N = int(input())
    if N == 0:
        break
    table = list(map(int,input().split()))
 
    tmp_sum = 0
    for i in range(len(table)):
        tmp_sum += table[i]
    B = tmp_sum/len(table) #平均
 
    squared_sum = 0
    for i in range(len(table)):
        squared_sum += table[i]*table[i]
    A = squared_sum/len(table)
 
    print("%.10f"%(math.sqrt(A-B*B)))


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

string s;
cin >> s;
int N = s.size();

string t = s.substr(0, (N-1)/2);
string u = s.substr((N+1)/2);

string ss = s,tt = t, uu = u;
reverse(all(s));
reverse(all(t));
reverse(all(u));
if(ss == s && tt == t && uu == u) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
   
int main()
{
	int e, n=0;
	char w[11],t[1001];
	cin >> w >> t;
	for (int i = 0; i < 10; i++) {
		e = (int)w[i];
		if ((e >= 0x41)&&(e <= 0x5a))
			e += 32;
		w[i] = (char)e;
	}
	while (!(strstr(t,"END_OF_TEXT"))) {
		for (int i = 0; i < 1000; i++) {
			e = (int)t[i];
			if ((e >= 0x41)&&(e <= 0x5a))
				e += 32;
			t[i] = (char)e;
		}
		if(strcmp(w,t)==0)
			n++;
		cin >> t;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 3076
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n, k = map(int, input().split())
    As = list(map(int, input().split()))

    dic = defaultdict(int)
    for i in range(n):
        dic[As[i]] += 1
    
    ls = sorted(dic.values())
    
    if len(ls) <= k:
        print(0)
        return
    
    cnt = 0
    for i in range(len(ls) - k):
        cnt += ls[i]
    
    print(cnt)

            

    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 120280
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, Ans = 0;
  	cin >> N;
 	vector<int> a(100);
  
    for (int i = 0; i < N; i++) {
     	cin >> a.at(i);
    }
      for (int j = 0; j < N; j+=2) {
            if (a.at(j)% 2 != 0) {
				Ans++;
        	}
      }
	cout << Ans << endl ;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
  int A, B;
  cin >> A >> B;

  if (A % 2 == 1 && B % 2 == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
  
class Main {
    public static void main(String[] args) {
        int a, b;
        String s = "";
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        if (a == b) {
            s += "==";
        } else if (a > b) {
            s += ">";
        } else {
            s += "<";
        }
        System.out.println("a "+ s +" b");
    }
}


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

int main() {
	int n;
	while (cin >> n) {
		int cnt = 0;
		for (int i = 0; i <= min(n, 1000); i++)
			for (int j = 0; j <= min(n - i, 1000); j++) {
				if (n - i - j >= 1000 && n - i - j <= 2000)cnt += 1000 - (n - i - j - 1000) + 1;
				else if (n - i - j <= 2000)cnt += n - i - j + 1;
			}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3108
#include <stdio.h>
#include <math.h>

int main(void)
{
	double r,c,s;
	scanf("%lf",&r);
	c=r*2.0*M_PI;
	s=r*r*M_PI;
	
	printf("%.6lf %.6lf\n",s,c);
	return 0;
}

Measured memory_bytes: 652
#include <iostream>

int main()
{
	int a, b, c;
	std::cin >> a >> b >> c;
	int n = 0;
	for (int i = a; i <= b; i++)
	{
		if (c % i == 0)
		{
			n++;
		}
	}
	std::cout << n << std::endl;
	return 0;
}


Measured memory_bytes: 3100
s=gets.chomp
t=gets.chomp

flag = true
x = {}
y = {}
s.chars.zip(t.chars).each{|ss,tt| [tt, nil].include?(x[ss]) ? x[ss] = tt : flag=false}
s.chars.zip(t.chars).each{|ss,tt| [ss, nil].include?(y[tt]) ? y[tt] = ss : flag=false}

x.each do |k,v|
  flag = false unless [k, nil].include?(y[v])
end
y.each do |k,v|
  flag = false unless [k, nil].include?(x[v])
end

puts flag ? 'Yes' : 'No'

Measured memory_bytes: 67624
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
using namespace std;
const int maxn = 100100;
ll dp[maxn][3], n;
ll value[maxn][3];

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		for(int j=0;j<3;j++) {
			cin>>value[i][j];
		
			for(int d=0;d<3;d++) {
				if(d != j)
					dp[i][j] = max(dp[i][j], dp[i-1][d] + value[i][j]);
			}
		}
	}

	cout<<max(dp[n][0], max(dp[n][1], dp[n][2]))<<"\n";
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define mem(x) memset(x,0,sizeof(x))
#define ll long long 
typedef long long LL;
inline int rint() { int a; scanf("%d", &a); return a; }
inline long long rll() { long long a; scanf("%lld", &a); return a; }
//节点从0到n-1
#define maxn 100006
struct node { double x, y; };
int n;//有多少个点
int tot;//凸包上的点
node p[maxn];//所有点数组从0开始
node P[maxn];//凸包上的点
const double pi = acos(-1.0);
const double eps = 1e-9;
//三点差积	 
double X(node A, node B, node C) { return (B.x - A.x)*(C.y - A.y) - (C.x - A.x)*(B.y - A.y); }
//三点点积	 
double dian(node A, node B, node C) { return (B.x - A.x)*(C.x - A.x) + (C.y - A.y)*(B.y - A.y); }
//两点距离
double len(node A, node B) { return sqrt((A.x - B.x)*(A.x - B.x) + (A.y - B.y)*(A.y - B.y)); }
//角度小的在前面,相同的话距离小的在前面
bool cmp(node A, node B) {
	double pp = X(p[0], A, B);
	if (pp > 0)return true;
	if (pp < 0)return false;
	if (pp == 0)return len(p[0], A) < len(p[0], B);
}
//建立凸包存到P里//以下是n>=3的情况,n=1,2要特判
void build() {
	//找左下角的点
	for (int i = 0; i < n; i++) {
		if (p[i].y < p[0].y) swap(p[i], p[0]);
		if (p[i].y == p[0].y&&p[i].x < p[0].x) swap(p[i], p[0]);
	}
	sort(p + 1, p + n, cmp);
	P[0] = p[0];
	P[1] = p[1];
	tot = 1;//初始两个点
	for (int i = 2; i < n; i++) {
		//不需要边上的点//while (tot > 0 && X(P[tot - 1], P[tot], p[i]) <= 0)tot--;
		//需要边上的点
		while (tot > 0 && X(P[tot - 1], P[tot], p[i]) < 0)tot--;
		tot++;
		P[tot] = p[i];
	}

	node endd = P[tot];
	for (int i = n - 1; i >= 0; i--) {
		if (abs(X(P[0], endd, p[i])) <= eps) {
			if (dian(p[i], P[0], endd) < 0) {
				tot++;
				P[tot] = p[i];
			}
		}
		else break;
	}
	tot++;
}
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);
	n = rint();
	for (int i = 0; i < n; i++) scanf("%lf %lf", &p[i].x, &p[i].y);
	build();
	cout << tot << endl;
	for (int i = 0; i < tot; i++) cout << P[i].x << " " << P[i].y << endl;
	return 0;
}


Measured memory_bytes: 5832
import sys

N,K=map(int, sys.stdin.readline().split())

mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, N+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
 
def ncr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod


R=N-K+1

for i in range(1,K+1):
	print ( ncr(R,i)*ncr(K-1,i-1) )%mod



Measured memory_bytes: 32876
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int ls, lt, ans = 1005;
char s[1005], t[1005];
int main(){
	scanf("%s\n%s", s, t);
	ls = strlen(s); lt = strlen(t);
	rep(i,ls-lt+1){
		int cnt = 0;
		rep(j,lt) if(s[j+i] != t[j]) cnt++;
		ans = min(ans,cnt);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 3836
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

ll euclidean_gcd(ll a, ll b)
{
    if(a<b) swap(a, b);
    ll r;
    while((r=a%b)!=0){
        a=b;
        b=r;
    }

    return b;
}

int main()
{
    int N;
    cin >> N;
    vector< pair<ll, ll> > pairs(N);
    for(int i=0; i<N; i++){
        ll a,b;
        cin >> a >> b;
        pairs[i]=make_pair(b,a);
    }

    sort(pairs.begin(), pairs.end());
    ll now=0;
    int flag=true;
    for(int i=0; i<N; i++){
        now+=pairs[i].second;
        if(pairs[i].first<now) flag=false;
    }
    if(flag) cout << "Yes";
    else cout << "No";

    return 0;
}


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


int main(){
  string s;
  cin >> s;
  int x = 0;
  //レンジベース法. これによりcにsの各文字が入力される
  for (char c : s){
    x += (c-'0');
  }
  x %= 9;
  if (x == 0) cout << "Yes" << endl;
  else cout <<"No" << endl;
  return 0; 


  
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
#include <iostream>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
//#define mod 1e9+7 // was not working
//const int mod=1e9+7; //works kool

int main() {
    fast;
    int N;
    cin>>N;
    vector<double>P(N+1, 0.0);
    
    for(int i=1;i<=N;i++)
       cin>>P[i];
    
    vector<vector<double>>dp(N+1,vector<double>(N+1, 0.0));
    dp[0][0]=1.0;
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N;j++){
            if(j==0)
                dp[i][j] = dp[i-1][j]*(1-P[i]);
            else{
                dp[i][j] = dp[i-1][j-1]*P[i] + dp[i-1][j]*(1-P[i]); //j heads till last coin so prob of tail here
            }
        }
    }

    double ans=0.0;
    
    for(int i=(N+1)/2;i<=N;i++)
        ans+=dp[N][i];
    
    printf("%.9f",ans);
    return 0;
}


Measured memory_bytes: 70784
#include <cstdio>

int main()
{
    int r, g, b;
    scanf("%d %d %d", &r, &g, &b);

    int sum = 100*r + 10*g + b;
    if (sum % 4 == 0)   printf("%s", "YES");
    else printf("%s", "NO");
    
}

Measured memory_bytes: 128
using System;
using System.Linq;
using static System.Math;

class E
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var s = read();
		int h = s[0], w = s[1];
		var a = new int[h].Select(_ => read()).ToArray();
		var b = new int[h].Select(_ => read()).ToArray();
		var m = a.Zip(b, (u, v) => u.Zip(v, (x, y) => x - y).ToArray()).ToArray();

		var M = 40 * (h + w + 1);
		var dp = new bool[h, w, M];
		dp[0, 0, Abs(m[0][0])] = true;
		for (int k = 0; k < h + w - 2; k++)
		{
			for (int i = 0, j = k; i <= k; i++, j--)
			{
				if (i >= h || j >= w) continue;

				for (int v = 0, v2; v < M; v++)
				{
					if (!dp[i, j, v]) continue;

					if (j + 1 < w)
					{
						if ((v2 = Abs(v + m[i][j + 1])) < M) dp[i, j + 1, v2] = true;
						if ((v2 = Abs(v - m[i][j + 1])) < M) dp[i, j + 1, v2] = true;
					}
					if (i + 1 < h)
					{
						if ((v2 = Abs(v + m[i + 1][j])) < M) dp[i + 1, j, v2] = true;
						if ((v2 = Abs(v - m[i + 1][j])) < M) dp[i + 1, j, v2] = true;
					}
				}
			}
		}
		Console.WriteLine(Enumerable.Range(0, M).First(i => dp[h - 1, w - 1, i]));
	}
}


Measured memory_bytes: 52064
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
#include <map>
  
using namespace std;

double r;
int n;

int main(){
	
	while(scanf("%lf %d",&r,&n),r){

		int left,right,h;
		int HL[41]={};
		int HR[41]={};
		for(int i=0;i<n;i++){
			cin>>left>>right>>h;
			for(int x=left;x<=right;x++){
				if(x!=right) HL[x+20]=max(HL[x+20],h);
				if(x!=left)  HR[x+20]=max(HR[x+20],h);
			}	
		}
		
		double res=1e10;
		//[i,i+1]??????????????????
		for(int i=-r;i<=r-1;i++){
			double t1=r-sqrt(r*r-i*i)+HL[i+20];
			double t2=r-sqrt(r*r-(i+1)*(i+1))+HR[i+1+20];
			res=min(res,min(t1,t2));
		}
		printf("%.8f\n",res);
		
	}
	
	return 0;
}

Measured memory_bytes: 3136
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
    int a;
    cin>>a;
    if(a==1){
        printf("Hello World");
    }else if(a==2){
        int b,c;
        cin>>b>>c;
        printf("%d",b+c);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r,d,ans=0;
    cin>>l>>r>>d;
    for(int i=1;i<=r;i++)
    {
        if(d*i>=l&&d*i<=r)
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  int i = 0, N = S.size();
  while (i < N) {
    if (S.substr(i, 6) == "eraser") {
      i += 6;
    } else if (S.substr(i, 5) == "erase") {
      i += 5;
    } else if (S.substr(i, 7) == "dreamer") {
      if (S.substr(i+5, 5) == "erase") {
        i += 5;
      } else {
        i += 7;
      }
    } else if (S.substr(i, 5) == "dream") {
      i += 5;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,n;
    cin >> n;
    PII a[n+5];
    int ans[n+5];
    for(i=1;i<=n;i++)
    {
        cin >> a[i].FI;
        a[i].SE=i;
    }
    sort(a+1,a+n+1);
    for(i=1;i<=n;i++)
    {
        if(i <= n/2)ans[a[i].SE]=a[n/2+1].FI;
        else ans[a[i].SE]=a[n/2].FI;
    }
    for(i=1;i<=n;i++)cout << ans[i] << '\n';
    return 0;
}


Measured memory_bytes: 4608
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, a: "List[int]"):
    c = 1
    for i in a:
        c += i == c
    return len(a) - (c-1) if c != 1 else -1


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(f'{solve(N, a)}')


if __name__ == '__main__':
    main()


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

int main() {
  int N, W; cin >> N >> W;
  vector<int> w(N), v(N);
  for (int i = 0; i < N; i++) cin >> w.at(i) >> v.at(i);
  // dp[i][j] := i 番目の品物までで、容量 j のナップサックに詰められる価値の最大値
  vector<vector<long long>> dp(N+1, vector<long long>(W+1, 0));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      // i 番目の品物を選ばない
      dp.at(i+1).at(j) = max(dp.at(i+1).at(j), dp.at(i).at(j));
      // i 番目の品物を選ぶ
      if (j - w.at(i) >= 0) {
        dp.at(i+1).at(j) = max(dp.at(i+1).at(j), dp.at(i).at(j - w.at(i)) + v.at(i));
      }
    }
  }
  cout << dp.at(N).at(W) << endl;
}

Measured memory_bytes: 80256
n,k=map(int,input().split())
x=list(map(int,input().split()))

ans=[0 for _ in range(n-k+1)]

for i in range(n-k+1):
    ans[i]=abs(x[i]-x[i+k-1])+min(abs(x[i]),abs(x[i+k-1]))
print(min(ans))

Measured memory_bytes: 14252
if __name__ == "__main__":
    N, K = map(int, input().split())
    G = [[] for _ in range(N)]
    for n in range(N-1):
        a, b = map(int, input().split())
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)

    C = [0] * N

    for k in range(K):
        p, x = map(int, input().split())
        C[p - 1] += x

    V = [False]*N
    stack = [0]
    while stack:
        x = stack.pop()
        V[x] = True
        for y in G[x]:
            if V[y]:
                continue

            C[y] += C[x]
            stack.append(y)

    print(*C)


Measured memory_bytes: 105344
from itertools import accumulate as acc

def bit_sum(ls, i):
  s = 0
  i += 1
  while i>0:
    s += ls[i]
    i -= i & -i
  return s

def bit_add(ls, i, n):
  i += 1
  while i<len(ls):
    ls[i] += n
    i += i & -i

N, K, *A = map(int, open(0).read().split())
A = [a-K for a in A]
B = [(b,i) for i, b in enumerate(acc(A))]
bit_B = [0]*(N+1)
B.sort(reverse=True)
ans = sum(c[0]>=0 for c in B)
for b,i in B:
  bit_add(bit_B,i,1)
  ans += bit_sum(bit_B,N-1)-bit_sum(bit_B,i)
print(ans)

Measured memory_bytes: 44252
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  int n, m;
  cin >> n >> m;
  cout << (n - 1) * (m - 1) << endl;
  return 0;
}


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

typedef long long ll;
// int = ll;

int main(){	
	
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);	

	ll a,b;
	
	cin >> a >> b;
	
	if(a<=b){
		cout << "unsafe" << endl;
	}else{
		cout << "safe" << endl;
	}

return 0;	
}


Measured memory_bytes: 3584
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

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

int main() {
    int n, m;
    cin >> n >> m;
    ll x[n], y[n], z[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }

    ll ans = 0;
    for (int u = -1; u <= 1; u += 2) {
        for (int v = -1; v <= 1; v += 2) {
            for (int w = -1; w <= 1; w += 2) {
                pli t[n];
                for (int i = 0; i < n; i++) {
                    t[i] = {x[i] * u + y[i] * v + z[i] * w, i};
                }
                sort(t, t+n);
                reverse(t, t+n);

                ll cur = 0, sx = 0, sy = 0, sz = 0;
                for (int i = 0; i < m; i++) {
                    cur += t[i].first;
                    sx += x[t[i].second];
                    sy += y[t[i].second];
                    sz += z[t[i].second];
                }

                if (sx * u >= 0 && sy * v >= 0 && sz * w >= 0) {
                    ans = max(ans, cur);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main() {
	string row;
	string ans;
	while(cin>>row, !cin.eof()){
		int i=0;
		ans = "";
		while(row[i] != NULL){
			if(row[i] == '@'){
				int count = (int)row[i+1] - '0';
				for(int j=0; j<count; j++){
					ans += row[i+2];
				}
				i += 3;
			}else{
				ans += row[i];
				i++;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1176
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	V[] G;
	boolean[] used;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			if(n == 0) break;
			
			G = new V[n * 20 ];
			for(int i=0;i<n*20;i++) G[i] = new V();
			
			HashMap<String, Integer> map = new HashMap<String, Integer>();
			
			int ind = 0;
			for(int i=0;i<n;i++) {
				String[] sp = sc.next().split("[:,.]");
				if(!map.containsKey(sp[0])) map.put(sp[0], ind++);
				int f = map.get(sp[0]);
				
				for(int j=1;j<sp.length;j++) {
					if(!map.containsKey(sp[j])) map.put(sp[j], ind++);
					int t = map.get(sp[j]);
					G[f].add(t);
				}
			}
			
			used = new boolean[n*20];
			cnt = 0;
			dfs(0);
			System.out.println(cnt);
		}
		
	}
	
	int cnt;
	void dfs(int p) {
		used[p] = true;
		if(G[p].size()==0)cnt++;
		for(int i: G[p]) if(!used[i]) dfs(i);
	}
	
	class V extends ArrayList<Integer>{}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 52508
#define _USE_MATH_DEFINES

//#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <vector>
    
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

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


} // end of main
    
//実行は、Opt + Ctl + N


//pythonの入力
//s, w = map(int, input().split())


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

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) cin >> s[i];
    sort(s.begin(), s.end());

    for (int i = 0; i < n; ++i) cout << s[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N,M = map(int, input().split())
G = [[] for _ in range(N)]

E = []
for _ in range(M):
    a,b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
    E.append((a-1,b-1))

d = [0] + [-1]*(N-1)

def dfs(n):
    d[n] = 0
    for v in G[n]:
        if d[v] == -1:
            dfs(v)

ans = 0
for a,b in E:
    G[a].remove(b)
    G[b].remove(a)

    dfs(0)

    if -1 in d:
        ans += 1
    
    for i in range(1,N):
        d[i] = -1
    G[a].append(b)
    G[b].append(a)

print(ans)

Measured memory_bytes: 12420
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=5e5+5;
int bl[N],ans,cnt[N],Ans[N],n,m,a[N];

struct que{
	int l,r,i;
	inline bool operator < (const que &nt) const {
		return bl[l]^bl[nt.l]?bl[l]<bl[nt.l]:bl[l]&1?r<nt.r:r>nt.r;
	}
}q[N];

void inc(int x){
	ans+=!cnt[a[x]]++;
}

void dec(int x){
	ans-=!--cnt[a[x]];
}

signed main(){
	read(n,m);
	for(int i=1;i<=n;i++) read(a[i]);
	int len=sqrt(n);
	for(int i=1;i<=n;i++) bl[i]=(i-1)/len+1;
	for(int i=1,l,r;i<=m;i++){
		read(l,r);
		q[i]={l,r,i};
	}
	sort(q+1,q+1+m);
	for(int i=1,l=1,r=0;i<=m;i++){
		while(l>q[i].l) inc(--l);
		while(l<q[i].l) dec(l++);
		while(r<q[i].r) inc(++r);
		while(r>q[i].r) dec(r--);
		Ans[q[i].i]=ans;
	}
	for(int i=1;i<=m;i++) write(Ans[i]),puts("");
}

Measured memory_bytes: 17404
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
s = 0 

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500+b*100+c*50 == X:
                count += 1

print("{}".format(count))

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    ll n;   cin >> n;
    ll ans = 0;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    for(ll i = 2; i*i <= n; i++){
        if(n%i == 0){
            bool flag = false;
            for(int e = 1; n%i == 0; e++){
                ans++;
                rep(j, e){
                    if(n%i == 0)    n /= i;
                    else{
                        flag = true;
                        break;
                    }
                }
                if(flag){
                    ans--;
                    break;
                }
            }
        }
    }
    
    if(n != 1)  ans++;

    if(!ans){
        cout << 1 << endl;
    }else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(void)
{
    char c;
    cin >> c;
    switch(c) {
        case 'A':
        cout << 'T';
        break;
        case 'T':
        cout << 'A';
        break;
        case 'G':
        cout << 'C';
        break;
        case 'C':
        cout << 'G';
    }
    cout << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<cstring>

using namespace std;

int main(void){
  int a,b;
  char c,i[100000];

  stack<int> s;

  while(cin >> i){
    if(s.size() < 2)
      s.push(atoi(i));
    else{

      if(!strcmp(i,"+")){

        a=s.top();
        s.pop();
        b=s.top();
        s.pop();
        s.push(a+b);
      }
      else if(!strcmp(i,"-")){

        a=s.top();
        s.pop();
        b=s.top();
        s.pop();
        s.push(b-a);
      }
      else if(!strcmp(i,"*")){

        a=s.top();
        s.pop();
        b=s.top();
        s.pop();
        s.push(a*b);
      }
      else
        s.push(atoi(i));
    }
  } 
  cout << s.top() << endl;
}


Measured memory_bytes: 3108
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）

int main(){
  mpint x;
  cin >> x;

  mpint year = 0;

  mpint money = 100;

  while(1){
    ++year;

    money += money/100;

    if(x <= money){
      break;
    }
  }

  cout << year << endl;

  return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
 
int N;
string A;
int B[10005];
int pre[10005][5];
long long ans;
 
int main() {
  cin >> N >> A;
  for(int i = 0; i < N; i++) {
    B[i + 1] = (A[i] == 'R'? 1 : A[i] == 'G'? 2 : 3);
    pre[i + 1][B[i + 1]] = 1;
  }
  for(int i = 1; i <= N; i++) {
    for(int j = 1; j <= 3; j++) {
      pre[i][j] += pre[i - 1][j];
    }
  }
  int cari;
  for(int i = 1; i <= N - 2; i++) {
    for(int j = i + 1; j <= N - 1; j++) {
      if(B[i] == B[j])  continue;
      cari = B[i] ^ B[j];
      ans += pre[N][cari] - pre[j][cari] - (B[j + j - i] == cari ? 1 : 0); 
    }
  }
  cout << ans << "\n";
}

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

using namespace std;

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

const int N = 1e5 + 5;

int n,x[N],y[N],h[N];

int geth(int cx,int cy) {
  int res = -1,mx = -1;
  for (int i = 1 ; i <= n ; i++) {
    int a = abs(cx - x[i]);
    int b = abs(cy - y[i]);
    if (res == -1) {
      if (h[i] == 0) {
        mx = max(mx,a + b);
      } else {
        res = a + b + h[i];
      }
    } else {
      if (max(res - a - b,0) != h[i]) return -1;
    }
  }
  if (mx != -1 && res > mx) return -1;
  return res;

}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n;
  for (int i = 1 ; i <= n ; i++)
    cin >> x[i] >> y[i] >> h[i];
  for (int cx = 0 ; cx <= 100 ; cx++)
    for (int cy = 0 ; cy <= 100 ; cy++) {
      int temp = geth(cx,cy);
      if (temp != -1) {
        cout << cx << " " << cy << " " << temp << endl;
        return 0;
      }
    }
}

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

int N, A[3][3], b[10];
bool appear[3][3];

int main(){
    for(int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++ ){
            cin >> A[i][j];
        }
    }
    cin >> N;
    for(int i = 0 ; i < N; i++)cin >> b[i];
    for(int i = 0; i < N; i++){
        for(int j = 0 ; j < 3 ; j++){
            for(int k = 0; k < 3; k++){
                if(b[i] == A[j][k]) appear[j][k]=1;

            }
        }
    }
    string ANS ="No";
    for(int i = 0 ; i < 3 ; i++){
        if(appear[i][0] and appear[i][1] and appear[i][2]) ANS ="Yes";
    }
    for(int i = 0; i < 3 ; i++){
        if(appear[0][i] and appear[1][i] and appear[2][i]) ANS ="Yes";
    }
    if(appear[0][0] and appear[1][1] and appear[2][2]) ANS = "Yes";
    if(appear[0][2] and appear[1][1] and appear[2][0]) ANS = "Yes";
    if(ANS == "Yes")cout << "Yes" << endl;
    else cout << "No" <<endl;
    return 0;

}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readNextInt() int{
  sc.Scan()
  n, _ := strconv.Atoi(sc.Text())
  return n
}

func calcMaximumProfit(prices []int) int {
  profit := prices[1]-prices[0]
  maximumProfit := profit
  delta := profit
  minimumPrice := prices[0]
  for i:=1; i<len(prices); i++{
    delta = prices[i] - minimumPrice
    if prices[i] < minimumPrice {
      minimumPrice = prices[i]
    }
    if delta > maximumProfit{
      maximumProfit = delta
    }
  }
  return maximumProfit
}

func main() {
  //sc.Split(bufio.ScanWords)
  datanum := readNextInt()
  var inputs []int
  maximumProfit := 0

  for i:=0; i<datanum; i++{
    inputs = append(inputs,readNextInt())
  }

  maximumProfit = calcMaximumProfit(inputs)

  fmt.Println(maximumProfit)
}



Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	int ans=0;
	cin>>s;
	rep(i,s.size()){
		rep(k,s.size()){
			bool ok=true;
			range(j,i,k+1){
				ok&=(s[j]=='A'||s[j]=='T'||s[j]=='C'||s[j]=='G');
			}
			if(ok)chmax(ans,k-i+1);
		}
	}
	cout<<ans<<endl;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int n;
	cin>>n;
	map<string,int> m;
	while(n--)
	{
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC"<<" x "<<m["AC"]<<endl;
	cout<<"WA"<<" x "<<m["WA"]<<endl;
	cout<<"TLE"<<" x "<<m["TLE"]<<endl;
	cout<<"RE"<<" x "<<m["RE"]<<endl;
	return 0;
}



Measured memory_bytes: 3660
from collections import defaultdict
d = defaultdict(int)

n = int(input())						# 5
for i in range(n):
	k = input()
	d[k] += 1

n = int(input())						# 5
for i in range(n):
	k = input()
	d[k] -= 1

#print(*d)

d = sorted(d.items(), key=lambda x: -x[1])
i = max(0, d[0][1])
print(i)



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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<29;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};



int main(){
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(s == u){
        a--;
    }else{
        b--;
    }
    cout << a << " " << b << endl;
    return 0;
}


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

int a[100010],s=0;
int d[100010];

inline int read(){
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}

inline void write(int x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}

inline void writeln(int x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
     puts("");
}

signed main(){
    int n=read();
    for(int i=1;i<=n;i++){
        a[i]=read();
        s+=a[i];
        d[a[i]]++;
    }
        
    int q=read();
    for(int i=1;i<=q;i++){
        int b=read(),c=read();
        s+=(c-b)*d[b];
        writeln(s);
        d[c]+=d[b];
        d[b]=0;
    }
    
    return 0;
}

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

using namespace std;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    char s[111];
    scanf("%s", s);
    if (s[a] != '-') {
        puts("No");
        return 0;
    }
    for (int i = 0; s[i]; i++) {
        if (i == a)
                continue;
        if (s[i] >= '0' && s[i] <= '9')
                continue;
        puts("No");
        return 0;
    }
    puts("Yes");
    return 0;
}


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

const int N = 1e5 +10;
int n,m;
vector<int> adj[N];
int mem[N];

int dp(int i){
	int &ret = mem[i];
	if(ret != -1) return ret;
	ret = 0;
	for(auto x : adj[i])
		ret = max(ret , 1 + dp(x));
	return ret;
}

int main(){
	memset(mem , -1 , sizeof mem);
	scanf("%d%d" , &n , &m);
	for(int i=0 ; i<m  ; i++){
		int u , v;
		scanf("%d%d"  ,&u , &v);
		adj[u].push_back(v);
	}
	int ans = 0;
	for(int i=1 ; i<=n ; i++)
		ans = max( ans , dp(i));
	printf("%d" , ans);
}


Measured memory_bytes: 7424
#include <iostream>

using namespace std;

int main(){
  char b;
  std::cin >> b;
  if( b == 'A'){
    std::cout << "T" << '\n';
  }else if( b == 'T'){
    std::cout << "A" << '\n';
  }else if( b == 'C' ){
    std::cout << "G" << '\n';
  }else if(b == 'G'){
    std::cout << "C" << '\n';
  }
  return 0;
}


Measured memory_bytes: 760
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;

int main() {

  int Q;
  cin >> Q;
  while(Q--) {
    string s;
    cin >> s;
    int cnt = 0;
    while(s.size() > 1) {
      int maxi = 0;
      for(int i = 1; i < s.size(); i++) {
        string left = s.substr(0, i), right = s.substr(i, s.size() - i);
        //cout << left << " " << right << endl;
        maxi = max(maxi, atoi(left.c_str()) * atoi(right.c_str()));
      }
      s = to_string(maxi);
      cnt++;
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 3240
n,k,c = list(map(int,input().split()));s=[True if i=="o" else False for i in input()]
front=[0]*n;back=[0]*n;count=0
 
day = 0
while day < n:
    if s[day]:
        count += 1
        front[day]= 1
        day += c+1
    else:
        day += 1
    
s = s[::-1]
day = 0
while day < n:
    if s[day]:
        back[day]= 1
        day += c+1
    else:
        day += 1
back = back[::-1]
    
if count ==k:
    for i in range(n):
        if front[i] ==1 and back[i] == 1:
            print(i+1)

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

using namespace std;

typedef long long ll;

const int mx = (int) 1e3 * 100 + 5;
const int inf = (int) 1e9 + 778;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, w;
	cin >> n >> w;
	vector<long long> dp(mx + 1, inf);
	dp[0] = 0;
	for (int t = 0; t < n; t++) {
		int x, y;
		cin >> x >> y;
		// weight, value
		for (long long i = mx - y; i >= 0; i--) {
			// look at dp[i] for result
			// working on dp[i + this.value
			long long mv = i + y;
			dp[mv] = min(dp[mv], dp[i] + (ll) x);
		}
	}
	for (int i = mx; i >= 0; i--) {
		if (dp[i] <= w) {
			cout << i << '\n';
			break;
		}
	}
	return 0;
}

/*
- minimize the weight but maximize the value
dp[value] = total weight required to aquire
that value
- make sure dp[value] <= weight given.
dp[0] = 0
*/


Measured memory_bytes: 3948
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int[] d = new int[101];
		int cnt = 0;

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			d[a]++;
		}
		
		for (int i = 0; i <= 100; i++) {
			if (d[i] != 0) {
				cnt++;
			}
		}
		
		
		System.out.println(cnt);

		sc.close();
	}
}


Measured memory_bytes: 23892
import scipy.misc
import math

n,m = map(int, input().split())

M = m
lst, count = [],[]
if M == 1:
    print(1)
else:
    for i in range(2,int(math.sqrt(m))+1):
        while M % i == 0:
            M = M // i
            if i not in lst:
                count.append(1)
                lst.append(i)
            else:
                count[-1] += 1
    if M > 1:
        lst.append(M)
        count.append(1)       

    ans = 1
    for i in count:
        ans = ans * scipy.misc.comb(i+n-1,i, exact=1)
        ans = ans % (10**9+7) 

    print(int(ans))

Measured memory_bytes: 14464
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String[] s = sc.nextLine().split(" ");
		int a = Integer.parseInt(s[0]);
		int b = Integer.parseInt(s[1]);
		int d = a / b;
		int r = a % b;
		double af = (double) a;
		double bf = (double) b;

		double f = af / bf;

		System.out.println(d + " " + r + " " + new DecimalFormat("0000000000.0000000000").format(f));
	}
}

Measured memory_bytes: 26292
#include <cstdio>
#include <map>
#define MOD 1000000007 // 10^9 + 7
#define MAX 200000
using namespace std;

map<int,int> factorize(int m) {
    map<int, int> factor;

    while (m % 2 == 0) {
        factor[2]++;
        m /= 2;
    }

    int p = 3;
    while (p * p <= m) {
        if (m % p == 0) {
            factor[p]++;
            m /= p;
        } else {
             p += 2;
        }
    }

    if (m != 1) factor[m]++;
    return factor;
}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n,m;

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

    map<int, int> factor = factorize(m);

    long long ans = 1;
    COMinit();
    for (auto it: factor) {
        //printf("%d %d\n", it.first, it.second);

        ans *= COM(it.second + n - 1, n - 1);
        ans %= MOD;
    }

    printf("%lld\n", ans);

    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    double BTC = 380000.0;
    int n; cin >> n;
    double sum = 0;
    rep(i, n){
        double m; cin >> m;
        string s; cin >> s;
        if(s == "JPY"){
            sum += m;
        }else{
            sum += m * BTC;
        }
    }
    cout << fixed << setprecision(5) << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
string a;
  cin>>a;
  int i,n,c;
  c=0;
  n=a.length();
  if(n%2==0)
  {
    for(i=0;i<(n/2);i++)
    {
      if(a[i]!=a[n-1-i])
        ++c;
    }
  }
  else
  {for(i=0;i<(n/2);i++)
  {
    if(a[i]!=a[n-1-i])
      ++c;
  }
  }
  cout<<c;
  return 0;
}





Measured memory_bytes: 256