akhauriyash/Code-Regression huggingface dataset:
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include "algorithm"


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)
int dx[] = { -1,0,1,0 ,0 }, dy[] = { 0,1,0,-1,0 };
#define nxnycon (0<=nx&&nx<h&&0<=ny&&ny<w) 
#define lo long long int

int n;



int main() {
	cin >> n;
	if (n - (n / 2) * 2) {
		cout << 2 * n;
	}
	else { cout << n; }
	//system("pause");
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include<string>
using namespace std;
int main(){
    unordered_map<string,bool> ump;
    int n;
    string s;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        ump[s]=true;
    }
    cout<<ump.size();
    return 0;
}

Measured memory_bytes: 17692
// ref: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        t: f64,
        x: f64,
    }
    println!("{:.8}", t / x);
}

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

using ll=long long;
using ld=long double;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int ans,x[5];
	for(int i=0;i<5;i++){
		cin>>x[i];
		if(x[i]==0){
			ans=i+1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}


int main(){
	ll n ; cin >> n ;
	ll sum = 0 ;
	vll a(n) ;
	for(int i=0;i<n;i++){
		cin >> a.at(i) ;
		sum += a.at(i) ;
	}
	sort(all(a)) ;
	if(sum%10!=0) cout << sum << endl ;
	else{
		for(int i=0;i<n;i++){
			if(a.at(i)%10!=0){
				cout << sum-a.at(i) << endl ;
				return 0 ;
			}
		}
		cout << 0 << endl ;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define pb(a) push_back(a)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long unsigned int ull;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    int N;
    cin >> N;
    ll a[N];
    REP(i,N){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    ll multi = 1;
    ll limit = 1e18;
    REP(i,N){
        if(multi>limit/a[i] || (multi > sqrt(limit) && a[i] >= sqrt(limit)) || (multi >= sqrt(limit) && a[i] > sqrt(limit)) ){
            cout << -1 << endl;
            return 0;
        }
        multi *= a[i];
    }
    cout << multi << endl;
}

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

int main(){
  int INF = 1000000000;
  int h, w, sy, sx, gy, gx;
  cin >> h >> w >> sy >> sx >> gy >> gx;
  sy--; sx--; gy--; gx--;
  vector<string> g(h);
  rep(i,h) cin >> g[i];
  vvi dist(h, vi(w, INF));
  deque<pair<int,int>> q;
  q.push_back({sy, sx});
  vi v = {1, 0, -1, 0, 1};
  dist[sy][sx] = 0;
  while(!q.empty()){
    int y = q.front().first;
    int x = q.front().second;
    q.pop_front();
    rep(i,4){
      int ny = y + v[i];
      int nx = x + v[i+1];   
      if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue;
      if(g[ny][nx] == '#') continue;
      if(dist[ny][nx] > dist[y][x]){
        dist[ny][nx] = dist[y][x];
        q.push_front({ny, nx});
      }
    }
    for(int i=-2; i<=2; i++){
      for(int j=-2; j<=2; j++){
        int ny = y + i;
        int nx = x + j;
        if(ny < 0 || nx < 0 || ny >= h || nx >= w) continue;
        if(g[ny][nx] == '#') continue;
        if(dist[ny][nx] > dist[y][x] + 1){
          dist[ny][nx] = dist[y][x] + 1;
          q.push_back({ny, nx});
        }
      }
    }
  }
  if(dist[gy][gx] == INF) dist[gy][gx] = -1;
  cout << dist[gy][gx] << endl;
}


Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010, maxm = 100010;
int n, ans, m = 100000, l, r, f[maxm];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &l, &r);
		for (int j = l; j <= r; j++)
			f[j] = 1;
	}
	for (int i = 1; i <= m; i++)
		if (f[i]) ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
//DEEPANSHU RAWAT
//BTECH/10530/18
 
#include<bits/stdc++.h>
#define ull unsigned long long
#define lld long long int
#define infi LLONG_MAX
#define ninfi LLONG_MIN
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define e endl
#define mod 1000000007
using namespace std ;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    string a;
    int ans=INT_MAX;
    int i;
    cin>>s;
    for(i=0;i<s.length()-2;i++)
    {
        a=s.substr(i,3);
        int b=stoi(a);
        ans=min(ans,abs(753-b));
    }
    cout<<ans<<e;

}

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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;

