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

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    while( true ){

        int m, t, p, r;
        cin >> m >> t >> p >> r;
        if(m == 0 && t == 0 && p == 0 && r == 0)
            break;

        vector<int> correct(t, 0);
        vector<int> time(t, 0);
        vector<vector<int>> incorrect(t, vector<int>(p, 0));

        for(int i = 0; i < r; i++){

            int mi, ti, pi, ji;
            cin >> mi >> ti >> pi >> ji;

            if(ji == 0){
                correct[ti - 1] += 1;
                time[ti - 1] += incorrect[ti - 1][pi - 1] * 20 + mi;
            } else {
                incorrect[ti - 1][pi - 1]++;
            }

        }

        vector<vector<int>> bucket(p + 1, vector<int>(0));

        for(int i = 0; i < t; i++)
            bucket[correct[i]].push_back(i);
/*
        for(auto &x : bucket){
            for(auto &z : x)
                cout << z << ' ';
            cout << endl;
        }
*/
        int count = 0;
        for(int i = bucket.size() - 1; i >= 0; i--) {
            if(bucket[i].size() == 1)
                cout << bucket[i][0] + 1 << ( ++count != t ? "," : "");
            if(bucket[i].size() > 1){
                vector<pair<int, int>> p(bucket[i].size());
                for(int j = 0; j < bucket[i].size(); j++){
                    p[j] = make_pair(time[bucket[i][j]], bucket[i][j]);
                }
                sort(p.begin(), p.end());
                stack<int> st;
                for(int j = 0; j < bucket[i].size(); j++){
                    if(j != bucket[i].size() - 1){
                        if(p[j].first == p[j+1].first) {
                            st.push(p[j].second);
                        } else {
                            if (!st.empty()) {
                                st.push(p[j].second);
                                while(!st.empty()) {
                                    cout << st.top() + 1 << ( ++count != t ? (st.size() != 1 ? "=" : ",") : "");
                                    st.pop();
                                }
                            } else
                                cout << p[j].second + 1 << ( ++count != t ? "," : "");
                        }
                    } else {
                        if (!st.empty()) {
                            st.push(p[j].second);
                            while(!st.empty()) {
                                cout << st.top() + 1 << ( ++count != t ? (st.size() != 1 ? "=" : ",") : "");
                                st.pop();
                            }
                        } else
                            cout << p[j].second + 1 << ( ++count != t ? "," : "");
                    }
                }
            }
        }
        cout << endl;

    }

    return 0;

}


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

using namespace std;

#define intt long long 
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 105;

bool check (int n) {
	return (n >= 1 && n <= 12);
}

int main() {

	FAST;

	string s;
	cin >> s;
	int a = (s[0] - '0') * 10 + s[1] - '0';
	int b = (s[2] - '0') * 10 + s[3] - '0';
	if (check(a) && check(b)) {
		cout << "AMBIGUOUS\n";
	}
	else if (check(a)) {
		cout << "MMYY\n";
	}
	else if (check(b)) {
		cout << "YYMM\n";
	}
	else {
		cout << "NA\n";
	}
	return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
    a: usize,
    b: usize,
    t: usize
    }
    let ans = t / a * b;
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Set<String> A = new HashSet<String>();
    for (int i=0; i<N; i++) {
      A.add(sc.next());
    }
    
    System.out.println(A.size());
  }
}  

Measured memory_bytes: 78076
#define INF 10000000000
#define MOD 1000000007

#if 1   // use_templates

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))


ll gcd(ll a, ll b);

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

#endif  // end of use_templates


