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

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

using namespace std;

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

struct Data {
  int x, y, a;
};

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  vector<Data> xya(n);
  rep(i, n) {
    int x, y, a;
    cin >> x >> y >> a;
    xya[i] = Data{x, y, a};
  }
  int xLeft = 0;
  int xRight = w;
  int yBottom = 0;
  int yTop = h;

  rep(i, n) {
    Data d = xya[i];
    int x = d.x;
    int y = d.y;
    int a = d.a;
    if (a == 1) {
      xLeft = max(xLeft, x);
    } else if (a == 2) {
      xRight = min(xRight, x);
    } else if (a == 3) {
      yBottom = max(yBottom, y);
    } else {
      yTop = min(yTop, y);
    }
  }

  int result = 0;
  if (xRight > xLeft && yTop > yBottom) {
    result = (xRight - xLeft) * (yTop - yBottom);
  }
  cout << result << endl;

  return 0;
}


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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define VSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

int main() {
	int a, b, c;

	cin >> a >> b >> c;

	c -= min(a - b, c);

	cout << c;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+100;
const int inf=0x3f3f3f;

vector<string> vc;
map<string,int>mp;
int goal[N];
int main(){
    int n,x;
    scanf("%d",&n);
    bool flag=1;
    for(int i=0;i<n;i++){
        cin>>x;
        if(x%2==0){
            if(x%3 && x%5)
                flag=0;
        }
    }
    if(flag)
        puts("APPROVED");
    else
        puts("DENIED");
    return 0;
}
/*
87
13
4
*/


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

int main(){
    string s, t;
    cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    
    bool ans=false;
    if(s.size()<t.size()){
        ll flg=0;
        rep(i,0,s.size()){
          if(s[i]==t[i])flg++;
          else if(s[i]<t[i]){ans=true;break;}
        }
        if(flg==s.size()) ans=true;
    }
    if(min(s.size(),t.size())>=1) {
        rep(i,0,min(s.size(),t.size())){
            if(s[i]==t[i])continue;
            else if(s[i]<t[i])ans=true;
        }
    }
    cout << (ans ? "Yes":"No") << endl;
    return 0;
}

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

int main() {
       string s, t;
       cin >> s >> t;
       if(s[0] == t[2] && s[2] == t[0] && s[1] == t[1]) cout << "YES" << endl;
       else cout << "NO" << endl;
       return 0;
}

Measured memory_bytes: 256
#include "stdio.h"
int main(void){
int H,W;
int i,j;
do{
scanf("%d %d",&H,&W);	
if(H!=0 || W!=0){
for(i=0;i<H;i++){
for(j=0;j<W;j++){
printf("#");
}
puts("");
}
puts("");
}
}while(H!=0 || W!=0);
return 0;
}

Measured memory_bytes: 588
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


char buf[100001];

int main(){

	scanf("%s",buf);

	int length;
	int ans = BIG_NUM;
	int tmp_min = BIG_NUM,tmp_max = 0,width;

	for(length = 0; buf[length] != '\0'; length++){
		tmp_min = min(tmp_min,buf[length]-'0');
		tmp_max = max(tmp_max,buf[length]-'0');
	}

	ans = tmp_max-tmp_min;

	if(ans == 0){
		printf("0\n");
		return 0;
	}

	vector<int> V;

	for(int i = 2; i <= sqrt(length); i++){
		if(length%i == 0){
			V.push_back(i);
			V.push_back(length/i);
		}
	}

	sort(V.begin(),V.end());
	V.erase(unique(V.begin(),V.end()),V.end());


	bool FLG;
	char base_num;
	int loc,tmp;

	for(int i = 0; i < V.size(); i++){
		width = V[i];
		tmp_min = BIG_NUM,tmp_max = 0;

		FLG = true;

		for(int k = 0; k < width-2; k++){
			base_num = buf[k];
			loc = k+width;

			while(loc < length){
				if(buf[loc] != base_num){
					FLG = false;
					break;
				}
				loc += width;
			}
			if(!FLG)break;
		}

		if(!FLG)continue;

		for(int k = 1; k <= length/V[i]; k++){
			tmp = 10*(buf[k*width-2]-'0')+buf[k*width-1]-'0';
			tmp_min = min(tmp_min,tmp);
			tmp_max = max(tmp_max,tmp);
		}
		ans = min(ans,tmp_max-tmp_min);
	}

	if(ans <= 2){
		printf("%d\n",ans);
		return 0;
	}

	tmp_min = BIG_NUM,tmp_max = 0;
	for(int i = 0; i < length;){
		if(buf[i] == '1'){
			if(i+1 == length){
				printf("%d\n",ans);
				return 0;
			}else{
				tmp = 10*(buf[i]-'0')+buf[i+1]-'0';
				tmp_min = min(tmp_min,tmp);
				tmp_max = max(tmp_max,tmp);
				i += 2;
			}
		}else{
			tmp_min = min(tmp_min,buf[i]-'0');
			tmp_max = max(tmp_max,buf[i]-'0');
			i += 1;
		}
	}

	if(tmp_min != BIG_NUM && tmp_max != tmp_min)ans = min(ans,tmp_max-tmp_min);

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

	return 0;
}

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

int main(){ 
    Int X;
    cin >> X;

    vector<Int> n(4000);

    n[0] = 100;

    Int ans;

    rep(i,3999) {
        n[i+1] = n[i] + (n[i] / 100);
        if (n[i+1] >= X) {
            ans = i+1;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3672
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner input =new Scanner(System.in);
		long m=input.nextLong(), n=input.nextLong();
		long rem=(m+n)%2;
		
		if(rem==0)
			System.out.println((m+n)/2);		
		else
			System.out.println("IMPOSSIBLE");
		
	}

}


Measured memory_bytes: 27064
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
	int n, a, b;
	cin >> n;
	if (n == 1)
	{
		cout << "Hello World" << endl;
	}
	else
	{
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		int a = 4 * i;
		int b = N - a;
		if(b >= 0 && b % 7 == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	
	
	
	
    return 0;
}

Measured memory_bytes: 256
from typing import Generic, List, TypeVar

T = TypeVar('T')

class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container)


if __name__ == "__main__":
	stack = Stack()
	a = list(input().split())
	for s in a:		
		if s == '+':
			x = stack.pop()
			y = stack.pop()
			stack.push(x + y)
		elif s == '-':
			x = stack.pop()
			y = stack.pop()
			stack.push(y - x)
		elif s == '*':
			x = stack.pop()
			y = stack.pop()
			stack.push(x * y)
		else:
			stack.push(int(s))
	print(stack.pop())


Measured memory_bytes: 7164
fun main (args : Array<String>) {
    val x = readLine()!!.toInt()

    var calc : Int = x
    var cnt1 : Int = 0
    var cnt2 : Int = 0
    var result : Int

    while (calc >= 500) {
        calc = calc - 500
        cnt1 += 1
    }

    while (calc >= 5) {
        calc = calc - 5
        cnt2 += 1
    }

    result = (1000 * cnt1) + (5 * cnt2)
    return println("${result}")

}


Measured memory_bytes: 34492
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;


int main(void){

  int A,B,ans;

  cin >> A >> B;

  if(A > 9 || B > 9){
    ans = -1;
  }else{
    ans = A * B;
  }

  cout << ans << endl;

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 0, j = 0; i < s.size(); i = j) {
		while(j < s.size() && s[i] == s[j])
			++j;
		if(s[i] == 'R') ans = max(ans, j - i);
	}
	cout << ans;
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

void solve(int h, int w)
{
    if(h>w) swap(h,w);
    int g=__gcd(h,w);
    h/=g;
    w/=g;

    if(h==w)
    {
        printf("1 0\n");
        return;
    }

    // h!=w
    ll a=1, b=1;
    if(h%2==1 && w%2==1)
    {
        ll mul=(ll)h*w;
        b=mul/2;
        a=mul-b;
    }

    printf("%lld %lld\n", a,b);
}

int main()
{
    int T;
    scanf(" %d", &T);
    while(T--)
    {
        int h,w;
        scanf(" %d %d", &h, &w);
        solve(h,w);
    }
    return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)


int main() {
	int n;
	cin >> n;
	vector<ll> h(n + 1);
	FOR(i, 1, n) {
		cin >> h[i];
	}
	RFOR(i, n, 2) {
		if (h[i - 1] > h[i] + 1) {
			ps(No);
			return(0);
		}
		else if (h[i - 1] == h[i] + 1) {
			h[i - 1]--;
		}
	}
	ps(Yes)
	return(0);
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define N_MAX 200002

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];

void init(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        fac[i]=fac[i-1]*(ll) i%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    init();
    int N;
    ll A[100000];
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    ll tmp = 0;
    for(int i = 0; i < N; i++){
        tmp += inv[i+1];
        tmp %= MOD;
    }
    ll ans = 0;
    ans += tmp*A[0];
    ans %= MOD;
    // cout << tmp << endl;
    for(int i = 1; i < N; i++){
        tmp -= inv[N-i+1];
        tmp %= MOD;
        tmp += MOD;
        tmp %= MOD;
        tmp += inv[i+1];
        tmp %= MOD;
        ans += tmp*A[i];
        ans %= MOD;
    }
    // cout << tmp << endl;
    // cout << ans << endl;
    cout << (fac[N]*ans)%MOD << endl;
}

Measured memory_bytes: 5760
// Practice AtCoder
// author: Loenardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let k = get!();
    let mut ps = vec![];
    let mut fs = vec![];
    for _ in 0 .. n {
        ps.push(get!());
    }
    for _ in 0 .. n {
        fs.push(get!());
    }
    ps.sort();
    fs.sort();
    fs.reverse();
    
    let check = |hp| {
        let mut sum = 0;
        for i in 0 .. n {
            let e = hp / fs[i];
            if ps[i] > e {
                sum += ps[i] - e;
            }
        }
        sum <= k
    };
    
    let mut m = (1 << 61) - 1;
    for z in 0 .. 61 {
        let z = 60 - z;
        let hp = m - (1 << z);
        if check(hp) {
            m -= 1 << z;
        }
    }
    println!("{}", m);
}


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

#define X 0
#define Y 1
void kock(int n,double p1[2],double p2[2])
{
  if(n==0)return;
  double s[2],t[2],u[2],cs,sn;
  s[X]=(2.0*p1[X]+p2[X])/3.0;
  s[Y]=(2.0*p1[Y]+p2[Y])/3.0;
  t[X]=(p1[X]+2.0*p2[X])/3.0;
  t[Y]=(p1[Y]+2.0*p2[Y])/3.0;
  sn=sqrt(3)/2.0;
  cs=1.0/2.0;
  u[X]=(t[X]-s[X])*cs-(t[Y]-s[Y])*sn+s[X];
  u[Y]=(t[X]-s[X])*sn+(t[Y]-s[Y])*cs+s[Y];

  kock(n-1,p1,s);
  printf("%f %f\n",s[X],s[Y]);
  kock(n-1,s,u);
  printf("%f %f\n",u[X],u[Y]);
  kock(n-1,u,t);
  printf("%f %f\n",t[X],t[Y]);
  kock(n-1,t,p2);
}
int main()
{
  int n;
  double p1[2]={0,0},p2[2]={100,0};
  scanf("%d",&n);
  printf("%f %f\n",p1[X],p1[Y]);
  kock(n,p1,p2);
  printf("%f %f\n",p2[X],p2[Y]);
  return 0;
}



Measured memory_bytes: 1996
#include <bits/stdc++.h>
using namespace std;
#define ll      long long int   
#define ld      long double
#define pii     pair<int ,int>
#define pld     pair<ld ,ld>
#define all(v)  v.begin(),v.end()
#define F       first
#define S       second
#define mod     1000000007
#define pb      push_back
#define MP      make_pair
#define mset(x) memset(x, 0, sizeof(x));
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf     1000000000000007
const int N=206;
ll n,dp[N][N],col[N];
string a[N];
void run(){
    ll i,j,k,ans=0;
    queue<ll>q;
cin>>n;
for(i=1;i<=n;i++)
{
    cin>>a[i];
    a[i]='0'+a[i];
    for(j=1;j<=n;j++)
        if(a[i][j]=='1')
            dp[i][j]=1;
        else if(i==j)
            dp[i][i]=0;
        else dp[i][j]=5000;
}
q.push(1);
col[1]=1;
while(!q.empty())
{
    i=q.front();
    q.pop();
    for(j=1;j<=n;j++)
    {
        if(a[i][j]=='1')
        {
            if(col[j]==0)
            {
                col[j]=-col[i];
                q.push(j);
            }
            else if(col[j]==col[i])
            {
                cout<<-1;
                return;
            }
        }
    }
}

for(k=1;k<=n;k++)
{
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
        }
    }
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
    if(dp[i][j]<5000)
        ans=max(ans,dp[i][j]);
cout<<ans+1;


    
}
 
 
void setup(){
    ios;
    //cout << setprecision(20);
    // #ifndef ONLINE_JUDGE
    // freopen("input", "r", stdin);
    // freopen("output", "w", stdout);
    // #endif
}
 
