akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max(a,b)-min(a,b))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];

  scanf("%lld",&n);
  if(n%2==0){
    for(i=10;i<=n;i*=5){
      result += n/i;
    }
  }
  printf("%lld", result);

  return 0;
}



Measured memory_bytes: 128
main :-
	read_num(A),
	read_num(B),
        read_num(C),
        read_num(K),
	magic(A, B, C, K),
	write('Yes'),
	nl,
	halt.
main :- write('No'),
	nl,
	halt.


magic(A, B, C, K) :-
        K >= 0,
        B > A,
        C > B,
        !.
magic(A, B, C, K) :-
        K >= 0,
        NewA is A * 2,
        NewK is K - 1,
        magic(NewA, B, C, NewK).
magic(A, B, C, K) :-
        K >= 0,
        NewB is B * 2,
        NewK is K - 1,
        magic(A, NewB, C, NewK).
magic(A, B, C, K) :-
        K >= 0,
        NewC is C * 2,
        NewK is K - 1,
        magic(A, B, NewC, NewK).
	

read_str(S) :-
        read_string(current_input, ' \n', '', _, S).

read_num(N) :-
	read_str(S),
	number_string(N, S).


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){

	int H, A; cin >> H >> A;
	int ans = (H + A- 1) / A;

	cout << ans << endl;

	return 0;

}


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

void chmin(int& a, int b){
    a = min(a, b);
}

const int Tmax = 10000;
int N, M;
int Dst[Tmax];

int dist[400][400], E[400][400], Nxt[400][400], Total;

void initialize(){
    cin >> N >> M;
    for(int i=0; i<M; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        E[a][b] = E[b][a] = c;
    }
    int _; cin >> _;
    for(int i=0; i<Tmax; i++){
        int n; cin >> n;
        if(n) cin >> _ >> Dst[i];
        Dst[i]--;
        Total += n;
    }

    for(int i=0; i<N; i++) for(int j=0; j<N; j++) if(i != j) dist[i][j] = (E[i][j] ? E[i][j] : 1e9);
    for(int k=0; k<N; k++) for(int i=0; i<N; i++) for(int j=0; j<N; j++) chmin(dist[i][j], dist[i][k] + dist[k][j]);
    for(int i=0; i<N; i++) for(int j=0; j<N; j++){
        for(int k=0; k<N; k++) if(i != k && E[i][k] && E[i][k] + dist[k][j] == dist[i][j]){
            Nxt[i][j] = k;
            break;
        }
    }
}

vector<int> ans;
vector<int> stock[400], have[400];
int pos, now, stocksum, havesum;
int64_t score;
int scorenum = 0;

void addtime(){
    if(now < Tmax && Dst[now] >= 0){
        stocksum++;
        stock[Dst[now]].push_back(now);
    }
    now++;
}
void visit(int v){
    if(now > Tmax) return;
    //cerr << "Visit " << v << " on " << now << endl;
    if(v == 0) for(int i=0; i<N; i++){
        for(int a : stock[i]) have[i].push_back(a);
        stocksum -= stock[i].size();
        havesum += stock[i].size();
        stock[i].clear();
    }
    for(int a : have[v]) score += Tmax*Tmax - (now-a)*(now-a);
    scorenum += have[v].size();
    havesum -= have[v].size();
    have[v].clear();
}

void moveto(int v){
    if(pos == v){
        addtime();
        ans.push_back(-1);
        visit(pos);
        return;
    }
    while(pos != v){
        int nxt = Nxt[pos][v];
        int d = E[pos][nxt];
        bool leave = false;
        while(d--){
            addtime();
            if(!leave) visit(pos);
            leave = true;
            ans.push_back(nxt);
        }
        pos = nxt;
        visit(nxt);
    }
}