int main()
{
    ll a;
    cin >> a;
    cout << ((a + 1) * a + 1) * a << endl;
    return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int a, b; cin >> a >> b;
	for(int i = 1; i <= 3; ++i) {
		if(i != a) {
			if(i != b) {
				cout << i << '\n';
			}
		}
	}
	return 0;
}

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

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
int a[300000];
signed main(){
    int n;
    cin >> n;
    int now = 1;
    int ans = 0;
    REP(i,n){
        cin >> a[i];
        if(a[i]==now){
            now ++;
        }
        else{
            ans ++;
        }
    }
    if(now==1){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	ll x;
	cin >> x;
	ll sum = 0;
	int i;
	for (i = 1; i <= x; i++) {
		sum += i;
		if (sum>=x) {
			break;
		}
	}
	cout << i << endl;

}


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

#define N 100010
int n, m;
vector<int> g[N];
int rt[N];

int findrt(int x) {
	return rt[x] = (rt[x] == x ? x:findrt(rt[x]));
}

int deg[N];

void link(int a, int b) {
	cout<<a<<' '<<b<<'\n';
	deg[a] ^= 1;
}

void dfs(int u, int pa) {
	for (int v:g[u]) if (v != pa) {
		dfs(v, u);
		if (deg[v]) link(v, u);
		else link(u, v);
	}
}

int main() {
//35b
	cin>>n>>m;
	if (m & 1) {
		cout<<-1;
		return 0;
	}
	for (int i = 1; i <= n; i ++) rt[i] = i;
	while (m --) {
		int a, b;
		cin>>a>>b;
		int x = findrt(a), y = findrt(b);
		if (x == y) link(a, b);
		else {
			g[a].push_back(b);
			g[b].push_back(a);
			rt[x] = y;
		}
	}
	dfs(1, 1);
}

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

using namespace std;

int main() {
    int n, q;
    string s;
    cin >> n >> q >> s;

    vector<int> ac(n, 0);
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == 'A' && s[i] == 'C') {
            ac[i] = ac[i - 1] + 1;
        } else {
            ac[i] = ac[i - 1];
        }
    }

    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        cout << ac[r - 1] - ac[l - 1] << endl;
    }
}


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

int main() {
  int N, sum = 0;
  cin >> N;
  int n = N;

  while (N > 0) { 
    sum += N % 10;
    N /= 10;
  }

  if(n % sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 384
#include <stdio.h>
int main (){
int i,b=0,r=0,a;
char s[101];
scanf ("%d",&a);
scanf ("%s",s);
for (i=0;s[i]!=0;i++){
if (s[i]=='B'){
b++;
}
if (s[i]=='R'){
r++;
}
}
if (r>b){
printf ("Yes");
}
  else {
  printf ("No");
  }
return 0;
}

Measured memory_bytes: 128
import sys
N=int(input())
S=[]
for i in range(N):
  S+=[int(input())] 
S.sort()

ans=0
for i in range(N):
  ans+=S[i]
if ans%10!=0:
  print(ans)
  sys.exit
else:
  for i in range(N):
    if S[i]%10!=0:
      print(ans-S[i])
      sys.exit()
  print(0)


Measured memory_bytes: 3060
N = int(input())
A = [0 for k in range(int(N**0.5)+1)]

#N=1の処理
if N == 1:
  print(0)
  exit()
ans = 0


prime = [2]
for k in range(3, len(A), 2):
  if A[k] == 0:
    prime.append(k)
    for j in range(k, len(A), k):
      A[j] = 1
for p in prime:
  if N%p == 0:
    break
else: 
  print(1)
  exit()

use = []
for p in prime:
  if p > N:
    break
  if N%p == 0:
    ans += 1
    use.append(p)
    N = N // p
  np = p * p
  while N % np == 0:
    ans += 1
    N = N // np
    np = np * p
    
for u in use:
  while N % u == 0:
    N = N // u
if N > 1:
  ans += 1
print(ans) 

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

long long N, L, A[9009];
double x[9009], y[9009];
double rx[9009], ry[9009];

double SIN(double I) {
	return sin(3.141592653589793238 * 2.0 * I);
}

double COS(double I) {
	return cos(3.141592653589793238 * 2.0 * I);
}

int main() {
	cin >> N >> L;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		x[i] = COS(1.0 * A[i] / L);
		y[i] = SIN(1.0 * A[i] / L);
		rx[i + 1] = rx[i] + COS(0.5 * A[i] / L);
		ry[i + 1] = ry[i] + SIN(0.5 * A[i] / L);
	}
	for (int i = N; i < 3 * N; i++) {
		A[i] = A[i - N] + L;
		rx[i + 1] = rx[i] + COS(0.5 * A[i] / L);
		ry[i + 1] = ry[i] + SIN(0.5 * A[i] / L);
	}

	double ex = 0, ey = 0;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j) continue;
			int s1 = j, s2 = i; if (j > i) s2 += N;
			if (s2 - s1 == 1) continue;

			// ① 最初の座標を求める
			double sx = rx[s2] - rx[s1 + 1]; sx /= (1.0 * (s2 - s1 - 1));
			double sy = ry[s2] - ry[s1 + 1]; sy /= (1.0 * (s2 - s1 - 1));

			// 回転座標を求める
			double ave = (A[s1] + A[s2]) / (2.0 * L);
			ave -= 0.50;

			// ② 座標を回転させる
			double COS1 = COS(0.25 + ave / 2.0);
			double SIN1 = SIN(0.25 + ave / 2.0);
			double tx = COS1 * sx - SIN1 * sy;
			double ty = SIN1 * sx + COS1 * sy;

			// ③ 座標を平行移動させる
			double lx = COS(ave);
			double ly = SIN(ave);
			double vx = tx + lx;
			double vy = ty + ly;

			// ④ 座標を拡大させる
			double bairitsu = sqrtl((lx - x[i]) * (lx - x[i]) + (ly - y[i]) * (ly - y[i]));
			double ax = lx + (vx - lx) * bairitsu;
			double ay = ly + (vy - ly) * bairitsu;
			ex += ax * (1.0L * (s2 - s1 - 1));
			ey += ay * (1.0L * (s2 - s1 - 1));
		}
	}

	double Total = 0.5L * N * (1.0L * N - 1.0L) * (1.0L * N - 2.0L);
	printf("%.12lf %.12lf\n", ex / Total, ey / Total);
	return 0;
}

