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

#define ll                 long long
#define ull                unsigned long long
#define pii                pair<int, int>
#define pll                pair<ll, ll>
#define mp                 make_pair
#define ff                 first
#define ss                 second
#define sz(x)              (int) x.size()
#define all(v)             v.begin(), v.end()
#define fill(a, b)         memset(a, b, sizeof(a))
#define endl               '\n'

template <typename T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <typename T> inline void smax(T &a, T b) {a = a > b ? a : b;}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ", ";
    err(++it, args...);
}

template <typename T> inline void Int(T &n) {
    n = 0; int f = 1; register int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l); }

const int mod = (int) 1e9 + 7;

inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (ll) a * b % mod;}

const int inf = (int) 2e9 + 5;
const ll  Inf = (ll) 2e18 + 5;
const int N   = (int) 2e5 + 5;



int solve() {
    int a[3];
    for(int i = 0; i < 3; i++) {
        Int(a[i]);
    }
    sort(a, a + 3);
    if(a[0] == a[1] && a[1] != a[2]) printf("Yes\n");
    else if(a[0] != a[1] && a[1] == a[2]) printf("Yes\n");
    else printf("No\n");
    return 0;
}

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int test = 1, tc = 0;
    //Int(test);
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		int cb[] = new int[10+1];
		int index = 0;
		while(scan.hasNext())
		{
			
			int ca = scan.nextInt();
			if (ca == 0)
			{
				System.out.println(cb[index-1]);
				index--;
				continue;
			}
			cb[index] = ca;
			index++;
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
int main(){
  int ans = 0, N, K, d, a;
  cin >> N >> K;
  vector<bool> people(N, 1);
  
  for(int i=0; i<K; i++){
    cin >> d;
    for(int j=0; j<d; j++){
      cin >> a;
      if(people.at(a-1)) people.at(a-1) = 0; 
    }
  }
  
  for(int i=0; i<N; i++){
    if(people.at(i)) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3632
#define FOR(i, min, max) for(int (i) = (min); (i) < (max); (i)++)
#define MAX(a,b) ((a) > (b) ? (a) : (b)) 

#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int n, c = 0, a[100];
	cin >> n;
	FOR(i, 0, n)
		cin >> a[i];
	bool flag = true;
	while (flag)
	{
		flag = false;
		for (int j = n - 1; j > 0; j--)
		{
			if (a[j] < a[j - 1])
			{
				int rem = a[j];
				a[j] = a[j - 1];
				a[j - 1] = rem;
				c++;
				flag = true;
			}
		}
	}
	FOR(i, 0, n-1)
	{
		cout << a[i] << " ";
	}
	cout << a[n - 1] << endl;
	cout << c << endl;

	return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * os xw
 */
int n;
string s;
void func(vector<char> ans) {
	map <char, char> c;
	c['S'] = 'W';
	c['W'] = 'S';
	for (int i = 1; i < n - 2; i++) {
		if (s[i] == 'o') {
			ans[i + 1] = (ans[i] == 'S' ? ans[i - 1] : c[ans[i - 1]]);
		}
		else {
			ans[i + 1] = (ans[i] == 'W' ? ans[i - 1] : c[ans[i - 1]]);
		}
	}
	bool ok = true;
	for (int i = 1; i < n; i++) {
		if (ans[i] == 'S') {
			if (s[i] == 'o') {
				ok &= (ans[i - 1] == ans[(i + 1) % n]);
			}
			else {
				ok &= (ans[i - 1] != ans[(i + 1) % n]);
			}
		}
		else {
			if (s[i] == 'x') {
				ok &= (ans[i - 1] == ans[(i + 1) % n]);
			}
			else {
				ok &= (ans[i - 1] != ans[(i + 1) % n]);
			}
		} 
	}
	if(!ok)
		return;
	for (auto g : ans)
		cout << g;
	exit(0);
}
int main() {
	cin >> n;
	cin >> s;
	// first fix S in the start
	vector <char> ans(n);
	ans[0] = 'S';
	if (s[0] == 'o') {
		ans[n - 1] = 'S';
		ans[1] = 'S';
		func(ans);
		ans[n - 1] = 'W';
		ans[1] = 'W';
		func(ans);
	}
	else {
		ans[n - 1] = 'S';
		ans[1] = 'W';
		func(ans);
		ans[n - 1] = 'W';
		ans[1] = 'S';
		func(ans);
	}
	ans[0] = 'W';
	if (s[0] == 'o') {
		ans[n - 1] = 'S';
		ans[1] = 'W';
		func(ans);
		ans[n - 1] = 'W';
		ans[1] = 'S';
		func(ans);
	}
	else {
		ans[n - 1] = 'S';
		ans[1] = 'S';
		func(ans);
		ans[n - 1] = 'W';
		ans[1] = 'W';
		func(ans);
	}
	cout << -1;
}


Measured memory_bytes: 640
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

line=[b-a,c-b,d-c,e-d,c-a,d-b,e-c,d-a,e-b,e-a]

if max(line)>k:
    print(":(")
else:
    print("Yay!")

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Dice
{
public:
    vector<int> pip; // ì¼kãºÌÚ
    Dice(){
        pip.resize(6);
        pip[0] = 3;
        pip[1] = 2;
        pip[2] = 4;
        pip[3] = 5;
        pip[4] = 1;
        pip[5] = 6;
    }
    void roll(int d){ // ì¼kE¶Éñ]
        int dir[][4] = {{4,2,5,0},{4,3,5,1},{4,0,5,2},{4,1,5,3},{0,3,2,1},{0,1,2,3}};
        int tmp = pip[dir[d][0]];
        for(int i=0; i<3; ++i)
            pip[dir[d][i]] = pip[dir[d][i+1]];
        pip[dir[d][3]] = tmp;
    }
};

vector<vector<vector<Dice> > > dice(4, vector<vector<Dice> >(4, vector<Dice>(4)));
set<int> ret;

void solve(int curr)
{
    if(curr == 27){
        int sum = 0;
        for(int i=0; i<9; ++i)
            sum += dice[3][i/3+1][i%3+1].pip[0];
        ret.insert(sum);
        return;
    }

    int x = curr % 3 + 1;
    int y = curr / 3 % 3 + 1;
    int z = curr / 9 + 1;

    for(int j=0; j<6; ++j){
        if(j < 4)
            dice[x][y][z].roll(0);
        else{
            dice[x][y][z].roll(1);
            if(j == 5)
                dice[x][y][z].roll(1);
        }
        for(int k=0; k<4; ++k){
            dice[x][y][z].roll(4);
            if(dice[x-1][y][z].pip[0] != 0 && dice[x-1][y][z].pip[0] + dice[x][y][z].pip[2] != 7)
                continue;
            if(dice[x][y-1][z].pip[3] != 0 && dice[x][y-1][z].pip[3] + dice[x][y][z].pip[1] != 7)
                continue;
            if(dice[x][y][z-1].pip[5] != 0 && dice[x][y][z-1].pip[5] + dice[x][y][z].pip[4] != 7)
                continue;
            solve(curr+1);
        }
    }
}

int main()
{
    for(int i=0; i<9; ++i)
        dice[0][i/3+1][i%3+1].pip[0] = 0;

    int n;
    cin >> n;

    while(--n >= 0){
        for(int i=0; i<9; ++i){
            int a;
            cin >> a;
            if(a != 0)
                a = 7 - a;
            dice[i%3+1][3-i/3][0].pip[5] = a;
        }
        for(int i=0; i<9; ++i){
            int a;
            cin >> a;
            if(a != 0)
                a = 7 - a;
            dice[i%3+1][0][i/3+1].pip[3] = a;
        }

        ret.clear();
        solve(0);

        if(ret.empty())
            cout << 0 << endl;
        else{
            set<int>::iterator it;
            for(it=ret.begin(); it!=ret.end(); ++it){
                if(it != ret.begin())
                    cout << ' ';
                cout << *it;
            }
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 928
#include <stdio.h>

int main(){
  int H,W,i,j;
  
  while(1){
    scanf("%d %d", &H, &W);
    if( H == 0 && W == 0) break;
    for(i = 1; i <= H; i++){
      for(j = 1; j <= W; j++){ 
	if ( i % 2 == 1 && j % 2 == 1 || i % 2 == 0 && j % 2 == 0){
	  printf("#");
	}else{
	  printf(".");
	}
      }
      printf("\n");
    }
    printf("\n");
  }
  
  return 0;
}
    

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

int main()
{
  int R,D,X2000;
  cin >> R >> D >> X2000;

  for (int i = 0;i < 10;i++)
  {
    X2000 = R*X2000 - D;
    cout << X2000 << endl;
  }
}


Measured memory_bytes: 764
N,Y=map(int,input().split())

x=y=z=0
ans=[-1,-1,-1]
while x<=N:
    y=0
    while x+y<=N:
        if 10000*x+5000*y+1000*(N-x-y)==Y:
            ans=[x,y,N-x-y]
        y+=1
    x+=1

print(*ans)

Measured memory_bytes: 9116
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int w, h, x, y, s1, s2;
    cin >> w >> h >> x >> y;
    cout << double(w)*h / 2 << ' ' << (x*2 == w && y*2 == h) << endl;
    return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr = (input.trim()).split("\n");

const binarySearch = (key, arr, N) => {
  left = 0
  right = N
  while (left < right) {
    mid = Math.floor((left + right) / 2)
    if (key < arr[mid]) {
        right = mid
    } else if (key > arr[mid]) {
        left = mid + 1
    } else {
      return 1
    }
  }
  return 0
}


(function() {
  var N1 = Number(Arr[0])
  var arr1 = Arr[1].split(" ").map(Number);
  var N2 = Number(Arr[2])
  var arr2 = Arr[3].split(" ").map(Number);
  console.log(arr2.map(e => binarySearch(e, arr1, N1)).reduce((a, b) => a + b, 0));
})();



Measured memory_bytes: 34896
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using ll = long long;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
		sort( a.begin(), a.end(), greater<int>() );
    
    ll ans = a[0];

		ll j = 1;
		ll jcount = 0;
    for( int i = 2; i <= n-1; i++) {
      ans += a[j];
      jcount ++;
			if ( jcount == 2 ) {
				j++;
        jcount=0;
      }
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n>>k;
  while(n>0)
  {
  	n-=k;
  	c++;
  }
  c(c);
  
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  cout << n/3 << endl;
}

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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int MAXN = 3000100;

int r1, r2, c1, c2;
ll fac[MAXN], ifac[MAXN];

ll cpow (ll b, int e)
{
    if (e == 0) return 1;
    if (e == 1) return b % MOD;
    ll v = cpow (b, e / 2);
    v = (v * v) % MOD;
    if (e & 1) v = (v * b) % MOD;
    return v;
}

ll inv (ll x)
{
    return cpow (x, MOD - 2);
}

ll gogo (int x, int y)
{
    ll v = (fac[x+y] * ifac[x] % MOD) * ifac[y] % MOD;
    return v - 1;
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> r1 >> c1 >> r2 >> c2;

    fac[0] = 1;
    for (int i = 1; i < MAXN; i++)
        fac[i] = (fac[i-1] * i) % MOD;
    ifac[MAXN-1] = inv (fac[MAXN-1]);
    for (int i = MAXN - 1; i > 0; i--)
        ifac[i-1] = (ifac[i] * i) % MOD;

    r2++;
    c2++;
    ll res = gogo (r2, c2) + gogo (r1, c1) - gogo (r1, c2) - gogo (r2, c1);
    res = (res % MOD + MOD) % MOD;
    cout << res << "\n";
}


Measured memory_bytes: 47104
#include<iostream>

using namespace std;

int main(){
long int a,b,c;
cin>>a>>b>>c;
long int sum=0;
if(c>a){
sum=sum+a;
long int left=c-a;
if(left>b){
sum=sum+2*(b)+1;}
else{
sum=sum+2*(left)+b-left;}}
else{
sum=sum+c+b;}
cout<<sum;
return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long

int main() {
	int N, cnt = 0;
	cin >> N;
	string S;
	cin >> S;
	for (int i = 1;i < N;i++) {
		if (S[i] != S[i - 1])cnt++;
	}
	cout << cnt + 1 << endl;
}

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

using namespace std;

int main()
{
    int n, k, s;
    
    while (scanf("%d %d %d", &n, &k, &s) && n){
        int a = 0;
        
        for (int i = 0; i < 1 << n; i++){
            if (__builtin_popcount(i) != k) continue;
            int tmp = 0;
            for (int j = 0; j < n; j++){
                if (i >> j & 1) tmp += j + 1;
            }
            if (tmp == s) a++;
        }
        printf("%d\n", a);
    }
    
    return (0);
}

Measured memory_bytes: 1192
#include <cstdio>

char str[110][110];
int ct[130];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; ++i)
		scanf("%s", str + i);
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			++ct[str[i][j]];
	bool flag = 1;
	if (n % 2 == 0 && m % 2 == 0) {
		for (int i = 0; i < 130; ++i)
			if (ct[i] % 4)
				flag = 0;
	}
	else if (n % 2 == 0 || m % 2 == 0) {
		int cA = 0;
		for (int i = 0; i < 130; ++i)
			if (ct[i] % 4) {
				if (ct[i] % 4 != 2)
					flag = 0;
				++cA;
			}
		if (m % 2 == 0 && cA > m / 2 || n % 2 == 0 && cA > n / 2) flag = 0;
	}
	else {
		int cA = 0, cB = 0;
		for (int i = 0; i < 130; ++i)
			if (ct[i] % 4) {
				if (ct[i] % 4 == 3) ++cA, ++cB;
				if (ct[i] % 4 == 1) ++cA;
				else ++cB;
			}
		if (cA != 1 || cB > m / 2 + n / 2) flag = 0;
	}
	puts(flag ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 1624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int l[2000][2000],r[2000][2000],u[2000][2000],d[2000][2000];
int main(void){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0;i < h;++i) cin >> s[i];
    
    for(int i = 0;i < h;++i){
        int tmp = 0;
        for(int j = 0;j < w;++j){
            if(s[i][j] == '#') tmp = 0;
            else ++tmp;
            l[i][j] = tmp;
        }
    }
    
     for(int i = 0;i < h;++i){
        int tmp = 0;
        for(int j = w-1;j >= 0;--j){
            if(s[i][j] == '#') tmp = 0;
            else ++tmp;
            r[i][j] = tmp;
        }
    }
    
     for(int j = 0;j < w;++j){
        int tmp = 0;
        for(int i = 0;i < h;++i){
            if(s[i][j] == '#') tmp = 0;
            else ++tmp;
            u[i][j] = tmp;
        }
    }
    
     for(int j = 0;j < w;++j){
        int tmp = 0;
        for(int i = h-1;i >= 0;--i){
            if(s[i][j] == '#') tmp = 0;
            else ++tmp;
            d[i][j] = tmp;
        }
    }
    
    int ans = 0;
    for(int i = 0;i < h;++i){
        for(int j = 0;j < w;++j){
            ans= max(ans,u[i][j]+d[i][j]+r[i][j]+l[i][j]-3);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 66816
/*
* All my senses intensify
* Whenever you and I, we dive
*/
#include<bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define mod 1000000007
#define inf ((ll)1e18)
#define eps 1e-9
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
using namespace std;
int main()
{
    // fast();
    string a , b , s;
    cin>>a>>b;
    ll x , y ;
    cin>>x>>y;
    cin>>s;
    if(a == s) x--;
    else y--;
    cout<<x<<" "<<y<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    int n;
    cin >> n;
    int a=0;
    if(n>=105) a++;
    if(n>=135) a++;
    if(n>=165) a++;
    if(n>=189) a++;
    if(n>=195) a++;
    print(a);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long ull;
ull gcd(ull m, ull n) {
    if (n == 0) return m;
    return gcd(n, m%n);
}

int main() {
    int N;
    cin >> N;

    vector<ull> A(N);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }

    ull ans = A[0];
    for(int i = 0; i < N-1; i++) {
        ans = gcd(ans, A[i+1]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 10010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
char s[maxn];
int k;
ll dp[maxn][5];
int cnt;
ll dfs(int pos, int num, int limit)
{
    if (pos == cnt + 1)
    {
        return num == k;
    }
    if (!limit && dp[pos][num] != -1)
    {
        return dp[pos][num];
    }
    int up;
    if (limit)
    {
        up = s[pos] - '0';
    } else
    {
        up = 9;
    }
    ll res = 0ll;
    repd(i, 0, up)
    {
        if (i == 0)
        {
            res += dfs(pos + 1, num, limit && (i == up));
        } else
        {
            if (num + 1 <= k)
                res += dfs(pos + 1, num + 1, limit && (i == up));
        }
    }
    if (!limit)
    {
        dp[pos][num] = res;
    }
    // cout << pos << " " << num << " " << limit << " " << res << endl;
    return res;
}
int main()
{
    //freopen("D:\\code\\text\\input.txt","r",stdin);
    //freopen("D:\\code\\text\\output.txt","w",stdout);
    gbtb;
    cin >> s + 1;
    cin >> k;
    cnt = strlen(s + 1);
    memset(dp, -1, sizeof(dp));
    cout << dfs(1, 0, 1) << endl;
    return 0;
}




Measured memory_bytes: 640
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        h1: usize,
        m1: usize,
        h2: usize,
        m2: usize,
        k: usize,
    }
    let m1 = m1 + h1 * 60;
    let m2 = m2 + h2 * 60;

    println!("{}", m2 - m1 - k);

}


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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s1 = br.readLine();
        String s2 = br.readLine();
        s1+=s1;
        if(s1.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    String s = r.readLine();
    String sl[] = s.split(" ");

    int n = Integer.parseInt(sl[0]);
    int t = Integer.parseInt(sl[1]);
    
    int m = 9999;
    
    for(int i = 0; i < n; i++)
    {
      s = r.readLine();
      sl = s.split(" ");

      int c = Integer.parseInt(sl[0]);
      int v = Integer.parseInt(sl[1]);
      
      if(v <= t && c < m)
      {
        m = c;
      }
      
    }
    System.out.println(m < 9999 ? m : "TLE");
  }

}

Measured memory_bytes: 22484
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;
import java.awt.*;

public class Main{

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        int itr = 0;
        int cnt = 0;
        long ans = 0;
        PriorityQueue<Integer> card = new PriorityQueue<>(Comparator.reverseOrder());
        for (int i = 0; i < n; i++) {
            card.add(sc.nextInt());
        }
        Pair[] pair = new Pair[m];
        for (int i = 0; i < m; i++) {
            pair[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        Arrays.sort(pair,Comparator.comparing(v -> -v.y)); // good

        while (cnt < n) {
            if (itr == m || (!card.isEmpty() && card.peek() >= pair[itr].y)) {
                /**
                 * not to change
                 */
                cnt++;
                long tmp = card.poll();
                /*
                System.out.println("tmp:" + tmp);
                */
                ans += tmp;
            }else{
                /**
                 * use Math.min(n-cnt, pair[itr].x) - cards
                 * if n-cnt > pair[itr].x, use all x - cards.
                 */
                int used = Math.min(n-cnt, pair[itr].x);
                cnt += used;
                ans += (long)pair[itr].y*(long)used;
                itr++;
            }
            /*
            System.out.println("Nowans:" + ans);
            */
        }
        System.out.println(ans);

        sc.close();
    }

    /**
     * Pair_int
     */
    public static class Pair {
        public int x;
        public int y;

        /**
         * Constructor 
         * Sample Code
         * 
         *      Pair[] pair = new Pair[5];
                for (int i = 0; i < 5; i++) {
                    pair[i] = new Pair(sc.nextInt(), sc.nextInt());
                }
                for (int i = 0; i < 5; i++) {
                    System.out.println(pair[i].x + " " + pair[i].y);
                }
         *
         */
        public Pair(int x, int y){
            this.x = x;
            this.y = y;
        }
        
        public String toString() {
            return "(" + x + ", " + y + ")";
        }


    }
}




Measured memory_bytes: 102976
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var cnt = new long[26];
			for (int i = 0; i < n; i++) {
				string s = Console.ReadLine();
				cnt[s[0] - 'A']++;
			}

			int[] target = new int[]{
				'M' - 'A',
				'A' - 'A',
				'R' - 'A',
				'C' - 'A',
				'H' - 'A',
			};

			long ans = 0;
			for (int i = 0; i < 5; i++) {
				for (int j = 0; j < 5; j++) {
					for (int k = 0; k < 5; k++) {
						if (i < j && j < k) {
							ans += cnt[target[i]] * cnt[target[j]] * cnt[target[k]];
						}
					}
				}
			}

			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 13140
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int a, b;
	while(scanf("%d%d", &a, &b)==2)
	{
		int ans=max(max(a+b, a-b), a*b);
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=(1<<16)+200,N1=20;
int n,a[N1][N1];
int dp[N];

int merge(int x){
    vi v1;
    for(int i=0;i<16;i++){
        if(x & (1<<i)){v1.pb(i);}
    }
    int ans=0;
    for(int i=0;i<v1.size();i++){
        for(int j=i+1;j<v1.size();j++){
            ans+=a[v1[i]][v1[j]];
        }
    }
    return(ans);
}

int find(int mask){
    if(dp[mask]!=-1e18) return(dp[mask]);
    dp[mask]=merge(mask);
    for(int s=mask;s>0;s=(s-1)&mask){    
        if(s==mask) continue;
        dp[mask]=max(dp[mask],find(s)+find(mask^s));
    }
    return(dp[mask]);
}

int32_t main(){
    IOS;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<N;i++) dp[i]=-1e18;
    int x=(1<<n)-1;
    cout<<find((1<<n)-1);
}

Measured memory_bytes: 768
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,P = IL()

print((A*3+P)//2)

Measured memory_bytes: 21232
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int main(){
    while(true){
        int m,f,r;
        cin >> m >> f >> r;
        int ans = 0; //0⇒A 1 ⇒B 2 ⇒C 3⇒D 4 ⇒F
        if(m == -1 && f == -1 && r == -1)break;

        //mは中間試験
        //fは期末試験
        //rは再試験

        if(m == -1 || f == -1){
            ans = 4; //どちらか欠席
        }else if(m + f >= 80){
            ans = 0;
        }else if(m + f >= 65 && m + f < 80){
            ans = 1;
        }else if(m + f >= 50 && m + f < 65){
            ans = 2;
        }else if(m + f >= 30 && m + f < 50){
            if(r >= 50){
                ans = 2;
            }else{
                ans = 3;
            }
        }else{
            ans = 4;
        }

       if(ans == 0){
           cout << "A" << endl;
       }else if(ans == 1){
           cout << "B" << endl;
       }else if(ans == 2){
           cout << "C" << endl;
       }else if(ans == 3){
           cout << "D" << endl;
       }else{
           cout << "F" << endl;
       }
        
    }



}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; typedef long double ld;
const int INF32 = 1e9+10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T, X; cin >> T >> X;
  cout << 1.0*T/X << endl;
}


Measured memory_bytes: 256
def myAnswer(X:int,Y:int) -> int:
   result = []
   for i in range(2):
      tmpX = X
      ans = 0
      if(i==1):
         tmpX *= -1
         ans += 1
      for j in range(2):
         tmpY = Y
         if(j==1):
            tmpY *= -1
            ans += 1
         if(tmpX <= tmpY):
            result.append(ans + (tmpY - tmpX))
   return min(result)
def modelAnswer():
   return
def main():
   X,Y = map(int,input().split())
   print(myAnswer(X,Y))
if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
namespace CsProgramSpace
{
    class Program
    {
        static void Main(string[] args)
        {
            int s = int.Parse(Console.ReadLine());
            int h = s / 3600;
            s -= h * 3600;
            int m = s / 60;
            s -= m * 60;
            Console.WriteLine(string.Format("{0}:{1}:{2}", h, m, s));
        }
    }
}


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

int N;
map<int, int> m;
int main() {
  cin >> N;
  rep(i, N) {
    int A;
    cin >> A;
    m[A]++;
  }

  ll ans = 0;
  for (auto it = m.rbegin(); it != m.rend(); ++it) {
    if ((*it).second >= 4 && ans == 0) {
      ans = ll((*it).first) * ((*it).first);
      break;
    }
    if ((*it).second >= 2) {
      if (ans != 0) {
        ans *= (*it).first;
        break;
      }
      ans = (*it).first;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4992
s = list(input())
k = ["R", "U", "D"]
g = ["L", "U", "D"]
coun = 0
for i in range(1,len(s)+1):
  if i % 2 == 1 and s[i-1] == "L":
    break
  elif i % 2 == 0 and s[i-1]=="R":
    break
  coun += 1

if coun == len(s):
  print("Yes")
else:
  print("No")


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

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

using namespace std;
using ll=long long;

int H,W;
char board[52][52];
int dist[52][52];
int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
int white=0;

int ans=0;
int main(){
  cin >> H >> W;

  //bfs用距離情報初期化
  memset(dist,0,sizeof(dist));
  rep(i,H){
    rep(j,W)dist[i+1][j+1]=-1;
  }

  //盤面初期化と白カウント
  memset(board,'#',sizeof(board));
  rep(i,H){
    rep(j,W) {
      cin >> board[i+1][j+1];
      if(board[i+1][j+1]=='.')white++;
    }
  }




  //bfs
  queue<pair<int,int>> que;
  que.push(make_pair(1,1));
  dist[1][1]=0;
  while(!que.empty()){
    //get remain info
    auto p=que.front();
    //delete from queue
    que.pop();
    //
    rep(i,4){
      int y= p.first+dy[i],x=p.second+dx[i];
      if(dist[y][x]==-1 && board[y][x]=='.') {
      que.push(make_pair(y,x));
      dist[y][x]=dist[p.first][p.second]+1;
      }
    }
  }
  cout << ((dist[H][W]==-1)? -1:white-dist[H][W]-1);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
  	int x,y,z;
  	x=a+b;
  	y=b+c;
  	z=c+a;
  	int ans=z;
  	if(y<ans) ans=y;
  	if(x<ans) ans=x;
  	cout << ans << endl;
    return 0;
}

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

int main ()
{
    int n;
    cin >> n;
    for (int i = 1;i <= n;i++)
    {
        if (i % 3 == 0)
        {
            cout << " " << i;
        }
        else
        {
            int temp = i;
            while(temp)
            {
                if (temp % 10 == 3)
                {
                    cout << " " << i;
                    break;
                }
                temp /= 10;
            }
        }
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
template<typename T> 
struct BIT{
  int n;
  vector<T> bit;
  //1-indexed
  BIT():n(-1){}
  BIT(int n_,T d):n(n_),bit(n_+1,d){}
  
  T sum(int i){
    T s=0;
    for(int x=i;x>0;x-=(x&-x))
      s+=bit[x];
    return s;
  }
  void add(int i,T a){
    if(i==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      bit[x]+=a;
  }
  
  int lower_bound(int w){
    if(w<=0) return 0;
    int x=0,r=1;
    while(r<n) r<<=1;
    for(int k=r;k>0;k>>=1){
      if(x+k<=n&&bit[x+k]<w){
	w-=bit[x+k];
	x+=k;
      }
    }
    return x+1;
  }
  
  T sum0(int i){
    return sum(i+1);
  }
  void add0(int i,T a){
    add(i+1,a);
  }

  T query(int l,int r){
    return sum(r-1)-sum(l-1);
  }

  T query0(int l,int r){
    return sum(r)-sum(l);
  }
};
//END CUT HERE

signed AOJ_DSL2B(){
  int n,q;
  cin>>n>>q;
  BIT<Int> bit(n+100,0);
  for(int i=0;i<q;i++){
    int c,x,y;
    cin>>c>>x>>y;
    if(c) cout<<bit.query(x,y+1)<<endl;
    else bit.add(x,y);
  }
  return 0;
}
/*
  verified on 2017/12/31
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
*/

// lower_bound
signed ARC033_C(){
  int q;
  cin>>q;
  BIT<int> bit(2e5,0);
  while(q--){
    int t,x;
    cin>>t>>x;
    if(t==1) bit.add(x,1);
    if(t==2){
      int k=bit.lower_bound(x);
      bit.add(k,-1);
      cout<<k<<endl;
    }
  }
  return 0;
}
/*
  verified on 2017/12/31
  https://beta.atcoder.jp/contests/arc033/tasks/arc033_3
*/

signed main(){
  AOJ_DSL2B();
  //ARC033_C();
  return 0;
}



Measured memory_bytes: 3576
data = [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]
n = int(input())
print(data[n-1])

Measured memory_bytes: 3060
NL = input().split()
N = int(NL[0])
L = int(NL[1])
apple = []
apple_abs = []
sum = 0
for i in range(1,N+1):
  apple.append(L+i-1)
  apple_abs.append(abs(L+i-1))

apple_min = min(apple_abs)

for i in apple:
  if abs(i) == apple_min:
    continue
  sum += i
print(sum)


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in(),K=in();
	vector<int> D=vecin(K);
	
	int left = N,right = 100000;
	for(int mid=left;mid<right;mid++){
		bool allow = true;
		int v=mid;
		REP(i,5){
			int m=v%10;
			REP(j,K){
				if(D[j]==m && !(!m && D[j]==m && !v)){
					allow = false;
					break;
				}
			}
			v/=10;
		}
		if(allow){
			out(mid);
			return 0;
		}
	}

	return 0;
}


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

using namespace std;
int main()
{
  long long N,K,s,ans1,ans2,ans;
  cin>>N;
  cin>>K;
  ans1=N % K;
  s=abs(ans1-K);
    ans2=s%K;
  ans=min(ans1,ans2);
  cout<<ans;
  return 0;
}

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

const ll INF = 1e18;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> t, v, vv;
    ll sum_t = 0;
    t.resize(n+1);
    v.resize(n+1);
    v[0] = 0;
    t[0] = 0;
    rep(i,n){
        cin >> t[i+1];
        sum_t += t[i+1]*2;
        t[i+1] = sum_t;
    }
    rep(i,n){
        cin >> v[i+1];
        v[i+1] *= 2;
    }
    double sum_l = 0.0;
    v.push_back(0);
    vv = vector<ll>(sum_t + 1, INF);
    vv[0] = 0;
    vv[sum_t] = 0;
    int flag = 1;
    for(ll i = 1; i < sum_t; i++){
        chmin(vv[i], vv[i-1] + 1);
        chmin(vv[i], v[flag]);
        if(i == t[flag]){
            chmin(vv[i], v[flag + 1]);
            flag++;
        }
    }
    for(ll i = sum_t; i > 0; i--){
        chmin(vv[i-1], vv[i] + 1);
    }
    for(ll i = 0; i < sum_t; i++){
        sum_l += (vv[i] + vv[i+1]) / 2.0;
    }
    cout << fixed << setprecision(12) << sum_l * 0.25 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<map>
#include<string.h>
#include<vector>
#include<set>
#include<stdio.h>
#include<math.h>
//#include<algothm>
#include<queue>
using namespace std;
int main()
{
	int A,B,C,X,a=0,b=0,c=0;
	cin>>A>>B>>C>>X;
	for(int i=0;i<=A;i++)
	{
		int k=i*500;
		if(k==X) a++;
		else if(k>X) break;
		else
		for(int j=0;j<=B;j++)
		{ 
			int z=j*100;
			if(z==X-k) b++;
			else if(z>X-k) break;
			else
			for(int n=0;n<=C;n++)
			{
				int m=n*50;
				if(m==X-k-z) c++;
				else if(m>X-k-z) break;
			}
		}
	}
	cout<<a+b+c;
	system("pause");
  return 0;
}

Measured memory_bytes: 504
from sys import stdin
x=int(stdin.readline())
if x<=599:
  print('8')
elif x>=600 and x<=799:
  print('7')
elif x>=800 and x<=999:
  print('6')
elif x>=1000 and x<=1199:
  print('5')
elif x>=1200 and x<=1399:
  print('4')
elif x>=1400 and x<=1599:
  print('3')
elif x>=1600 and x<=1799:
  print('2')
else:
  print('1')

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

int main() {
  int x;
  cin >> x;
  
  if(x == 1000) {
    cout<< 1000 << endl;
    return 0;
  }
  
  for(double i = x; i > 0; i--) {
      for (double j = 2; j <= 12; j++) {
        
        if (pow(i, 1/j) == floor( pow(i, 1/j) ) ) {
          cout << i << endl;
          return 0;
          
        }
      }
    }
}

Measured memory_bytes: 256
n = int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  x = input()
  if x =='AC':
    ac+=1
  if x =='WA':
    wa+=1
  if x =='TLE':
    tle+=1
  if x =='RE':
    re+=1
    
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))


Measured memory_bytes: 9044
#include<bits/stdc++.h>
using namespace std;
int N,Q;
int wf[100][100];
const int INF=1e9;
bool solve(){
    scanf("%d%d",&N,&Q);
    if(N==0&&Q==0)return false;

    fill_n(*wf,10000,INF);
    for(int i=0;i<N;i++)wf[i][i]=0;

    while(Q--){
        int t;
        scanf("%d",&t);
        if(t){
            int a,b,c;
            scanf("%d%d%d",&a,&b,&c);
            a--;b--;
            wf[a][b]=wf[b][a]=min(wf[a][b],c);

            for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                    int vl=wf[i][a]+wf[a][b]+wf[b][j];
                    int vr=wf[i][b]+wf[b][a]+wf[a][j];
                    wf[i][j]=min(wf[i][j],min(vl,vr));
                }
            }
        }
        else{
            int a,b;
            scanf("%d%d",&a,&b);
            a--;b--;
            printf("%d\n",(wf[a][b]!=INF?wf[a][b]:-1));
        }
    }
    return true;
}
int main(){
    while(solve());
    return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

ll digit_sum(ll n, ll b){
    ll res = 0;
    while(n){
        res += n % b;
        n /= b;
    }
    return res;
}

int main(){
    ll n, s;
    cin >> n >> s;
    for(ll b = 2; b * b <= n; b++){
        if(digit_sum(n, b) == s){
            cout << b << endl;
            return 0;
        }
    }
    if(s > n){
        cout << -1 << endl;
        return 0;
    }
    if(s == n){
        cout << s + 1 << endl;
        return 0;
    }
    ll ans = -1;
    for(ll r = s - 1; (s - r) * (s - r) <= n - r && r < s && r < n; r--){
        ll b = (n - r) / (s - r);
        double com = b * 1.0 / n * b;
        if((n - r) % (s - r) == 0 && com > 1 && b > r && n / b + n % b == s){
            ans = b;
        }
    }
    cout << ans << endl;
}

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

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

typedef long long int ll;

const ll INF=(ll)1e18;

int main(){
  string S;
  cin >> S;
  int ans=0;
  REP(i,S.size()/2){
    if(S[i]!=S[S.size()-i-1]){
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
package main

import "fmt"

type edge struct {
	from int
	to   int
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	from1 := make([]int, N)
	toN := make([]int, N)
	var x, y int
	for i := 0; i < M; i++ {
		fmt.Scan(&x, &y)
		if x == 1 {
			from1[y-1]++
		}
		if y == N {
			toN[x-1]++
		}
	}

	found := false
	for i := 0; i < N; i++ {
		if from1[i] != 0 && toN[i] != 0 {
			found = true
			break
		}
	}

	if found {
		fmt.Println("POSSIBLE")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;


int main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  ll inf = 1000 * 1000 * 1000;
  inf *= inf;

  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  ll t = a - b;
  if (k % 2 == 1)
    t *= -1;
  cout << t << endl;
}



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

int main() {
    
    int H,A;
    cin >> H >> A;
    
    if (H % A == 0) {
    cout << H / A << endl;
    }
    
    if (H % A != 0) {
    cout << H / A + 1 << endl;
    }
}


Measured memory_bytes: 256
unittest
{
	assert( [ "3 5 7" ].parse.expand.solve == 10 );
	assert( [ "3 2 9" ].parse.expand.solve == 6 );
	assert( [ "20 20 19" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abt = input.front.split.to!( long[] );
	return tuple( abt[ 0 ], abt[ 1 ], abt[ 2 ] );
}

auto solve( long a, long b, long t )
{
	return t / a * b;
}


Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	M := sc.nextInt()

	fmt.Fprintln(wtr, 48-M)
	wtr.Flush()
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		cout << "x";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int fiveCount = 0;
			int sevenCount = 0;

			int inputCount = 0;
			while (inputCount < 3) {
				int abc = sc.nextInt();

				if (abc == 5) {
					fiveCount++;
				} else if (abc == 7) {
					sevenCount++;
				}
				inputCount++;
			}

			if (fiveCount == 2 && sevenCount == 1) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

int main(){
  int a, b; cin >> a >> b;
  cout << (ll)a*b/gcd(a, b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int A, B;
    cin >> A >> B;
    if (A > 8 || B > 8)
    {
        cout << ":(" << endl;
    }
    else
    {
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 256