int main(){
    initialize();
    while(ans.size() < Tmax){
        if(havesum <= 10 || (stocksum/max(dist[pos][0], 1) >= 3)){
            moveto(0);
            continue;
        }
        int nxt = 0;
        double eff = 0;
        for(int i=0; i<N; i++){
            int p = pos, tm = now;
            double eff2 = 0;
            while(p != i){
                tm += E[p][Nxt[p][i]];
                p = Nxt[p][i];
                for(int a : have[p]) eff2 += Tmax*Tmax - (tm-a)*(tm-a);
            }
            eff2 /= dist[pos][i];
            if(eff < eff2){
                nxt = i;
                eff = eff2;
            }
        }
        moveto(nxt);
    }
    ans.resize(Tmax);
    for(int a : ans) cout << (a == -1 ? -1 : a+1) << endl;
    cerr << "score:        " << score << endl;
    cerr << "deliver num:  " << scorenum << " / " << Total << " (" << double(scorenum)/Total << ")" << endl;
    cerr << "average:      " << score / scorenum << endl;
    cerr << "for perfect:  " << (score / (double(Tmax)*Tmax*Total)) << endl;
}


Measured memory_bytes: 2304
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    def gcd(a: Int, b: Int): Int = {
      return b match {
        case 0 => a
        case x => gcd(x, a % x)
      }
    }
    val in = new Scanner(System.in)
    val ans = gcd(in.nextInt(), in.nextInt())
    println(ans)
  }
}

Measured memory_bytes: 44844
from collections import defaultdict

N,K = map(int, input().split())
A = [int(i) for i in input().split()]
used_dict = defaultdict(int)
used_dict[0] += 1
now_town = 0
flag = False

for i in range(min(N,K)):
    now_town = A[now_town]-1
    if used_dict[now_town]:
        used_dict[now_town] += 1
        break
    used_dict[now_town] += 1
else:
    flag = True

if not flag:
    now_town2 = 0
    cnt = 0
    while 1:
        if now_town2 == now_town:
            for _ in range((K-cnt)%(i-cnt+1)):
                now_town = A[now_town]-1
            break
        now_town2 = A[now_town2]-1
        cnt += 1
print(now_town+1)

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

const long long mod = pow(10, 9) + 7;

int pattern(int bef, int now)
{
  if (bef == 1 && (now == 1 || now == 2)) return 2;
  if (bef == 2)
  {
    if (now == 1) return 1;
    if (now == 2) return 3;
  }
  return 0;
}

int main()
{
  int N;
  cin >> N;
  string S1, S2;
  cin >> S1 >> S2;
  S1 += ' ';
  
  int M = 0;
  vector<int> V(60);
  for (int i = 0; i < N; i++)
  {
    if (S1.at(i) == S1.at(i + 1))
    {
      V.at(M) = 2;
      i++;
    }
    else 
    {
      V.at(M) = 1;
    }
    M++;
  }
  
  long long ans = 3;
  if (V.at(0) == 2) ans *= 2;
  for (int i = 1; i < M; i++)
  {
    ans *= pattern(V.at(i - 1), V.at(i));
    ans %= mod;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int A[100], B[100], C[100];

int main() {
    int n, r;
    while(cin >> n >> r) {
        if(n == 0 && r == 0) break;
        for(int i=0; i<n; ++i) A[i] = i;
        while(r--) {
            int p, c; cin >> p >> c;
            for(int i=n+1-p-c; i<n+1-p; ++i) B[i] = A[i];
            for(int i=n+1-p; i<n; ++i) C[i] = A[i];
            for(int i=n+1-p; i<n; ++i) A[i - c] = C[i];
            for(int i=n+1-p-c; i<n+1-p; ++i) A[i + p - 1] = B[i];
        }
        cout << A[n - 1] + 1 << '\n';
    }
}


Measured memory_bytes: 3076
import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    A, B = map(int, sys.stdin.readline().split())
    print(max(A + B, max(A - B, A * B)))

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

const int N = 110;
const int mod = 998244353;

typedef long long LL;

map<string, int> f, g;

int solve(string s);

vector<int> divs[N];

int fold(string s) {
    if (s.size() == 1) return 1 + (s[0] == '1');
    if (f.count(s)) return f[s];
    int res = 0;
    for (auto l : divs[s.size()]) {
        string tmp;
        for (int i = 1; i <= l; i++) {
            bool flag = true;
            for (int j = i; flag && j <= s.size(); j += l)
                if (s[j - 1] != '1') flag = false;
            if (flag) tmp += '1';
            else tmp += '0';
        }
        res = (res + solve(tmp)) % mod;
    }
    return f[s] = res;
}

int solve(string s) {
    if (s.size() == 0) return 1;
    if (s.size() == 1) return 1 + (s[0] == '1');
    if (g.count(s)) return g[s];
    int res = 0; 
    for (int i = 1; i <= s.size(); i++) {
        string L, R;
        for (int j = 1; j <= s.size() - i; j++) L += s[j - 1];
        for (int j = s.size() - i + 1; j <= s.size(); j++) R += s[j - 1];
        res = (res + (LL)solve(L) * fold(R)) % mod;
    }
    return g[s] = res;
}

int main() {
    string s; cin >> s;
    for (int i = 1; i <= N - 10; i++)
        for (int j = i * 2; j <= N - 10; j += i) divs[j].push_back(i);
    printf("%d\n", solve(s));
    return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

double n, a[100];
double cnt;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		cnt += 1 / a[i];
	}
	printf("%.10f", 1 / cnt);
}


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

using namespace std;

int main() {
  int A, B, X;
  cin >> A >> B >> X;
  string ans;
  if (X < A || A + B < X) {
    ans = "NO";
  } else {
    ans = "YES";
  }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

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

        int count = Integer.parseInt(sc.nextLine());

        int[] rates = new int[count];
        for (int i = 0; i < count; i++) {
        	rates[i] = Integer.parseInt(sc.nextLine());
        }

        int min = rates[0];
        int max = rates[1] - rates[0];
        for (int i = 1; i < count; i++) {
        	max = Math.max(max, rates[i] - min);
        	min = Math.min(min, rates[i]);
        }

        System.out.println(max);
    }

}