ll lcm(ll x, ll y){ 
    if (x % y == 0) return y;
    else return lcm(y, x%y);
}

ll gcd(ll x, ll y){
    ll l = lcm(x, y);
    return (x*y/l);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll g = gcd(fmax(c, d), fmin(c, d));
    ll rc = a%c, rd = a%d, rcd = a%g;
    ll dif = b-a;
    ll cnt=0;
    if(dif>=c-rc)cnt+=(dif-(c-rc))/c + 1;
    if(dif>=d-rd)cnt+=(dif-(d-rd))/d + 1;
    if(dif>=g-rcd)cnt-=(dif-(g-rcd))/g + 1; 
    if(rc==0)cnt++;
    if(rd==0)cnt++;
    if(rcd==0)cnt--;

    ll ans = dif + 1 - cnt;
    cout << ans << endl;

}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
//const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
ll ans[550][550];
void dfs(ll l, ll r, ll d){
    if(abs(l - r) == 1) return;
    for(ll i = l; i < (l + r) / 2; i++){
        for(ll j = (l + r) / 2; j < r; j++){
            //cout << i << " " << j << endl;
            ans[i][j] = d;
        }
    }
    //cout << "H" << endl;
    dfs(l, (l + r) / 2, d + 1);
    dfs((l + r) / 2, r, d + 1);
}
int main(void){
    ll n;
    cin >> n;

    dfs(0, n, 1);

    for(int i = 0; i < n - 1; i++){
        for(int j = i + 1; j < n; j++){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


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

int main(){
	int n;
	long long int a,b,res = 0,cnt = 0;
	long long int x[100000];
	cin >> n >> a >> b;
	for(int i = 0;i < n;i++) {
		cin >> x[i];
		if(i >= 1 && (x[i] - x[i - 1]) * a < b) {
			res += (x[i] - x[i - 1]) * a;
			cnt++;
		}
	}
	cout << res + b * (n - cnt - 1) << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;


	public class Main {
		
		

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
	        
			int n = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			char[] s = sc.next().toCharArray();
			String[] ret = new String[n];
			
			int tuka = 0;
			int bt = 0;
			
			for(int i=0;i<n;i++) {
				if(s[i]=='a') {
					if(tuka<a+b) {
						ret[i] = "Yes";
						tuka++;
					}else {
						ret[i] = "No";
					}
				}else if(s[i]=='b') {
					bt++;
					if(tuka<a+b&&bt<=b) {
						ret[i] = "Yes";
						tuka++;
					}else {
						ret[i] = "No";
					}
				}else {
					ret[i] = "No";
				}
			}
			
			for(int i=0;i<n;i++) {
				System.out.println(ret[i]);
			}
			
		}
	}


Measured memory_bytes: 52692
#include<bits/stdc++.h>
#define MAX 2000000
using namespace std;

int H,A[MAX+1];

void maxHeapify(int i)
{
    int l,r,largest;
    l=2*i;
    r=2*i+1;

    if(l<=H&&A[l]>A[i])largest=l;
    else largest=i;
    if(r<=H&&A[r]>A[largest])largest=r;

    if(largest!=i)
    {
        swap(A[i],A[largest]);
        maxHeapify(largest);
    }
}

int main()
{
    cin>>H;
    for(int i=1;i<=H;i++)cin>>A[i];
    for(int i=H/2;i>=1;i--)maxHeapify(i);

    for(int i=1;i<=H;i++)
    {
        cout<<" "<<A[i];
    }
    cout<<endl;
 	return 0;
}



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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
//RNG based on mersenne_twister 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

const int N=100005;
ll n,k;
ll dp[102][N],a[102],psum[102][N];
int _runtimeTerror_()
{
	cin>>n>>k;
	ll i,j;
	for(ll i=0;i<n;++i)
		cin>>a[i];
	for(i=0;i<=a[0];++i)
		psum[0][i]=i+1,dp[0][i]=1;
	for(i=a[0]+1;i<=k;++i)
		psum[0][i]=psum[0][i-1];
	for(i=1;i<n;++i)
	{
		for(j=0;j<=k;++j)
		{
			if(j<=a[i])
				dp[i][j]=psum[i-1][j];
			else
				dp[i][j]=psum[i-1][j]-psum[i-1][j-a[i]-1];
			dp[i][j]+=M;
			dp[i][j]%=M;
			if(j==0)psum[i][j]=dp[i][j];
			else psum[i][j]=(psum[i][j-1]+dp[i][j])%M;
		}
	}
	//cout<<psum[0][2]<<endl;
	//cout<<dp[1][2]<<endl;
	cout<<dp[n-1][k];
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	cerr<<"\n"<<_time_;
	return 0;
}


Measured memory_bytes: 158080
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=100010;
ll v[N],f[N],ans[N];
inline ll gi() {
    ll x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,Q,tp=1;
    cin>>n>>Q,v[1]=n;
    for(int i=1;i<=Q;i++) {
	ll x=gi();
	while(x<=v[tp]) --tp;
	v[++tp]=x;
    }
    f[tp]=1;
    for(int i=tp;i;i--) {
	ll p=v[i];
	while(p>v[1]) {
	    int t=upper_bound(v+1,v+i,p)-v-1;
	    f[t]+=p/v[t]*f[i],p%=v[t];
	}
	ans[p]+=f[i];
    }
    for(int i=n;i;i--) ans[i]+=ans[i+1];
    for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
    return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

void solve() {
  int N, Y; cin >> N >> Y;
  Y /= 1000;
  rep(i,Y/10+1) {
    int NY = Y-i*10;
    rep(j,NY/5+1) {
      if (NY-j*5 == N-i-j) {
        printf("%d %d %d\n", i, j, N-i-j);
        return;
      }
    }
  }
  printf("%d %d %d\n", -1, -1, -1);
  return;
}

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


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int dp[2][1024];

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  REP(q, N) {
    memset(dp, 0, sizeof(dp));
    string X, Y;
    cin >> X >> Y;
    int LX = X.size(), LY = Y.size();
    REP(i, LX) REP(j, LY) {
      if (X[i] == Y[j]) {
	dp[(i+1)%2][j+1] = max(dp[i%2][j] + 1, max(dp[(i+1)%2][j], dp[i%2][j+1]));
      } else {
	dp[(i+1)%2][j+1] = max(dp[(i+1)%2][j], dp[i%2][j+1]);
      }
    }
    cout << dp[LX%2][LY] << endl;
  }
  return 0;
}

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

namespace AtCoder.Contest.D
{
	class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			Scanner cin = new Scanner();

			long n = cin.nextLong();

			Console.WriteLine((n - 1) * n / 2);

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return next();
			i = 0;
			return s[i++];
		}

		public int nextInt()
		{
			return int.Parse(next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextInt() + add;
			}
			return Array;
		}

		public long nextLong()
		{
			return long.Parse(next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextLong() + add;
			}
			return Array;
		}

		public double nextDouble()
		{
			return double.Parse(next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 11092
def PF(P):
    PF = dict()
    Po, x = P, 2
    while x < Po ** 0.5:
        i = 0
        while P % x == 0:
            P //= x
            i += 1
        if i > 0:
            PF[x] = i
        x += 1
    return PF

N, P = map(int, input().split())
if N == 1:
    print(P)
elif P <= 3:
    print(1)
else:
    F, ans = PF(P), 1
    for x in list(F.keys()):
        ans *= x ** (F[x] // N)
    print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int n , t;
  	cin >> n >> t;
  	int ans = 9999999;
  	for(int i = 0 ;i < n ;i++){
  		int x , y;
      	cin >> x >> y;
      	if(y <= t)
          ans = min(ans , x);
    }
  	if(ans == 9999999)
      cout << "TLE" << endl;
  	else
      cout << ans << endl;
 	return 0; 
}

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

int main(){
	int a, b;
	for(int i=0; i>=0; i++){
		cin >> a >> b;
		if(a==0 && b==0) break;
		for(int j=0; j<a; j++){
			for(int k=0; k<b; k++){
				if(j==0||k==0||j==a-1||k==b-1)
					cout << "#";
				else
					cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

int p[2000];

int main() {
    int n,m;
    string s;
    while(cin>>n>>m, n|m) {
        memset(p, -1, sizeof(p));
        for(int i=1; i<=n; ++i) p[i-1] = i;
        int now = 0;
        for(int i=0; i<m; ++i) {
            //cout<<"now "<<now<<endl;
            cin>>s;
            if((i+1)%3 == 0 && (i+1)%5 == 0) {
                if(s != "FizzBuzz") p[now] = -1;
            }else if((i+1)%3 == 0) {
                if(s != "Fizz") p[now] = -1;
            }else if((i+1)%5 == 0) {
                if(s != "Buzz") p[now] = -1;
            }else{
                if(atoi(s.c_str()) != i+1) p[now] = -1;
            }

            for(int i=1; i<=n; ++i) {
                if(p[(now+i+n)%n] > 0) {
                    now = (now+i+n)%n;
                    break;
                }
                if(i==n) {
                    p[now] = now+1;
                    break;
                }
            }
        }

        bool first = true;
        for(int i=0; i<n; ++i) {
            if(p[i] > 0) {
                if(!first) printf(" ");
                printf("%d", p[i]);
                first = false;
            }
        }
        puts("");
    }
}

Measured memory_bytes: 960
card = [list(map(int,input().split(' '))) for j in range(3)]
N = int(input())
called = set([int(input()) for i in range(N)])
for x,i in enumerate(card):
    for y,j in enumerate(i):
        if j in called:
            card[x][y] = 0
for i in range(3):
    if sum(card[i])==0:
        print('Yes')
        exit()
    if sum([card[j][i] for j in range(3)])==0:
        print('Yes')
        exit()
if (card[0][0]+card[1][1]+card[2][2])==0 or (card[0][2]+card[1][1]+card[2][0])==0:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 3064
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
A = np.array(A, dtype=int)

print(3 ** N - (1 + (A % 2 == 0)).prod())


Measured memory_bytes: 12508
using System;
using System.Collections.Generic;
using System.Linq;

class Hello
{
    static void Main(string[] args)
    {
        //行数、列数、Kの値を保持する
        var HWK = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();
        var rows = HWK[0];
        var cols = HWK[1];
        var k = HWK[2];
        //表内容をstring型で保持する
        var table = new string[rows];
        for (var cnt = 0; cnt < rows; cnt++)
        {
            table[cnt] = Console.ReadLine();
        }var ans = 0;
        var kCnt = 0;
        //行数 + 1分ループして行の全検索を実施
        //for (var i = 0; i < (rows << 1); i++)
        for (var i = 0; i < (Math.Pow(2,rows)); i++)
        {
            //列数 + 1分ループして列の全検索を実施
            //行列合わせて、最大で2^12回
            //for (var j = 0; j < (cols << 1); j++)
            for (var j = 0; j < Math.Pow(2,cols); j++)
            {
                kCnt = 0;
                //Console.WriteLine($"i = {i},j = {j}");
                for (var y = 0; y < rows; y++)
                {
                    if ((i >> y & 1) == 1)
                    {
                        continue;
                    }

                    for (var x = 0; x < cols; x++)
                    {

                        //Console.WriteLine($"i = {i},y = {y},j = {j},x = {x}");

                        if ((j >> x & 1) == 1)
                        {
                            continue;
                        }
                        if (table[y][x] == '#')
                        {
                            kCnt++;
                        }
                    }
                }
                if (kCnt == k)
                {
                    ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 28496
n = int(raw_input())
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
a = [[0 for i in range(n)] for j in range(n)]
st = [0 for i in range(n)]
time = [0]
g = [0 for i in range(n)]
 
 
def dfs_visit(s):
    st[s] = 1
    time[0] += 1
    d[s] = time[0]
     
    for k in range(n):  
      if a[s][k] == 1 and st[k] == 0:
          dfs_visit(k)
    st[s] ==2
    time[0] += 1
    f[s] = time[0]
 
def main():
    for s in range(n):
        if st[s] == 0:
            dfs_visit(s)
    for s in range(n):
        print'{0} {1} {2}'.format(s+1, d[s], f[s])
 
for i in range(n):
    g = map(int, raw_input().split())
    for j in range(g[1]):
        a[g[0]-1][g[2+j]-1] = 1
 
main()

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;

const bool isT = false;

void sol();

int main() {
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	if (isT) {
		int t; std::cin >> t;
		while (t--) {
			sol();
		}
		return 0;
	}
	sol();
	return 0;
}

void sol() {

	int k; std::cin >> k;
	int a, b; std::cin >> a >> b;
	bool ok = false;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			ok = true;
		}
	}
	if (ok) {
		std::cout << "OK\n";
	}
	else {
		std::cout << "NG\n";
	}

}

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

using namespace std;

typedef long long ll;

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

int main(){
        ll x, y;
        cin>>x>>y;
        ll res=0;
        while(x<=y){
                x*=2;
                res++;
        }
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define mod 1000000007

int n,c;
int d[33][33];
int col[505][505];
int cnt[3][33];

int main(){
  cin>>n>>c;
  rep(i,c)rep(j,c)cin>>d[i][j];
  rep(i,n)rep(j,n){
    cin>>col[i][j];
    col[i][j]--;
  }
  rep(i,n)rep(j,n){
    cnt[(i+j)%3][col[i][j]]++;
  }
  int res=INF;
  rep(x,c)rep(y,c)rep(z,c){
    if(x==y||y==z||z==x)continue;
    int sa=0,sb=0,sc=0;
    rep(i,c){
      if(i!=x)sa+=d[i][x]*cnt[0][i];
    }
    rep(i,c){
      if(i!=y)sb+=d[i][y]*cnt[1][i];
    }
    rep(i,c){
      if(i!=z)sc+=d[i][z]*cnt[2][i];
    }
    minch(res,sa+sb+sc);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 1280
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }


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

	vector<int> X(N);
	for (int i = 0; i < N; i++) cin >> X[i];

	sort(X.begin(), X.end());

	ll ans = INF;
	for (int i = 1; i < 100; i++) {
		ll sum = 0;
		for (int j = 0; j < N; j++) {
			sum += (i - X[j])*(i - X[j]);
		}
		ans = min(ans, sum);
	}

	cout << ans << endl;
}


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

int main(){
  string s, t;
  cin >> s >> t;
  int ans = 0;
  for(int i = 0; i < 3; i++){
    if(s[i] == t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s,t=[],[]
for i in range(n):
    a,b=map(int,input().split())
    s.append(a)
    t.append(b)
s=sorted(s)
t=sorted(t)
if n%2==0:
    print(t[n//2-1]+t[n//2]-s[n//2-1]-s[n//2]+1)
else:
    print(t[n//2]-s[n//2]+1)

Measured memory_bytes: 27100
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> a(n); REP(i, n) cin >> a[i];
  map<int, int> mp;
  REP(i, n) ++mp[a[i]];
  ll ans = 0;
  for (auto pr : mp) ans += 1LL * pr.second * (pr.second - 1) / 2;
  REP(i, n) {
    ans -= 1LL * mp[a[i]] * (mp[a[i]] - 1) / 2;
    ans += 1LL * (mp[a[i]] - 1) * (mp[a[i]] - 2) / 2;
    cout << ans << '\n';
    ans -= 1LL * (mp[a[i]] - 1) * (mp[a[i]] - 2) / 2;
    ans += 1LL * mp[a[i]] * (mp[a[i]] - 1) / 2;
  }
  return 0;
}


Measured memory_bytes: 8320
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]); var wmax = int.Parse(line[1]);
        var vaL = new int[n + 1]; var w = new int[n + 1];
        var dp = new long[n + 1, wmax + 1];
        DataSet(w, vaL);
        for (int i = 0; i < n; i++)
            for (int j = 0; j <= wmax; j++)
                if (j < w[i]) dp[i + 1, j] = dp[i, j];
                else dp[i + 1, j] = Max(dp[i, j], dp[i, j - w[i]] + vaL[i]);
        Console.WriteLine(dp[n, wmax]);
    }
    public static void DataSet(int[] w, int[] vaL)
    {
        for (int i = 0; i < vaL.Length - 1; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            w[i] = int.Parse(line[0]);
            vaL[i] = int.Parse(line[1]);
        }
    }
}

Measured memory_bytes: 88672
// c++ -std=c++14 atcoder.cpp
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());
    int max = k-a[n-1]+a[0];
    for (int i = 0; i < n-1; i++) {
        if (a[i+1]-a[i] > max) {
            max = a[i+1]-a[i];
        }
    }

    cout << k-max << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int a[500000];
  int ans;
  int temp = 0;
  
  cin >> n;

  for(int i = 0;i < n;i++){
	cin >> a[i];
  }

  ans = a[0];
  for(int i = 1;i < n;i++){
	ans = __gcd(ans, a[i]); 
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
// Trained?

#include <iostream>

using namespace std;

int main(){
	int N;
	cin >> N;
	int a[N];
	for (int i = 0; i < N; ++i)
		cin >> a[i];

	int res = 0 ,pre = 1, i = 0;

	while (i < N){
		res++;
		if (a[pre-1] == 2)
			break;
		pre = a[pre-1];
		i++;
	}

	if (i == N)
		cout << -1 << endl;
	else
		cout << res << endl;

	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
using namespace std;

int n,i,j,bisa;
int main (){
	cin >> n;
	bool bisa = false;
	for (int i=0; i<=9; i++){
		for (int j=0; j<=9; j++){
			if (i*j==n){
				bisa=true;
			}
		}
	}
	if (bisa){
		cout << "Yes";
	}else{
		cout << "No";
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
  scanf("%d %d",&a,&b);
  if(a>=13)
  {
      printf("%d\n",b);
  }
  else if(a<6)
  {
      printf("%d\n",0);
  }
  else
  {
      printf("%d\n",b/2);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int N,x,y,used[100010] = {0},u[100010] = {0};
char C[100010];
vector<vector<int>> v(100010);
int dist[100010] = {0},inf = 1e9;

bool ok(int n){
	return (C[n]=='W' xor u[n]%2==1) && used[n]==0;
}

void dfs(int n){
	for(int i=0;i<v[n].size();i++){
		int s = v[n][i];
		if(dist[s]==inf && used[s]==0){
			dist[s] = dist[n]+ok(s);
			dfs(s);
		}
	}
}

int main(){
	cin >> N;
	int count = 0;
	for(int i=0;i<N-1;i++){
		cin >> x >> y;
		u[x]++; u[y]++;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	queue<int> Q;
	for(int i=1;i<=N;i++){
		cin >> C[i];
		if(C[i]=='W') count++;
		if(v[i].size()==1 && C[i]=='B') Q.push(i);
	}
	if(count==0){
		cout << 0 << endl;
		return 0;
	}else if(count==1){
		cout << 1 << endl;
		return 0;
	}
	count = N;
	while(Q.size()){
		int s = Q.front();
		Q.pop();
		used[s] = 1;
		count--;
		for(int i=0;i<v[s].size();i++){
			int t = v[s][i];
			u[t]--;
			if(C[t]=='B' && u[t]==1) Q.push(t);
		}
	}
	int ans = 2*(count-1);
	for(int i=1;i<=N;i++){
		if(ok(i)) ans++;
		dist[i] = inf;
	}
	int a = 0,b = 0,ma = 0,mb = 0;
	dist[1] = ok(1);
	dfs(1);
	for(int i=1;i<=N;i++){
		if(ma<dist[i] && dist[i]!=inf && used[i]==0){
			ma = dist[i];
			a = i;
		}
		dist[i] = inf;
	}
	dist[a] = ok(a);
	dfs(a);
	for(int i=1;i<=N;i++){
		if(mb<dist[i] && dist[i]!=inf && used[i]==0){
			mb = dist[i];
			b = i;
		}
	}
	cout << ans-2*mb << endl;
}

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

using namespace std;

int n, v[200002];
long long ans;

int main()
{
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> v[i];
  if (v[1] != 0) {
    cout << -1;
    return 0;
  }
  for (int i = 2; i <= n; i++) {
    if (v[i] - v[i - 1] > 1) {
      cout << -1;
      return 0;
    }
    if (v[i] == v[i - 1] + 1)
      ans++;
    else
      ans += v[i];
  }
  cout << ans;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
//using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

#define MAX_V 300
struct edge {
	int to;
	int cost;
};

vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P> > que;
	fill(d, d + MAX_V, INF);
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;

		for (int i = 0; i < G[v].size(); ++i) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

void solve_abc_c() {
	ll n, m, ans;

	cin >> n >> m;

	edge e;
	ll a, b;
	vector<P> ab(m);
	rep(i, m) {
		cin >> ab[i].first >> ab[i].second;
		e.cost = 1;
		e.to = ab[i].second;
		G[ab[i].first].push_back(e);
		e.cost = 1;
		e.to = ab[i].first;
		G[ab[i].second].push_back(e);
	}

	ans = 0;
	rep(i, m) {
		a = ab[i].first;
		b = ab[i].second;
		rep(j, G[a].size()) {
			if (G[a][j].to == b) {
				G[a].erase(G[a].begin() + j);
				break;
			}
		}
		rep(j, G[b].size()) {
			if (G[b][j].to == a) {
				G[b].erase(G[b].begin() + j);
				break;
			}
		}
		dijkstra(1);
		rep(i, n) {
			if (d[i + 1] == INF) {
				ans++;
				break;
			}
		}
		e.cost = 1;
		e.to = b;
		G[a].push_back(e);
		e.cost = 1;
		e.to = a;
		G[b].push_back(e);
	}


	cout << ans << "\n";
}

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

	solve_abc_c();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

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

    int a, b;
    cin >> a >> b;
    for (int i = 0; i < max(a, b); ++i)
        cout << min(a, b);
    cout << endl;

    return 0;
}


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

#define ll long long
#define str string

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

vector <ll> v;
ll Y[10000000] = {}, X[10000000] = {},m = 0,a = 0,b = 0,n = 0, x = 0,y = 0,sum = 0;
str H[100][100] = {};
str S,Sa;
bool ans = true;

int findSumOfDigits(int n) {
	int sum = 0;
	while (n > 0) {
		
		sum += n%10;
		n /= 10;
	}
	return sum;
}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
		//Code Line
cin >> S;

if(S[0] != 'A')ans = false;
for(int i = 1;i < S.size();i++){
if(S[i] == 'C' && i >= 2 && i < S.size() - 1)a++;
else if(S[i] >= 'A' && S[i] <= 'Z')ans = false;
}

 if(a == 1)b = 1;
 if(ans && b)cout << "AC" << endl;
 else cout << "WA" << endl;
		//Code Line
return 0; 
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

vi v;
int prime[200005];
void calc(){
    for (int i = 2; i <= 200000; ++i)
    {
        prime[i]=1;
    }
    for (int i = 2; i <= 200000; ++i)
    {
        if(prime[i]){
            v.pb(i);
            for (int j = i*i; j <= 200000; j+=i)
            {
                prime[j]=0;
            }
        }
    }
}
int solve(){
    cin>>n;
    calc();
    int t=lower_bound(all(v),n)-v.begin();
    cout<<v[t];
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 2176
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>

using namespace std;
using ll = long long int; 

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}


ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

ll keta(ll a){
  ll ans = 1;
  while(1){
    if(a/10 > 0){
      ans++;
      a = a/10;
    }
    if(a<10) break;
  }
  return ans;
}

const int MAX = 50;
const int MOD = 1000000007;

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

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

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

int main(void){

    ll sx, sy, tx, ty;
    cin>>sx>>sy>>tx>>ty;

    ll dx = tx - sx;
    ll dy = ty - sy;

    cout<<string(dy, 'U')<<string(dx, 'R');

    cout<<string(dy, 'D')<<string(dx, 'L');

    cout<<'L'<<string(dy+1, 'U')<<string(dx+1, 'R')<<'D';

    cout<<'R'<<string(dy+1, 'D')<<string(dx+1, 'L')<<'U';

    cout<<endl;

    return 0;
}

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

using namespace std;
int main() {
    vector<int>hen;
    int n= 0;
    int k = 0;
    int sum = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> k;
        hen.push_back(k);
    }
    sort(hen.begin(),hen.end());
    int max = hen[n-1];
    for (int j = 0; j < n-1; ++j) {
        sum += hen[j];
    }
    if(sum <= max){
        cout << "No";
    }else{
        cout << "Yes";
    }
    return 0;
}

Measured memory_bytes: 256
def getSPAI bank, year
	1.0 + year * bank[1].to_f / 100
end

def getMPAI bank, year
	(1.0 + bank[1].to_f / 100) ** year
end

def getPAI bank, year
	case bank[2]
	when 1 then
		getSPAI bank, year
	when 2 then
		getMPAI bank, year
	else
		0
	end
end

while (numBank = $stdin.gets.to_i) != 0 do
	year = $stdin.gets.to_i
	max = -1
	ans = -1
	numBank.times do
		bank = $stdin.gets.chomp.split(" ").map(&:to_i)
		pai = getPAI(bank, year)
		if max < pai
			max = pai
			ans = bank[0]
		end
	end
	puts ans
end

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

const int mod = 1e9+7;

long long int dp[41][1<<17];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,X,Y,Z;
	cin>>n>>X>>Y>>Z;
	int target=(1<<(X-1))|(1<<(X+Y-1))|(1<<(X+Y+Z-1));
	int limit=(1<<(X+Y+Z))-1;
	dp[0][0]=1;
	for(int i=0;i<n;i++)
		for(int j=0;j<=limit;j++)
			for(int k=1;k<=10;k++){
				int x=limit&((j<<k)|(1<<(k-1)));
				if((x&target)==target)	continue;
				dp[i+1][x]=(dp[i+1][x]+dp[i][j])%mod;
			}
	long long int ans=1;
	for(int i=1;i<=n;i++)
		ans=ans*10%mod;
	for(int j=0;j<=limit;j++)
		ans=(ans+mod-dp[n][j])%mod;
	cout<<ans<<endl;

}


Measured memory_bytes: 41216
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll N;
vector<ll> A;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    for (ll i = 0; i < N; i++)
    {
        ll a;
        cin >> a;
        a -= (i+1LL);
        A.push_back(a);
    }
    sort(A.begin(),A.end());
}

int solve(){
    vector<ll> AS(N,0);
    AS[0] = A[0];
    for (int i = 0; i < N-1; i++) AS[i+1] = AS[i]+A[i+1];
    ll ans=1e15, r=0;
    for (ll i = 1; i < N; i++)
    {
        r = AS[N-1]-2*AS[i-1]-(N-2*i)*((N-2*i)>=0?A[i]:A[i-1]);
        ans = min(ans,r);
    }
    r = AS[N-1] - N*A[0];    
    ans = min(ans,r);
    r = -AS[N-1] + N*A[N-1];
    ans = min(ans,r);

    cout << ans << endl;    
    return 0;
}   

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


Measured memory_bytes: 3568
#bubble sort
N = int(input())
nums = list(map(int,input().split()))

count = 0 #交換回数
for i in range(N): #先頭が確定するまで調べる（確定したら先頭の次の値が先頭になる）
    j = N-1
    while j > i:
        if nums[j-1] > nums[j]:
            temp = nums[j-1]
            nums[j-1] = nums[j]
            nums[j] = temp
            count = count + 1 #交換したらカウントする
        j = j - 1 #交換したら次の値に移動する

print(' '.join(map(str,nums)))
print(count)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M =1000000007;
//MOD??
long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}
ll mpow(ll x, ll n){ //x^n(mod M) ????pow(x,n)?????????????mod??
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
int main (){
  int i,n,k,d,j,x,cnt=0;
  cin>>n>>k;
  vector <int> okasi(n,0);
  for(i=0;i<k;i++){
    cin>>d;
    for(j=0;j<d;j++){
      cin>>x;
      okasi[x-1]++;
    }

  }
  for(i=0;i<n;i++){
    if(okasi[i]==0){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 3600
import numpy as np

N = int(input())

Ns = [i for i in range(1,N+1)]

counts = []
for N in Ns:
    count = 0
    while N % 2 == 0:
        N //= 2
        count += 1
    counts.append(count)

print(Ns[np.argmax(counts)])

Measured memory_bytes: 26940