signed main(){
    setup();
    int tests = 1;
    //cin >> tests;
    for(int i = 1; i <= tests; i++) run();
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    scc_graph G(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        G.add_edge(a,b);
    }
    vector<vector<int>> A=G.scc();
    cout<<A.size()<<"\n";
    rep(i,A.size()){
        cout<<A[i].size()<<" ";
        rep(j,A[i].size()) cout<<A[i][j]<<" ";
        cout<<"\n";
    }
}

Measured memory_bytes: 40552
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string w;
	cin>>w;
	int dt[26];
	rep(i,26)dt[i]=0;
	rep(i,w.size()){
		dt[w[i]-'a']++;
	}
	bool check=true;
	rep(i,26){
		if(dt[i]%2){check=false;break;}
	}
	cout<<((check)?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, A, B) = read!(usize, usize, usize);

    let k = A + B;
    let total = A * (N / k) + min(N % k, A);

    println!("{}", total);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / LINF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

using namespace std;

int N;
priority_queue<double, vector<double>, greater<double>> pq;

int main()
{
    cin >> N;
    REP(i, N) {
        int tmp;
        cin >> tmp;
        pq.push(tmp);
    }

    while(pq.size() > 1) {
        double x = pq.top(); pq.pop();
        double y = pq.top(); pq.pop();
        pq.push((x+y)/2.0);
    }

    cout << pq.top() << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main() {
    long long k, a, b;
    scanf("%lld %lld %lld", &k, &a, &b);
    k++;
    long long ans = k;
    if (k > a && b > a) {
        long long tmp = 0;
        tmp += (k-a) % 2;
        tmp += (k-a) / 2 * (b-a);
        tmp += a;
        ans = max(ans, tmp);
    }
    printf("%lld\n", ans);
    return 0;
}


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


int main(){
	int a, b, c;
	cin >> a >> b;
	if(a>b*2) c = a - b*2;
	else c = 0;
	cout << c << endl;
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    int cnt=0,two=0;
    rep(i,n){
        int a; cin>>a;
        if(a%4==0)cnt++;
        if(a%4==2)two++;
    }
    if(two>=2)n-=two-1;
    if(n/2<=cnt)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<limits.h>
#define _USE_MATH_DEFINES

using namespace std;

long long N, X, x[100000], g[100000] = {}/*gap*/, ans = 0;

int gcd(long long a, long long b) {
	long long c = 0;

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

int main() {
	cin >> N >> X;
	for (auto i = 0; i < N; i++) {
		cin >> x[i];
		x[i] -= X;
		if (x[i] < 0) {
			x[i] *= -1;
		}
	}
	
	sort(x, x + N);

	ans = x[0];

	if (N >= 2) {
		for (auto i = 1; i < N; i++) {
			if (x[i] % ans != 0) {
				ans = gcd(ans, x[i]);
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-


def main():
    s = input()
    t = ''

    for si in s[::-1]:
        if si == 'b':
            t += 'd'
        elif si == 'd':
            t += 'b'
        elif si == 'p':
            t += 'q'
        elif si == 'q':
            t += 'p'

    if s == t:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
import sys
input = sys.stdin.readline

def main():
    s = input().strip()
    t = input().strip()
    n = len(s)
    m = len(t)
    dp = [[0] * (m+1) for _ in range(n+1)]
    for i in range(1, n+1):
        for j in range(1, m+1):
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])
            if s[i-1] == t[j-1]:
                dp[i][j] = max(dp[i-1][j-1] + 1, dp[i][j])
    
    ans_r = []
    while n > 0 and m > 0:
        if dp[n][m] == dp[n-1][m]: n -= 1
        elif dp[n][m] == dp[n][m-1]: m -= 1
        else:
            n -= 1
            m -= 1
            ans_r.append(s[n])
    print("".join(reversed(ans_r)))

if __name__ == '__main__':
    main()

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

using namespace std;

void solve(){
    string line;
    cin >> line;

    vector<string> alphas(26);
    string all = "abcdefghijklmnopqrstuvwxyz";
    for(int i = 0; i < 26; i++){
        alphas[i] = all.substr(i,1);
    }

    for(int i = 0; i < 26; i++){
        bool flag = true;
        for(int j = 0; j < line.length(); j++){
            if(line.substr(j,1) == alphas[i]) {
                flag = false;
                break;
            }
        }
        if(flag){
            cout << alphas[i] << endl;
            return;
        }
    }
    cout << "None" << endl;
    return;
}

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

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
using namespace std;
#define ll long long
int main() {
	ios::sync_with_stdio(0);
	ll A, B;
	cin >> A >> B;
	ll K = (A + B) / 2;
	if (abs(A - K) != abs(B - K))
		cout << "IMPOSSIBLE";
	else
		cout << K;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int K = scan.nextInt();
        HashSet<Integer> set = new HashSet<>();
        for(int i = 0; i < N; i++)
            set.add(i);

        for(int i = 0; i < K; i++) {
            int d = scan.nextInt();
            for(int j = 0; j < d; j++) {
                int A = scan.nextInt()-1;
                set.remove(A);
            }
        }

        os.println(set.size());
    }

}

Measured memory_bytes: 37324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=305,INF=1<<30;
bool dp[MAX][MAX][MAX];
ll dp2[MAX][MAX][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    int N=si(S);
    dp[0][0][0]=1;
    
    for(int i=0;i<N;i++){
        for(int j=0;j<=N;j++){
            for(int k=0;k<=N;k++){
                if(dp[i][j][k]==0) continue;
                
                if(i+1<N){
                    if(S[i]=='0') dp[i+2][j+1][k]=1;
                    else dp[i+2][j][k+1]=1;
                    
                    if(S[i+1]=='0') dp[i+2][j+1][k]=1;
                    else dp[i+2][j][k+1]=1;
                    
                    dp[i+1][j][k]=1;
                }
                
                if(j&&S[i]=='1') dp[i+1][j-1][k+1]=1;
                
                if(k&&S[i]=='0') dp[i+1][j+1][k-1]=1;
                
                if(j||k) dp[i+1][j][k]=1;
            }
        }
    }
    
    reverse(all(S));
    
    dp2[0][0][0]=1;
    
    for(int i=0;i<N;i++){
        for(int j=0;j<=N;j++){
            for(int k=0;k<=N;k++){
                if(S[i]=='0'){
                    dp2[i][j][k+1]+=dp2[i][j][k];
                    dp2[i][j][k+1]%=mod;
                }else{
                    dp2[i][j+1][k]+=dp2[i][j][k];
                    dp2[i][j+1][k]%=mod;
                }
                dp2[i+1][j][k]+=dp2[i][j][k];
                dp2[i+1][j][k]%=mod;
            }
        }
    }
    
    ll ans=0;
    
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            for(int k=0;k<=N;k++){
                if(dp[i][j][k]){
                    ans+=dp2[N-i][j][k];
                    ans%=mod;
                }
            }
        }
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 228896
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

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

const ll mod = 1000000007;

int main(void)
{
	ll n,k;
	cin >> n >> k;
	vector<ll> hs(n);
	rep(i, n)cin >> hs[i];
	sort(hs.begin(), hs.end(), greater<ll>());
	ll sum = 0;
	for (int i = k; i < n; i++) {
		sum += hs[i];
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void){

   while(1){
        int n, x;
        cin >> n >> x;
 
        if(n==0 && x==0)break;
 
        int cnt = 0;
 
        for(int i=1; i<=n; i++){
            for(int j=i+1; j<=n; j++){
                for(int k=j+1; k<=n; k++){
                    if(i+j+k==x){
                        cnt++;
                    }
                }
            }
        }
 
        cout << cnt << endl;
    }
 
    return 0;
}


Measured memory_bytes: 3096
def is_palindrome(S):
  flag = True
  for i in range(len(S)):
    if S[i] != S[-1*(i+1)]:
      flag = False
      break
  return flag

S = str(input())

ans = "No"

if is_palindrome(S) and is_palindrome(S[:len(S)//2]) and is_palindrome(S[(len(S)+1)//2:]):
  ans = "Yes"


print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const int INF = INT_MAX / 2;

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

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

	while ( true )
	{
		int w, h;
		cin >> w >> h;

		if ( !( w | h ) )
		{
			break;
		}

		vector<VVI> walls( h, VVI( w, VI() ) );

		REP( i, 0, 2 * h - 1 )
		{
			const int y = i / 2;
			if ( i % 2 ) // 縦方向
			{
				VI wall( w );
				FOR( tmp, wall )
				{
					cin >> tmp;
				}

				REP( i, 0, wall.size() )
				{
					if ( !wall[i] )
					{
						walls[y][i].PB( 0 );
						walls[ y + 1 ][i].PB( 2 );
					}
				}
			}
			else
			{
				VI wall( w - 1 );
				FOR( tmp, wall )
				{
					cin >> tmp;
				}

				REP( i, 0, wall.size() )
				{
					if ( !wall[i] )
					{
						walls[y][i].PB( 1 );
						walls[y][ i + 1 ].PB( 3 );
					}
				}
			}
		}

		VVI distance( h, VI( w, INF ) );
		distance[0][0] = 0;

		queue<PII> que;
		que.push( MP( 0, 0 ) );

		while ( !que.empty() )
		{
			auto cur = que.front();
			que.pop();

			FOR( d, walls[ cur.fst ][ cur.snd ] )
			{
				auto next = cur;
				next.fst += dy[d];
				next.snd += dx[d];

				if ( distance[ cur.fst ][ cur.snd ] + 1 < distance[ next.fst ][ next.snd ] )
				{
					distance[ next.fst ][ next.snd ] = distance[ cur.fst ][ cur.snd ] + 1;
					que.push( next );
				}
			}
		}

		const int res = distance.back().back();
		cout << ( res == INF ? 0 : res + 1 ) << endl;
	}

	return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <vector>

using namespace std;

constexpr long long mod = 1e9 + 7;

int main() {
  long long n = 0;
  cin >> n;
  vector<long long> cnt(60);
  for (int i=0; i<n; i++) {
    long long a = 0;
    cin >> a;
    for (int j=0; j<60; j++) {
      if ((a & (1LL<<j)) != 0) {
        cnt.at(j)++;
      }
    }
  }
  
  long long ans = 0;
  for (int i=0; i<60; i++) {
    long long two = (1LL<<i);
    long long comb = cnt.at(i)*(n-cnt.at(i));
    ans += ((two%mod) * (comb%mod)) % mod;
    ans %= mod;
  }
  
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main ( void )
{
	const int INF = (1 << 15);
	int n;
	int cost[10][10];

	while ( cin >> n , n )
	{
		for (int i = 0; i < 10; ++i)
		{
			for (int j = 0; j < 10; ++j)
				cost[i][j] = INF;
			cost[i][i] = 0;
		}

		int a, b, c, V = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> a >> b >> c;
			cost[a][b] = cost[b][a] = c;
			V = max(V, max(a, b));
		}

		for (int k = 0; k <= V; ++k)
			for (int i = 0; i <= V; ++i)
				for (int j = 0; j <= V; ++j)
					cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);

		int from = -1, minCost = INF;
		for (int i = 0; i <= V; ++i) {
			int sum = 0;
			for (int j = 0; j <= V; ++j)
				sum += cost[i][j];
			if ( sum < minCost ) {
				from = i;
				minCost = sum;
			}
		}

		cout << from << ' ' << minCost << endl;

	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#define MAX 100005

struct queue {
  char process[10];
  int time;
};

int head = 0, tail;
int n;
struct queue Q[MAX];

void enqueue(struct queue);
struct queue dequeue(void);
int isEmpty(void);
int isFull(void);

int main() {
  struct queue t;
  int i, q, runtime = 0, ex = 0;

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

  for(i = 0; i < n; i++) {
    scanf("%s", Q[i].process);
    scanf("%d", &Q[i].time);
  }

  tail = n;

  /* Simulation */
  while(1){
    t = dequeue();
    if(t.time <= q) {
      runtime += t.time;
      printf("%s %d\n", t.process, runtime);
      ex++;
      if(ex == n) break;
    }else {
      runtime += q;
      t.time -= q;
      enqueue(t);
    }
  }

  return 0;

}

void enqueue(struct queue x){
  if(isFull() != 1){
    Q[tail] = x;

    if(tail + 1 == MAX) tail = 0;
    else tail++;
  }
  else printf("overflow...\n");
}

struct queue dequeue(void) {
  struct queue r;
  if(isEmpty() != 1){
    r = Q[head];
    if(head + 1 == MAX) head = 0;
    else head++;
    return r;
  }else {
    printf("underflow...\n");
    return;
  }
}

int isEmpty(void) {
  if (head == tail) return 1;
  else return 0;
}

int isFull(void) {
  if (head == ((tail + 1)%MAX)) return 1;
  else return 0;
}

Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,d,p;
    while (cin>>n>>m) {
        if (n==0&&m==0) {
            break;
        } else {
            std::multimap<int, int,greater<int>> map;
            for (int i=0;i<n;i++) {
                cin>>d>>p;
                map.insert(make_pair(p,d));
            }
            int sum=0;
            for (auto itr=map.begin();itr!=map.end();itr++) {
                int tmp=itr->second;
                //cout<<m<<" "<<tmp<<endl;
                if (m!=0&&tmp<m) {
                    m-=itr->second;
                } else if (m!=0&&tmp>m) {
                    tmp-=m;
                    m=0;
                    sum+=tmp*itr->first;
                } else if (m==0) {
                    sum+=tmp*itr->first;
                }
            }
            cout<<sum<<endl;
        }
    }
}


Measured memory_bytes: 3488
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#define mod 1000000007
#define ll long long int
#define int int64_t
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SORT(x) sort(all(x));
#define DSORT(x) sort(all(x), greater<>());
#define PI 3.14159265358979323846264338327950288
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
using namespace std;
bool prime(int n){for(int i=2;i<=sqrt(n);i++){if(n%i==0){return 0;}}return 1;}
void normal(int &a) {a=a%mod;(a<0)&&(a=a+mod);}
int Add(int a,int b) {a=a%mod,b=b%mod; normal(a),normal(b); return (a+b)%mod; }
int Sub(int a,int b) {a=a%mod,b=b%mod; normal(a),normal(b); a=a-b; normal(a); return a; }
int Mul(int a,int b) {a=a%mod,b=b%mod; normal(a),normal(b); return (a*b)%mod;}
int Pow(int n,int x){int res=1; while(x){ if(x&1) res=Mul(res,n); n=Mul(n,n); x=x>>1;} return res;} 
int modInverse(int n){return Pow(n,mod-2);}
int Div(int a,int b) { return Mul(a, modInverse(b));}
const int E3 = 1e3 + 7;
const int E4 = 1e4 + 7;
const int E5 = 1e5 + 7;
const int E6 = 1e6 + 7;
const int E9 = 1e9 + 7;

signed main(){
    fio;
    int k;
    cin>>k;
    while(k--){
        cout<<"ACL";
    }
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int i,a[100];
int f(int l1,int r1){
	int j,k,r,l,m;
	l=l1;r=r1;
	m=(a[l]+a[r])/2;
	while(l<=r){
		while(a[l]<m) l++;
		while(a[r]>m) r--;
		if(l<=r){
			swap(a[l],a[r]);
			l++;r--;
		}
	}
	if(l1<r) f(l1,r);
	if(l<r1) f(l,r1);
}
int main(){
	int n,m,ans=0;
	cin>>n>>m;
	for(i=1;i<=n;i++) cin>>a[i];
	f(1,n);
	for(i=n;i>n-m;i--) ans+=a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

a,b,c = inp
p [c-a+b,0].max

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define ll long long int
#define llu unsigned long long int
#define vi vector<int>
#define vll vector<ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define M 1000000007
#define endl "\n"
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n; cin>>n;
    int a1=0,b1=0,c1=0;
    rep(i,n){
        int a,b,c; cin>>a>>b>>c;
        int maxa=max(b1+b,c1+c);
        int maxb=max(a1+a,c1+c);
        int maxc=max(a1+a,b1+b);
        a1=maxa,b1=maxb,c1=maxc;
    }
    cout<<max(a1,max(b1,c1))<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int data1,data2;
  	int c = 0;
  	int i = 0;
	scanf("%d%d",&data1,&data2);	/* 入力部分 */
  	
  	while(i <= data1){
    if(data2 == (data1 + i) * 2){
      c = 1;
      break;
    }
      i++;
    }
  if(c == 1){
	printf("Yes\n");}
  else printf("No\n");
  
	return 0;
}

Measured memory_bytes: 1620
# your code goes here
s1 = input()
s2 = input()
n = len(s1)
flag = 0
for i in range(n):
	if(s1 == s2):
		flag = 1
	else:
		s2 = s2[-1]+s2[:-1]
		#print(s2)
if(flag == 1):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
	double d=100.0;
	long long int n,s=0,x;
	cin>>n;
	while(1){
		d*=1.01;
		x=d;
		s++;
		if(x>=n)break;
		d=x;
	}
	cout<<s<<'\n';
} 

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
map<int,int> m;
int main(){
	int n,cn,t,ct;
	cin>>n>>t;
	for (int i=0;i<n;i++){
		cin>>cn>>ct;
		if (ct<=t)
			m[cn]=ct;
	}
	bool flag=false;
	int min=1000000;
	for (map<int,int>::iterator i=m.begin();i!=m.end();i++){
		if (i->second<=t && i->first<min){
			flag=true;
			min=i->first;
			break;
		}
	}
	if (flag)	cout<<min;
	else	cout<<"TLE";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    std::string s;
    std::cin >> s;
    for(int i = 0; i < s.length(); i++){
        if(i == 3){
            std::cout << 8;
        }else{
            std::cout << s[i];
        }
    }
    std::cout << std::endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main () {
    int a = 0, b = 0, c = 0;
    cin >> a >> b >> c;
    vector<int> mod;
    long long now = a;
    while(true) {
        long long buf = now % b;
        if (buf == c) {
            cout << "YES" << endl;
            return 0;
        }
        bool find = false;
        for (int x : mod) {
            if (x == buf) {
                find = true;
                break;
            }
        }
        if (find) break;
        else mod.push_back(buf);
        now += a;
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,i=0;
	cin >> n;
	while(1){
		m=0;
		i++;
		for(int j=1;j<100000;j++){
			if(i%j==0){
				m++;
			}
		}
		if(m==n){
			cout << i << endl;
			break;
		}
	}
}


Measured memory_bytes: 3080
#include<cstdio>
int main(){
    int n,a[]={105,135,165,189,195};
    scanf("%d",&n);
    for(int i=0;i<5;i++){
        if(n<a[i]){
            printf("%d",i);
            return 0;
        }
    }
    printf("5");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    int n; std::cin >> n;
    int a[n];
    for(int i=0; i<n; i++)
    {
        std::cin >> a[i];
        a[i]--;
    }
    int cnt=0, now=0;
    for(;;)
    {
        if(now==1)
        {
            std::cout << cnt << std::endl;
            return 0;
        }
        if(cnt>=n)
        {
            std::cout << -1 << std::endl;
            return 0;
        }

        cnt++;
        now = a[now];
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<ll> a(3*n);
    rep(i, 3*n)cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    for(int i = n; i < 3 * n; i += 2){
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 5540
s=input()
gu_time=0
pa_time=0
n=len(s)
score=0
for i in range(n):
    if pa_time==gu_time:
        gu_time+=1
        if s[i]=="p":
            score-=1
    elif pa_time<gu_time:
        pa_time+=1
        if s[i]=="g":
            score+=1
print(score)



Measured memory_bytes: 3316
import copy

def main():
  n,m = map(int,input().split())
  s = [int(n) for n in input().split()]
  cs = copy.copy(s)
  for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    if(s[a] < s[b]):
      cs[a] = -1
    elif(s[a] == s[b]):
      cs[a] = -1
      cs[b] = -1
    elif(s[b] < s[a]):
      cs[b] = -1
  print(len(cs)-cs.count(-1))
      
if __name__ == '__main__':
  main()

Measured memory_bytes: 21000
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const ll MOD = 1e9+7;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

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

    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		int period = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in), 128).readLine());
		int val = 100;//壱百千円
		for (; 0 < period; period--) {
			val = val * 105 % 100 == 0 ? (int) (val * 1.05) : (int) (val * 1.05) + 1;
		}
		System.out.println(val * 1000);
	}
}

Measured memory_bytes: 16844
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;
int main()
{
  string S;
  cin >> S;
  int ans = 0;
  for(int i=0; i<S.length()/2; i++){
      if(S.at(i)!=S.at(S.length()-1-i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define sz size()
#define y1 luboi
using namespace std;
typedef long long ll;

int n;
int a[100100];
int cnt;
int main(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        if(i==1){
            if(a[i]==i){
                cnt++;
                swap(a[i],a[i+1]);
            }
        }
        else if(i==n){
            if(a[i]==i){
                cnt++;
                swap(a[i],a[i-1]);
            }
        }
        else{
            if(a[i]==i){
                if(a[i+1]!=i){
                    swap(a[i],a[i+1]);
                    cnt++;
                }
            }
        }
    }
    cout<<cnt;
}



Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int v[11];

bool compair(int x)
{
    while(x>0)
    {
        if(v[x%10]==1)
        {
            return false;
        }
        x=x/10;
    }
    return true;
}

int main()
{
    int a,b,c;
    cin>>a>>b;
    for(int i=0; i<b; i++)
    {
        cin>>c;
        v[c]=1;
    }
    for(int i=a; i<100000; i++)
    {
        if(compair(i))
        {
            cout<<i<<endl;
            break;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int[] arr = {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 k = sc.nextInt();
        System.out.println(arr[k-1]);
    }

}

Measured memory_bytes: 22996
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> as(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> as[i];
    }
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 2 == 1 && as[i] % 2 == 1)
        {
            count++;
        }
    }
    cout << count << endl;
}


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

ll mod = 13;
ll mod2 = 1000000007;
ll modpow(ll a, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
	string st;
	cin >> st;
    int n = st.size();
    vector<ll> ans(13);
    vector<ll> ans2(13);
    vector<ll> inp(13);
    rep(i, 13){
      ans.at(i) = 0;
      ans2.at(i) = 0;
      inp.at(i) = 0;
    }
    ans.at(0) = 1;
    int k = 0;
    ll input = 0;
    for(int i = n-1; i>=0; i--){
      rep(i, 13) inp.at(i) = 0;
      if(st.at(i) == '?'){
        rep(i, 10) inp.at(modpow(10, k)*i%13)++;
        rep(j, 13){
          rep(l, 13){
            ans2.at((j+l)%13) += inp.at(j)*ans.at(l)%mod2;
            if(ans2.at((j+l)%13) >= mod2) ans2.at((j+l)%13) %= mod2;
          }
        }
      }else{
        inp.at(modpow(10, k)*(int)(st.at(i)-'0')%13)++;
        rep(j, 13){
          rep(l, 13){
            ans2.at((j+l)%13) += inp.at(j)*ans.at(l)%mod2;
            if(ans2.at((j+l)%13) >= mod2) ans2.at((j+l)%13) %= mod2;
          }
        }
      }
      rep(i, 13) ans.at(i) = ans2.at(i);
      rep(i, 13) ans2.at(i) = 0;
      k++;
    }
	cout << ans.at(5) << endl;
}

Measured memory_bytes: 512