Measured memory_bytes: 167692
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int N;
string S;


constexpr auto R = 0;
constexpr auto G = 1;
constexpr auto B = 2;

int main()
{

	cin >> N;
	cin >> S;

	auto s = vector<int>(N);
	auto sum_array = vector<vector<int>>(3,vector<int>(N,0));


	for (int i = N-1; i >=0 ; i--) {
		if (i < N - 1) {
			sum_array[0][i] = sum_array[0][i+1];
			sum_array[1][i] = sum_array[1][i + 1];
			sum_array[2][i] = sum_array[2][i + 1];
		}

		if (S[i] == 'R') {
			s[i] = R;
			sum_array[R][i]++;
		}
		else if (S[i] == 'G') {
			s[i] = G;
			sum_array[G][i]++;
		}
		else {
			s[i] = B;
			sum_array[B][i]++;
		}

	}

	long long ans = 0;

	for (int i = 0; i < N-2; i++) {
		int f = s[i];
		for (int j = i + 1; j < N - 1; j++) {
			if (s[j] == f) { continue; }

			int l = R;
			if (l == f || l == s[j]) {
				l = G;
			}
			if (l == f || l == s[j]) {
				l = B;
			}

			ans += sum_array[l][j + 1];

			if (2 * j - i < N && s[2 * j - i] == l) {
				ans--;
			}


		}

	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) { cout << "Possible" << endl; }
  else { cout << "Impossible" << endl; }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, s, n) for(int i = s; i < n; i++)
#define rRep(i, n) for(int i = n - 1; i >= 0; i--)
#define pii pair<int, int>
#define vii vector<pair<int, int>>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define endl "\n"

vi vec;

int merge(int left, int mid, int right) {
    vi temp;
    int inv = 0;
    int i = left, j = mid;
    while(i < mid && j <= right) {
        if(vec[i] <= vec[j])
            temp.pb(vec[i++]);
        else {
            temp.pb(vec[j++]);
            inv += mid - i;
        }
    }
    while(i < mid)
        temp.pb(vec[i++]);
    while(j <= right)
        temp.pb(vec[j++]);
    REP(i, left, right + 1)
        vec[i] = temp[i - left];
    return inv;
}

int mergeSort(int l, int r) {
    if(l >= r)
        return 0;
    int inv = 0;
    int m = (l + r)/2;
    inv += mergeSort(l, m);
    inv += mergeSort(m + 1, r);
    inv += merge(l, m + 1, r);
    return inv;
}

void solve() {
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
}