Measured memory_bytes: 512
H,W=gets.split.map(&:to_i)
a=[]
H.times do 
    a << gets.chomp
end

b = false
x,y=0,0
loop do
    if a[y][x] == '#'
        a[y][x] = '.'
        if y == H-1 && x == W-1 && !a.join.include?('#')
            b = true
            break
        end
        if a[y+1] && a[y+1][x] == '#'
            y += 1
        elsif a[y][x+1] == '#'
            x += 1
        else
            b = false
            break
        end

    else
        b = false
        break
    end
end


puts (b ? 'Possible' : 'Impossible')

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

int main()
{
    long long int n,mx=-1,mn=101,ans=10000000;
    cin>>n;
    long long int a[n];
    for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
    long long int sum=0;
    for(int j=1;j<101;j++)
    {
        sum=0;
        for(int i=0;i<n;i++)
          sum+=(j-a[i])*(j-a[i]);
        ans=min(ans,sum);
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true) {

		    String str = br.readLine();
		    StringTokenizer st = new StringTokenizer(str, " ");
			int a  = Integer.parseInt(st.nextToken());
			int b  = Integer.parseInt(st.nextToken());

			if(a == 0 && b == 0){
				break;
			}else if (a < b) {
				System.out.println(a + " " +  b);
			}else {
				System.out.println(b + " " +  a);
			}
		}
	}
}

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

int main() {
    vector<int> a(3, 0);
    for (int i=0; i<3; i++)
        cin >>a.at(i);
    sort(a.begin(), a.end());
    cout <<a.at(0) <<' ' <<a.at(1) <<' ' <<a.at(2) <<endl;
    return 0;
}



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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999

#define lint long long


int main()
{
  int n; cin>>n;
  lint h[n];
  REP(i,n){
   cin>>h[i]; 
  }
  vector<lint> memo(n,0);
  memo[n-1] = 0;
  for(int i = n-1; i >=1; --i){
    if(h[i]>h[i-1]){
      memo[i-1] = 0;
    }else{
      memo[i-1] = memo[i]+1; 
    }
  }
  sort(ALL(memo));
  cout << memo[n-1] << "\n";
  return 0;
}




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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    int num = s[i]+n;
    if(num>90) num -= 26;
    cout << (char)num;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
rank (m:e:j:_) 
  | (m==100) || (e==100) || (j==100) = 'A'
  | m+e >= 180                 = 'A'
  | m+e+j >= 240               = 'A'
  | m+e+j >= 210               = 'B'
  |(m+e+j >= 150) &&((m>=80) || (e>=80)) = 'B'
  | otherwise                  = 'C'