int32_t main() {
    FAST
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //int t; cin >> t; while(t--)
    {
        solve();
    }   
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{
    public static void Main()
    {
        int K = int.Parse(Console.ReadLine());
        String input = Console.ReadLine();
        if (input.Length<=K) { Console.WriteLine(input); }
        else { Console.WriteLine(input.Substring(0,K)+"..."); }
    }
}

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

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

	if (a*b % 2 == 0)
	{
		cout << "Even" << endl;
	}
	else
	{
		cout << "Odd" << endl;

	}
	return 0;
}

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

int get_distance(int N, int X, int Y, int i, int j){
    int normal = j - i;
    int skip1 = abs(j - Y) + abs(i - X) + 1;
    int skip2 = abs(j - X) + abs(i - Y) + 1;
    return min(normal, min(skip1, skip2));
}

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;

    vector<int> ans(N);

    for(int i=1; i<N; i++){
        for(int j=i+1; j<=N; j++){
            int d = get_distance(N, X, Y, i, j);
            ans.at(d)++;
        }
    }

    for(int i=1; i<N; i++){
        cout << ans.at(i) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Happy {
    class Program {
        static void exc (ref int a, ref int b) {
            int t = a;
            a = b;
            b = t;
        }
        static void Main (string[] args) {
            string[] uinp;
            List<string> uinps = new List<string>();
            int n, k;
            uinp = Console.ReadLine ().Split (new char[] { ' ' });
            n = int.Parse (uinp[0]);
            uinp = new string[n];
            for (int i = 0; i < n; i++) {
                uinps.Add(Console.ReadLine ());
            }
            uinps.Sort ();
            foreach (var item in uinps) {
                Console.Write (item);
            }
            Console.WriteLine ();
            //Console.ReadLine ();
        }
    }
}


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

ll N;
char S[256][256];
bool visited[256][256];

bool isin(ll y, ll x) { return 0 <= y && y < N && 0 <= x && x < N; }

void dfs(ll y, ll x) {
  ll dd[5] = { 0, 1, 0, -1, 0 };
  if(visited[y][x]) return;
  visited[y][x] = true;
  REP(i, 0, 4) if(isin(y + dd[i], x + dd[i + 1])) dfs(y + dd[i], x + dd[i + 1]);
}

int main(void) {
  cin >> N;
  REP(i, 0, N) REP(j, 0, N) cin >> S[i][j];

  REP(i, 0, N) REP(j, 0, N) visited[i][j] = S[i][j] == 'x';

  ll cnt = 0;
  REP(i, 0, N) REP(j, 0, N) {
    if(!visited[i][j]) {
      cnt++;
      dfs(i, j);
    }
  }
  cout << (cnt - 1) / 3 << endl;
}

Measured memory_bytes: 3132
def gs() STDIN.gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
 
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end


n,m = gsmi
pyis = Array.new(m) do |i|
	p,y = gsmi
	[p,y,i]
end

now = 0
j = 0
ss = []

pyis.sort.each do |pyi|
	if now == pyi[0]
		j += 1
	else
		now = pyi[0]
		j = 1
	end
	ss << [pyi[2],sprintf("%06d%06d", pyi[0], j)]
end

ss.sort.each{|s| puts s[1]}


Measured memory_bytes: 24448
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
  let w = read::<String>();
  let mut v = vec![0; (b'z' - b'a') as usize + 1];
  for c in w.bytes() {
    v[(c - b'a') as usize] += 1;
  }
  println!("{}", if v.iter().all(|&x| x % 2 == 0) {"Yes"} else {"No"});
}

Measured memory_bytes: 2108
n=int(input())
b=list(map(int,input().split()))+[100001]

a=[0]*n
a[0]=b[0]
bi1=b[0]

for i in range(1,n):
    bi=b[i]
    a[i]=min(bi,bi1)
    bi1=bi
s=sum(a)
print(s)

Measured memory_bytes: 3060
import java.util.Scanner;
class Main {
    public static void main(String[] args){
       Scanner scan = new Scanner(System.in);
       int x;
       int y;
       
       for(int i = 0;; i++){
         x = scan.nextInt();
         y = scan.nextInt();
         if(x == 0 && y == 0) {
            break;
         }else{
            if(x < y){
              System.out.println(x + " " + y);
            }else{
              System.out.println(y + " " + x);
            }
         }
       }
    }
}

Measured memory_bytes: 33868
#include <cstdio>

const int MaxN = 300 + 5;

int N;
int A[MaxN], Cnt[4];
double dp[MaxN][MaxN][MaxN];
bool vis[MaxN][MaxN][MaxN];

void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
  for (int i = 1; i <= N; ++i) Cnt[A[i]]++;
}

double dfs(int k, int i, int j) {
  if (vis[k][i][j] == true) return dp[k][i][j];
  vis[k][i][j] = true;
  if (i == 0 && j == 0 && k == 0) return dp[k][i][j] = 0;

  if (k != 0) dp[k][i][j] += dfs(k - 1, i, j + 1) * k / N;
  if (i != 0) dp[k][i][j] += dfs(k, i - 1, j) * i / N;
  if (j != 0) dp[k][i][j] += dfs(k, i + 1, j - 1) * j / N;
  dp[k][i][j]++;
  dp[k][i][j] /= 1.0 * (i + j + k) / N;
  return dp[k][i][j];
}

void solve() {
  for (int k = 0; k <= Cnt[3]; ++k)
    for (int i = 0; i <= N; ++i)
      for (int j = 0; j <= N; ++j)
        if (i + j + k <= N) dfs(k, i, j);
  printf("%.10lf\n", dp[Cnt[3]][Cnt[1]][Cnt[2]]);
}

int main() {
  init();
  solve();
  return 0;
}

Measured memory_bytes: 245888
#include<algorithm>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

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