ans ([0]:_) = []
ans (n:x) =
  let n'= (n!!0)
      o = map rank $ take n' x
      x'= drop n' x
  in
    o++(ans x')

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ putStrLn $ map (\c->[c]) o

Measured memory_bytes: 4536
#include <iostream>
#include<algorithm>
#include<string>
 
using namespace std;
int n,a,b;
int ze(int a,int b){if(a-b<0)return b-a;else return a-b;}
int main (){
cin>>n>>a>>b;if(ze(n,a)<ze(n,b))cout<<'A'<<endl;else cout<<'B'<<endl;
 
return 0;
}

Measured memory_bytes: 256
/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll ttt;cin>>ttt;while(ttt--)
long long int i,j;
using namespace std;

int main()
{
    double a, k,lol;
    cin>>a>>k;int sum=0;
    for(i=0;i<a;i++)
    {
        double x,y;cin>>x>>y;
        lol=sqrt(x*x+y*y);
        if(lol<=k)sum++;

    }
    cout<<sum<<endl;

}
// Alhamdulillah


Measured memory_bytes: 3836
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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



int main() {
	int n;
	cin >> n;
	VI v(n);
	VI c(n);
	REP(i, n) {
		cin >> v[i];
	}
	REP(i, n) {
		cin >> c[i];
	}
	int ans = 0;
	REP(i, n) {
		if (v[i] > c[i]) {
			ans += v[i] - c[i];
		}
	}

	ANS(ans);


	return 0;
}


Measured memory_bytes: 256
while True:

    n = int(input())
    if n == 0:
        break

    ans = 0
    min_bmi = 100000.0
    for l in range(n):
        p,hh,ww = [int(i) for i in input().split()]
        h = float(hh)
        w = float(ww)
        h = h * 0.01

        bmi = abs(w / (h*h) - 22.0)

        if bmi < min_bmi:
            min_bmi = bmi
            ans = p

    print(ans)



Measured memory_bytes: 5636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i){
    cin >> A[i];
    A[i] -= i+1;
  }
  sort(A.begin(), A.end());
  int b = A[N/2];
  ll ans = 0;
  for(int i = 0; i < N; ++i){
    ans += abs(b-A[i]);
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define pr pair<int,int>
	#define FR first
	#define SE second
	#define MP make_pair
	#define PB push_back
	#define vc vector
	#define mid (l+r)/2
	#define lc 2*x
	#define rc 2*x+1
	void chmax(int &x,const ll y) {x=(x>y?x:y);}
	void chmin(int &x,const ll y) {x=(x<y?x:y);}
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) putchar('-'),num=-num;
		if(num>=10) write(num/10);
		putchar('0'+num%10);
	}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	const int INF=0x3f3f3f3f;
	const int MOD=19491001;
	void add(ll &a,ll b){a+=b;if(a>=MOD)a-=MOD;if(a<=-MOD)a+=MOD;}
	ll qpower(ll x,ll e)
	{
		ll ans=1;
		while(e)
		{
			if(e&1) ans=ans*x%MOD;
			x=x*x%MOD;e>>=1;
		}
		return ans;
	}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=1e5+10;

	char str[N];
	int a[N],len[N],pos[N],ed[N];
    void main()
	{
		scanf("%s",str+1);int n=strlen(str+1);
		int cnt=1;len[1]=1;pos[1]=1;ed[0]=0;
		for(int i=2;i<=n;i++) {if(str[i-1]==str[i]) len[cnt]++; else ed[cnt]=i-1,len[++cnt]=1;pos[i]=cnt;}
		ed[cnt]=n;
		for(int i=1;i<=n;i++)
		{
			int pp=pos[i];
			if(pp&1)//right
			{
				int nd=ed[pp]-i;
				if(nd&1) a[ed[pp]+1]++;
				else a[ed[pp]]++;
			}
			else
			{
				int nd=i-ed[pp-1]+1;
				if(nd&1) a[ed[pp-1]]++;
				else a[ed[pp-1]+1]++;
			}
		}
		for(int i=1;i<=n;i++) write1(a[i]);
	}
};
int main()
{
	srand(time(0));
	mine::main();
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <set>
#include <cmath>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
int debu(string a)
{
	cout<<a<<endl;
}
int debu()
{
	cout<<"ok"<<endl;
}
int debu(int a)
{
	cout<<a<<endl;
}



set<int> a;
int main()
{
	int n;
	cin>>n;
	rep(i,n)
	{
		int h,m;
		cin>>h>>m;
		a.insert(h*60+m);
	}
	cin>>n;
	rep(i,n)
	{
		int h,m;
		cin>>h>>m;
		a.insert(h*60+m);
	}
	int hoge=a.size();
	for(int i=0;i<hoge;i++)
	{
		int q=*a.begin();
		a.erase(a.begin());
		int h=q/60;
		q%=60;
		int m=q;
		cout<<h<<":";
		if(m<=9)
		{
			cout<<"0";
		}
		cout<<m;
		if(i!=hoge-1)
		{
			cout<<" ";
		}
	}
	cout<<endl;
}

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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

bool isprime[1000000];

int main(){
  REP(i, 1000000) isprime[i] = true;
  REP(i, 1000000){
    if(i == 0 or i == 1) continue;
    REP(j, 1000000){
      if(j == 0 or j == 1) continue;
      if(i * j >= 1000000) break;
      isprime[i * j] = false;
    }
  }
  isprime[0] = isprime[1] = false;
  int a, d, n;
  while(cin >> a >> d >> n and a + d + n){
    REP(i, 1000000){
      if(isprime[a + i * d]) n--;
      if(n == 0) { cout << a + i * d << endl; break; }
    }
  }
  return 0;
}

Measured memory_bytes: 4068
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

ll t[20010];
int main(){
	ll n;
	while(scanf("%lld",&n),n){
		rep(i,0,2*n){
			ll a,b,c;
			scanf("%lld:%lld:%lld",&a,&b,&c);
			t[i]=(a*3600+b*60+c)*2+1-i%2;
		}
		sortup(t,2*n);
		ll ans=0,crr=0;
		rep(i,0,2*n){
			if(t[i]%2)crr++;
			else crr--;
			ans=max(ans,crr);
		}
		printf("%lld\n",ans);
	}
}


Measured memory_bytes: 2032
'use strict'

const main = (input) => {
    const N = input.split('\n')[0]
    let flag = false
    N.split('').forEach(v => {
        if(v === '9'){
            flag = true
        }
    })
    if(flag){
        console.log('Yes')
    }else{
        console.log('No')
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

#define EPS (1e-7)
#define INF (1<<25)
#define PI (acos(-1))

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

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; }

using ll = long long;

ll x[100001], v[100001];

ll rmax1[1000001], rmax2[10000001];
ll lmax1[1000001], lmax2[10000001];

int main() {
  int n; ll c; cin >> n >> c;
  REP(i,n) cin >> x[i] >> v[i];

  ll vsum = 0;
  REP(i,n) {
    vsum += v[i];
    rmax1[i+1] = max(rmax1[i], vsum - x[i]);
    rmax2[i+1] = max(rmax2[i], vsum - 2*x[i]);
  }
  vsum = 0;
  REP(i,n) {
    vsum += v[n-1-i];
    lmax1[i+1] = max(lmax1[i], vsum - c + x[n-1-i]);
    lmax2[i+1] = max(lmax2[i], vsum - 2*c + 2*x[n-1-i]);
  }
  ll ans = 0;
  REP(i,n+1) {
    chmax(ans, rmax1[i] + lmax2[n-i]);
    chmax(ans, lmax1[i] + rmax2[n-i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12800
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        if(a>c){
          int w = a;
          a = c;
          c = w;
          w = b;
          b = d;
          d = w;
        }
        if(b < c){
            System.out.println(0);
        }
        else if(b>d){
            System.out.println(d-c);
        }else{
            System.out.println(b-c);
        }
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int a,b;
  cin>>a>>b;
  cout<<a*b-a-b+1<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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

int main()
{
    int a, b, k;
    int i;
    cin >> a >> b >> k;
    for (i = 0; i < k; i++) {
        if (i % 2 == 0) {
            if (a % 2)
                a--;
            b += a / 2;
            a /= 2;
        }
        else {
            if (b % 2)
                b--;
            a += b / 2;
            b /= 2;
        }
    }
    cout << a << ' ' << b << endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
//double pi=3.1415926535898;
//double pi=acos(-1.0);
#define scarr(a,s,e) for(int i=s;i<=int(e);i++) scanf("%d ",&a[i]);
#define prarr(a,s,e) for(int i=s;i<=int(e);i++) printf("%d ",a[i]);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define mkp        make_pair
#define fr         first
#define se         second
#define sc(x)      scanf("%d",&x)
#define pr(x)      printf("%d ",x)
#define scl(x)     scanf("%lld",&x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define r0         return 0;
#define CC         continue;
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x);
#define bb(x)      cerr<< x <<endl;
#define ii         pair<int,int>
//#define max(a,b) a<b?b:a
//#define min(a,b) a<b?a:b
const ll M   = 1e7+9 ;
const ll inf = 1e19  ;
const int si = 1e5+9 ;
//////////////////////    Hi    ^_^  hack me if you can :P

int main()
{
    int a,b,h;
    cin>>a>>b>>h;
    cout<<(a+b)*h/2;
    r0;
}



/*

ll pwmod(ll a, ll n, ll mod) {
    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

*/
/*
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);
for (int i=0;i<n;i++)            Hi    ^_^  hack me if you can :P
int mx[]= {0,0,1,1,1,-1,-1,-1};
int my[]= {1,-1,0,1,-1,0,1,-1};
bool inside (int i,int j) {return (i>=0 && i<n && j>=0 && j<m);}
*/


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d %d', $cnt, $def, $solve);
$points = array_fill(1, $cnt, $def-$solve);
for ($i=0; $i < $solve; $i++) { 
    fscanf(STDIN, '%d', $idx);
    $points[$idx]++;
}
$len = count($points);
for ($i=1; $i <= $len; $i++) { 
    if ($points[$i] > 0) {
        echo "Yes\n";
    } else {
        echo "No\n";
    }
}

Measured memory_bytes: 9080
#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 pll=pair<ll,ll>;
using tll=tuple<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 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;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int clz(int x) { return 31 - __builtin_clz(x); }
int clz(ll x) { return 63 - __builtin_clzll(x); }
int ctz(int x) { return __builtin_ctz(x); }
int ctz(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

ll dp[2][100020];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	int t;
	cin>>n>>k;
	vl a(n);
	rep(i,n)cin>>a[i];
	bool pn=false;
	rep(i,k+1)dp[0][i]=1;
	rep(i,n){
		pn=!pn;
		rrep(j,k+1){
			t=min(j+a[i]+1,k+1);
			dp[pn][j]=dp[pn][j+1]+(dp[!pn][j]-dp[!pn][t]+MOD)%MOD;
			dp[pn][j]%=MOD;
		}
	}
	cout<<(dp[pn][0]-dp[pn][1]+MOD)%MOD<<endl;
}

Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class DPowerfulDiscountTickets {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n,m;
        in >> n >> m;
        priority_queue<int> a;
        rep(i,n){
            int t;
            in >> t;
            a.push(t);
        }
        rep(i,m){
            int t=a.top();
            a.pop();
            a.push(t/2);
        }
        ll ans=0L;
        while(!a.empty()){
            ans+=(ll)a.top();
            a.pop();
        }
        out <<ans<<endl;
	}
};


int main() {
	DPowerfulDiscountTickets solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 892
n, m = map(int, input().split())
mod = 10**9+7
ans = [1,1]
for i in range(2,100001):
  ans.append((ans[i-1]+ans[i-2])%mod)
num = 1
s = 0
for i in range(m):
  e = int(input())
  if e-1 < s:
    print(0)
    exit(0)
  num*=ans[e-1-s]
  num%=mod
  s = e+1
num*=ans[n-s]
print(num%mod)

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

void main_()
{
    string X;
    cin >> X;

    ll tc = 0;  // Tの出現数
    ll sc = 0;  // Sの出現数
    ll sc1 = 0; // Sの余剰出現数(後に対応するTで削除されるS)
    ll tc1 = 0; // Tの削除数
    for (auto ch : X) {
        if (ch == 'S') {
            sc++;
            sc1++;
        }
        if (ch == 'T') {
            tc++;
            if (sc1 > 0) {
                tc1++;
                sc1--;
            }
        }
        if (tc == (ll)X.size()/2) {
            break;
        }
    }

    cout << (tc - tc1) * 2 << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int gcnt = 0, pcnt = 0, ans = 0;
    
    rep(i, s.length()) {
        if (gcnt > pcnt) {
            pcnt++;
            
            if (s[i] == 'g') {
                ans++;
            }
        }
        else {
            gcnt++;
            
            if (s[i] == 'p') {
                ans--;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.util.Scanner;
public class Main {
    public static void main(String[] defargs) {
		Scanner scanner = new Scanner(System.in);
		int C,integer;
		C = 1;
		while(true) {
			integer = scanner.nextInt();
			if(integer == 0)
			break;
			System.out.println("Case " + (C++) + ": " + integer);
		}
	}
}


Measured memory_bytes: 42736
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	int h[100000];
	cin>>n;
	for(int i=0; i<n; i++) cin>>h[i];
	int dp[100000];
	dp[0]=0;
	dp[1]=abs(h[0]-h[1]);
	for(int i=2; i<n; i++){
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

int main()
{
    string i, j, k;
    
    cin >> i >> j >> k;
    
    cout << i[0] << j[1] << k[2] << endl;
    
    return 0;
}

Measured memory_bytes: 768
from collections import deque
N, D, A = map(int, input().split())
monster = []
for k in range(N):
  monster.append(list(map(int, input().split())))
monster.sort(key = lambda x: x[0])
for k in range(N):
  monster[k][1] = int((monster[k][1]-0.1)//A + 1)
ans = 0
monster = deque(monster)
final = monster[-1][0]
ruiseki = 0
minuslist = deque()

while len(monster) > 0:
  while len(minuslist) > 0:
    if monster[0][0] >= minuslist[0][0]:
      ruiseki -= minuslist[0][1]
      minuslist.popleft()
    else:
      break
  if ruiseki < monster[0][1]:
    ans += monster[0][1] - ruiseki
    if monster[0][0] + 2*D +1 <= final:
      minuslist.append([monster[0][0]+2*D+1, monster[0][1] - ruiseki])
    ruiseki = monster[0][1]
  monster.popleft()

print(ans)

Measured memory_bytes: 49160
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

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

void solve(ll N) {
  if (N % 1000)
    cout << 1000 - (N % 1000) << endl;
  else
    cout << 0 << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  solve(N);

  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
	int a,b;
	int d,r;
	double f;
	
	cin>>a>>b;
	
	d=a/b;
	r=a%b;
	f=(double)a/b;
	cout <<d<<" "<<r<<" "<<fixed<<f<<endl;
    
    return 0;
}

Measured memory_bytes: 1244
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
//MAX

int main() {

	int N, Y;
	bool check = false;

	cin >> N >> Y;

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N - i; j++) {

			if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y) {

				check = true;
				cout << i << SPACE << j << SPACE << N - i - j << endl;
				goto qwe;

			}

		}
	}
qwe:
	if (!check)cout << "-1 -1 -1" << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := readInt()

	ans := 1
	t := readInt()
	for i := 0; i < n-1; i++ {
		p := readInt()
		if p < t {
			t = p
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n, ma;
	double h;
	cin >> n >> h;
	vector<double>a(n), b(n);
	double amax = 0, bmax = 0;
	ll count = 0;
	REP(i, n) {
		cin >> a[i] >> b[i];
		if (amax < a[i]) {
			amax = a[i];
			ma = i;
		}
	}
	sort(b.begin(), b.end());
	reverse(b.begin(), b.end());
	REP(i, n) {
		if (b[i] > amax) {
			h -= b[i];
			count++;
		}
		if (h <= 0) {
			cout << count << endl;
			return 0;
		}
	}
	count += ceil(h / amax);
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
		using namespace std;
		#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
		#include <ext/pb_ds/assoc_container.hpp> 
		#include <ext/pb_ds/tree_policy.hpp> 
		using namespace __gnu_pbds; 
		#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
		 
		#define ff first
		#define ss second
		#define mp make_pair
		 
		#define pb push_back
		#define endl "\n"
		 
		#define int long long 
		#define double long double
		 
		#define bp __builtin_popcountllm
		#define inf 1e16
		const int N=1e5+5;
		const int M=105;
		const int MOD=1e9+7;
	
		void solve()
		{	
			int x[]={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};
			int n;
			cin>>n;
			cout<<x[n-1];
		}

		signed main()  
		{
			FAST
			int t=1;
			//cin>>t;
			while(t--)
			{
				solve();
				
			}
		}
		


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <stdio.h>

int main() {
  std::string s;
  std::cin >> s;
  std::stringstream ss(s);
  std::vector<int> v;
  std::string buffer;
  while(std::getline(ss, buffer, '/')) {
    v.push_back(atoi(buffer.c_str()));
  }

  const int year = v.at(0);
  const int month = v.at(1);
  const int day = v.at(2);

  if (year < 2019) {
    std::cout << "Heisei" << std::endl; // 2018
  } else if (year > 2019) {
    std::cout << "TBD" << std::endl; // 2020
  } else {                      // year == 2019
    if (month < 4) {
      std::cout << "Heisei" << std::endl; // 2019/03
    } else if (month > 4) {
      std::cout << "TBD" << std::endl; // 2019/05
    } else {                           // month == 4
      if (day < 30) {
        std::cout << "Heisei" << std::endl; // 2019/04/29
      } else if (day > 30) {
        std::cout << "TBD" << std::endl; // 2019/04/31 (not exist)
      } else {
        std::cout << "Heisei" << std::endl; // day == 30
      }
    }
  }

  return 0;
}

Measured memory_bytes: 256
import math

N, M = map(int, input().split())
X = list(map(int, input().split()))
mod_arr = [{} for i in range(M)]
for x in X:
    d = mod_arr[x % M]
    if x in d:
        d[x] += 1
    else:
        d[x] = 1
ans = 0

if M == 1:
    print(N // 2)
    exit()

def calc_only_one(d):
    sum_v = sum(d.values())
    return sum_v // 2

ans += calc_only_one(mod_arr[0])
# even pattern
if M % 2 == 0:
    ans += calc_only_one(mod_arr[M // 2])

def calc_two(d_S, d_T):
    res = 0
    # print(d1, d2)
    """
    if len(d_S) == 0:
        for v in d_S.values():
            res += v // 2
        return res
    elif len(d_T) == 0:
        for v in d_T.values():
            res += v // 2
        return res
    """

    if sum(d_S.values()) < sum(d_T.values()):
        d_S, d_T = d_T, d_S
    cnt_S = sum(d_S.values())
    cnt_T = sum(d_T.values())
    remain_for_pair = cnt_S - cnt_T
    max_pair_cnt = sum([v // 2 for v in d_S.values()])
    pair_cnt = min(remain_for_pair // 2 , max_pair_cnt)
    res = cnt_T + pair_cnt
    # print(d_S, d_T)
    # print(remain_for_pair, max_pair_cnt, pair_cnt, res)
    return res


for i in range(1, math.ceil(M / 2)):
    ans += calc_two(mod_arr[i], mod_arr[M - i])
print(ans)



Measured memory_bytes: 37604
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++)
			cout << i << "x" << j << "=" << i * j << endl;

	}
	return 0;
}

Measured memory_bytes: 3044
/*

*/
#include <bits/stdc++.h>
using namespace std;
void print() { cout << '\n'; } template<class T, class ...U> void print(T x, U ...y){ cout << x << ' '; print(y...); }
typedef long long ll; const int N = 2e5 + 5, M = 1e9 + 7; typedef vector<int> vi; typedef vector<vi> vii; void Main();
int main(int argc, char **argv) {
  ios::sync_with_stdio(0), cin.tie(0); cout << setprecision(10) << fixed;
  #ifdef Zmm
  freopen((string(*(argv)).substr(2, string(*(argv)).size() - 6) + string(".cpp")).c_str(), "r", stdin); string x; cin >> x;
  #endif
  Main();
}

void Main() {
  int k, x;
  cin >> k >> x;
  if (k * 500 >= x) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 256
import collections
n = int(input())
s = [list(input()) for i in range(n)]
l = [''.join(sorted(i)) for i in s]
c = list(collections.Counter(l).values())
x = sum([sum([i for i in range(i)]) for i in c if i != 1])
print(x) if 0 < x else print(x)

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

int main(){
int n; cin >> n; int ans=0; string s=":(";
rep(i,50000){
  int j=i*1.08;
    if(j == n){
        ans = i;
        break;
    }
}
if(ans==0) cout << s << endl;
else cout << ans << endl;

return 0;
}


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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            //cout<<x<<"/"<<y;
            cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////

int main(){fastio
    
    ll n;cin>>n;
    ll ans[n+1];memset(ans,0,sizeof(ans));
    rep(x,1,200){
        rep(y,1,200){
            rep(z,1,200){
                ll sum=x*x+y*y+z*z+x*y+y*z+z*x;
                if(sum<=n)ans[sum]++;
            }
        }
    }
    rep(i,1,n)cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 3668
#include<iostream>
using namespace std;
#define MAX 1441

int getT(int x){ return (x/100)*60 + x%100; }

main(){
    int n, p, q, k, P[MAX], b, e;
    while( cin >> n >> p >> q  ){
	if ( n == 0 && p == 0 && q == 0 ) break;
	for ( int i = 0; i < MAX; i++ ) P[i] = 0;
	for ( int i = 0; i < n; i++ ){
	    cin >> k;
	    b = getT(p);
	    for ( int j = 0; j < k; j++ ){
		cin >> e; e = getT(e);
		for ( int a = b; a < e; a++ ) P[a] = 1;
		cin >> b; b = getT(b);
	    }
	    e = getT(q);
	    for ( int a = b; a < e; a++ ) P[a] = 1;
	}

	int maxv = 0, v = 0;
	for ( int i = 0; i < MAX; i++ ){
	    if ( P[i] ) { v++;	maxv = max(maxv, v); }
	    else { v = 0; }
	}
	cout << maxv << endl;
    }
}

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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    while(1){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }        
    }
    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] s = br.readLine().split(" ");
		int n = Integer.parseInt(s[0]);
		int w = Integer.parseInt(s[1]);
		int[][] items = new int[n + 1][2];
		for (int i = 1; i < n + 1; i++) {
			s = br.readLine().split(" ");
			items[i][0] = Integer.parseInt(s[0]);
			items[i][1] = Integer.parseInt(s[1]);
		}

		long[][] dp = new long[n+1][100010];
		for (long[] l : dp)
			Arrays.fill(l, Integer.MAX_VALUE);
		for (int i = 0; i < n + 1; i++) {
			dp[i][0] = 0;
		}
		

		int max = -1;
		
		for (int i = 1; i < n + 1; i++) {
			for (int j = 1; j < 100009; j++) {
				if (items[i][1] <= j) {
					dp[i][j] = Math.min(dp[i - 1][j], items[i][0] + dp[i - 1][j - items[i][1]]);
				} else
					dp[i][j] = dp[i - 1][j];
				if (dp[i][j] <= w && j > max)
					max = j;
			}
		}

//		for (int i = 0; i < n + 1; i++) {
//			for (int j = 0; j < 19; j++) {
//				System.out.printf("%-11s", dp[i][j]);
//			}
//			System.out.println();
//		}

		System.out.println(max);
	}

}


Measured memory_bytes: 125780