template<typename T>
bool chmax(T& a, T b, bool equal = false){
    if(a < b || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b, bool equal = false){
    if(b < a || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;

    vector<int> cnt(3);
    rep(i, n){
        int a;
        cin >> a;
        ++cnt[a % 3];
    }

    // cout << cnt[0] << " " << cnt[1] << " " << cnt[2] << endl;

    int ans = 1;
    if(cnt[1] >= 2){
        if(cnt[2] == cnt[1] - 2){
            ans = n;
        }else if(cnt[2] < cnt[1] - 2){
            chmax(ans, 2 + cnt[2] * 2 + cnt[0] + 1);
        }else{
            chmax(ans, 2 + (cnt[1] - 2) * 2 + cnt[0] + min(2, cnt[2] - cnt[1] + 2));
        }
    }
    if(cnt[2] >= 1){
        if(cnt[2] - 1 == cnt[1]){
            ans = n;
        }else if(cnt[2] - 1 < cnt[1]){
            chmax(ans, 1 + (cnt[2] - 1) * 2 + cnt[0] + 1);
        }else{
            chmax(ans, 1 + cnt[1] * 2 + cnt[0] + min(2, cnt[2] - 1 - cnt[1]));
        }
    }
    if(cnt[1] == 1){
        chmax(ans, 1 + cnt[0]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const ll INF = 1e18;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    ll d[n][n];
    rep(i, 0, n) rep(j, 0, n) d[i][j] = INF;
    rep(i, 0, n) d[i][i] = 0;
    rep(i, 0, m) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    rep(k, 0, n) {
        rep(i, 0, n) {
            rep(j, 0, n) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    ll d2[n][n];
    rep(i, 0, n) rep(j, 0, n) d2[i][j] = INF;
    rep(i, 0, n) d2[i][i] = 0;
    rep(i, 0, n) {
        rep(j, 0, n) {
            if (d2[i][j] == 0) continue;
            if (d[i][j] <= l) d2[i][j] = 1;
        }
    }
    rep(k, 0, n) {
        rep(i, 0, n) {
            rep(j, 0, n) {
                d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
            }
        }
    }

    int q;
    cin >> q;
    int s[q], t[q];
    rep(i, 0, q) {
        cin >> s[i] >> t[i];
        s[i]--;
        t[i]--;
    }
    rep(i, 0, q) {
        if (d2[s[i]][t[i]] == INF) {
            cout << -1 << endl;
        } else {
            cout << d2[s[i]][t[i]] - 1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2688
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

int main(){
    long long N, P;
    
    cin >> N >> P;
    
    long long result = 1;
    
    if (N==1) result = P;
    else if (N>=48) result = 1;
    else {
        int i = 1;
        long long pow_num = 1;
        while (pow_num<=P) {
            if (P%pow_num==0) result = i;
            i += 1;
            pow_num = pow(i,N);
        }
    }
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 256
a,op,b=map(str,input().split())
while op!='?':
    a=int(a)
    b=int(b)
    if op=='+':
        print(a+b)
    if op=='-':
        print(a-b)
    if op=='*':
        print(a*b)
    if op=='/':
        print(a//b)
    a,op,b=map(str,input().split())


Measured memory_bytes: 5592
import sys

input = sys.stdin.readline
import bisect

INF = 10 ** 18
N = int(input())
A = [10 ** 10 - int(input()) for _ in range(N)]  # 逆順にしておく

# 最長単調減少列：狭義

dp = [INF] * (N + 1)  # 長さ、その長さの末端としてありうる最大値

for a in A:
    idx = bisect.bisect_right(dp, a)
    dp[idx] = a

answer = bisect.bisect_left(dp, INF)
print(answer)

Measured memory_bytes: 45148
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  printf("%d\n", a[n - 1] - a[0]);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265358979323846264338327950L
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n, x, y;
 	cin >> n;
 	set <pll> as;
 	for (ll i = 0; i < n; i++) {
 		cin >> x >> y;
 		as.insert({x, y});
 	}   
 	if (sz(as) == 1) {
 		cout << 0 << endl;
 		return 0;
 	}
 	vector <ll> vec1;
 	vector <ll> vec2;
 	for (auto it : as) {
 		vec1.pb(it.fi + it.se);
 		vec2.pb(it.fi - it.se);
 	}
 	n = sz(as);
 	sort(all(vec1));
 	sort(all(vec2));
 	ll ans1 = vec1[n - 1] - vec1[0];
 	ll ans2 = vec2[n - 1] - vec2[0];
 	cout << max(ans1, ans2) << endl;
	return 0;
}

Measured memory_bytes: 19208
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

#define LOCAL  1
#define UPLOAD 2

#define ll long long
const long long INF = 1LL << 60;

template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
 
int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  ll N = input();
  vector<int> V = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  output(V[N-1]);

  return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }



void func(long long N){

    N-=400;
    lli num = N/200;

    cout<<8-num<<endl;

}
int main(){
    // cout << fixed << setprecision(5);

    long long X;
    scanf("%lld",&X);
    func(X);
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

const int MAX = 3030;

ll P, A[MAX];

int pow_(ll n, ll k) {
    ll res = 1;
    while (k) {
        if (k&1) res = (res * n) % P;
        n = n * n % P;
        k >>= 1;
    }
    return res;
}

int inv(int n) {
    return pow_(n, P-2);
}

int comb(int n, int k) {
    ll ret = 1;
    FOR (l, 1, k+1) ret = ret * l % P;
    ret = inv(ret);
    FOR (l, n-k+1, n+1) ret = ret * l % P;
    return ret;
}

vi solve() {
    vi ret(P);
    REP (l, P) {
        ll res = 0;
        REP (i, P) res = (res + A[i] * pow_(i, P-l-1)) % P;
        ret[l] = P - comb(P-1, l) * pow_(P-1, P-l-1) % P * res % P;
        ret[0] += A[l];
    }
    return ret;
}

int main() {
    cin >> P;
    REP (i, P) cin >> A[i];
    FORE (b, solve()) cout << (b % P + P) % P << " ";
    cout << endl;
}

Measured memory_bytes: 256
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)*/

#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <bitset>  // std::bitset<N>
#include <sstream> //stringstream
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
//ここから書き始める

int main(){
  int n ; cin >> n;
  vector<double> a(n);
  rep(i,n){
    cin>>a[i];
  }
  SORT(a);
  double ans = 0;
  rep(i,n-1){
    a[i+1]=(a[i]+a[i+1])/2.0;
  }
  ans = a[n-1];
  cout <<ans<<endl;
}


Measured memory_bytes: 256
A, B, m = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ", A).map(&:to_i)
b = gets.chomp.split(" ", B).map(&:to_i)
c = Array.new(m)
m.times do |i|
  c[i] = gets.chomp.split(" ").map(&:to_i)
end

min = a.min + b.min
m.times do |i|
  if min > a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
    min = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
  end
end

print "#{min}\n"

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

int main() {
int x;
cin >> x;
if(x==7 || x==5 || x== 3) cout << "YES" << endl;
else cout << "NO" << endl;
}
  


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    int a,b,x;
    cin>>a>>b>>x;
    string ans ="NO";
    if(a<=x&&a+b>=x)ans="YES";
    cout<<ans<<endl;
    
    return 0;
}

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

int main(){
  	int n,k,ans=0;
  	cin>>n>>k;
  	vector<int>d(n);
  	for(int i=0;i<n;i++){
      	cin>>d.at(i);
    }
  sort(d.begin(),d.end());
  reverse(d.begin(),d.end());
  for(int i=0;i<k;i++){
    	ans+=d.at(i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            //// 文字列の入力
            //string s = Console.ReadLine();

            //// 整数の入力
            //long n = long.Parse(Console.ReadLine());

            //// 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            //// 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long n = long.Parse(Console.ReadLine());

            var datas = new List<long>();

            datas.Add(2);
            datas.Add(1);

            for (int i = 2; i <= n; ++i) {
                var a = datas[i - 2];
                var b = datas[i - 1];

                datas.Add(a + b);
            }

            long answer = datas[(int)n];

            Console.WriteLine(answer.ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11220
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    long long N;
    vector<long long> a;
    long long ans=0;

    cin >> N;
    rep(i,N){
        long long x;
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());

    for(long long i=0; i<N;){
        long long temp=a[i];
        long long num=0;
        while (temp==a[i] && i<N){
            i++;
            num++;
        }
        if(num%2) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1400
import math

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

def honya(n, L):
  k = 0
  E = len(L)
  for i in range(n - 1, -1, -1):
    for j in range(k, E):
      if (L[j] >> i) & 1:
        L[k], L[j] = L[j], L[k]
        break
    else:
      continue
    k += 1
    for j in range(k, E):
      if (L[j] >> i) & 1:
        L[j] ^= L[k - 1]
  return L

def nasu(n):
  return math.ceil(math.log(n + 1, 2))

A.sort(reverse = True)
M = nasu(A[0])
P = [1]
for i in range(M):
  P.append(P[-1] * 2)

D = [0] * M
for i in range(N):
  t = A[i]
  for j in range(M):
    if t & 1:
      D[j] += 1
    t >>= 1

ans = 0
for i in range(M - 1, -1, -1):
  if D[i] % 2 == 1:
    ans += P[i]
    for j in range(N):
      A[j] &= ~(1 << i)

L = honya(M, A)
t = 0
for i in range(N):
  if L[i] == 0: break
  if (t & (1 << (nasu(L[i]) - 1))) == 0:
    t ^= L[i]

for i in  range(M - 1, -1, -1):
  if (t >> i) & 1:
    ans += P[i] * 2
    
print(ans)


Measured memory_bytes: 76832
n = int(input())
train = [list(map(int, input().split())) for _ in range(n - 1)]

for i in range(n):
    cost = 0
    for j in range(i, n - 1):
        c, s, f = train[j]
        if cost >= s:
            cost += (s - cost) % f + c
        else:
            cost = c + s
    print(cost)

Measured memory_bytes: 3188
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[3 * n];

		for (int i = 0; i < 3 * n; i++) {
			a[i] = sc.nextInt();
		}

		Arrays.sort(a);

		long sum = 0;
		for (int i = 3 * n - 2; n <= i; i -= 2) {
			sum += a[i];
		}

		System.out.println(sum);

		sc.close();
	}

}


Measured memory_bytes: 61852
import fractions

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

A,B = map(int,input().split())
gcd = fractions.gcd(A,B)
tgt = factorization(gcd)
if tgt == [[1,1]]:
    print(1)
    exit()
print(len(tgt)+1)


Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, i;
    cin >> N;
  
    if(N == 1){
      cout << 1 << endl;
    }else{
      for (i = 1; i <= N; i++){
        if (N < i * i){
          cout << (i - 1) * (i - 1) << endl;
          break;
        }
      }
    }
}

Measured memory_bytes: 256
a = [0 for i in range(101)]
while True:
  try:
    n = int(input())
    a[n] += 1
  except EOFError:
    break

m = 0
for i in range(1, 101):
  m = max(m, a[i])
for i in range(1, 101):
  if a[i] == m:
    print(i)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);

int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

}




Measured memory_bytes: 256
/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = 1000000007;
const ll nmax=1000003;
#define int ll
int n, a[100010], eq[100010], l[100010], ans;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n;
    for(int i=1; i<=n; i++){
		cin>>a[i];
		if(a[i]==a[i-1]) eq[i]=eq[i-1]+1;
		else eq[i]=0;
	}
	for(int i=1; i<=n; i++){
		if(i>1 && a[i]<=a[i-1]) l[i]=l[i-1]+1;
		else l[i]=eq[i];
		ans=max(l[i], ans);
	}
	//for(int i=1; i<=n; i++) cout<<l[i]<<" "; cout<<endl;
	cout<<ans;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  
  if(m<=n)
    cout << 0 << endl;
  
  else{
    vector<int> x(m);
    for(int i=0;i<m;i++)
      cin >> x.at(i);
    sort(x.begin(),x.end());
    vector<int> y(m-1);
    for(int i=0;i<m-1;i++)
      y.at(i)=x.at(i+1)-x.at(i);
    sort(y.begin(),y.end());
    
    int k=0;
    for(int i=0;i<m-n;i++)
      k+=y.at(i);
    
    cout << k << endl;
    
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main(){
  for(;;){
    int n,m,a;
    scanf("%d %d %d",&n,&m,&a);
    if(!(n+m+a)) break;

    int adj[1001][101]={{0}};
    int hmax=0;
    rep(i,m){
      int h,p,q;
      scanf("%d %d %d",&h,&p,&q);
      adj[h][p]=q;
      adj[h][q]=p;
      if(hmax<h)
	hmax=h;
    }

    int now=a;
    
    for(int i=hmax;i>=0;i--)
      if(adj[i][now]){
	now=adj[i][now];
      }

    printf("%d\n",now);
  }
}

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

int main (void) {
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n)
    cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  int alice = 0, bob = 0;
  bool alice_turn = true;
  REP(i, n) {
    if (alice_turn)
      alice += a[i];
    else
      bob += a[i];
    alice_turn = !alice_turn;
  }
  cout << alice - bob << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools as it
H, W, K = map(int, input().split())
A = []
for i in range (0, H):
	A.append(list(map(str, input().split())))


Hbit = list(it.product([0,1], repeat = H))
Wbit = list(it.product([0,1], repeat = W))

count = 0
shouldbeK = 0 

for i in range (0, 2**H):
	for j in range (0, 2**W):
		shouldbeK = 0
		for k in range (0, H):
			for l in range (0, W):
				if Wbit[j][l] == 0 and Hbit[i][k] == 0 and str(A[k])[l+2] == '#':
					shouldbeK+=1
		if  shouldbeK == K:
			count+=1
        
print(count)

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

bool isPalindrome(std::string s) {
  bool ret = true;
  int size = (int)s.size();
  for (int i = 0; ret && i < size / 2; i++) {
    if (s[i] != s[size - 1 - i ]) ret = false;
  }
  return ret;
}

void funcB() {
  std::string s;
  std::cin >> s;
  int n = s.size();
  std::cout << (isPalindrome(s) && isPalindrome(s.substr(0, (n - 1) / 2)) && isPalindrome(s.substr((n + 3) / 2 - 1, n - (n + 3) / 2 + 1)) ? "Yes" : "No");
}

int main(void) {
  funcB();
  return 0;
}

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

int main(void){
  string str;
  cin >> str;
  int num1,num2;
  num1 = (str[0] - '0') * 10 + str[1] - '0';
  num2 = (str[2] - '0') * 10 + str[3] - '0';
  if(1 <= num1 && num1 <= 12){
    if(1 <= num2 && num2 <= 12)cout << "AMBIGUOUS" << endl;
    else cout << "MMYY" << endl;
  }
  else{
    if(1 <= num2 && num2 <= 12)cout << "YYMM" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 256