akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    int ans = 1;
    rep(i,n){
        if(ans*2 < ans + k){
            ans = ans*2;
        }else{
            ans = ans + k;
        }
    }
    cout << ans << 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);
		int r = sc.nextInt();

		String game;
		if(r<1200)game = "ABC";
		else if(r<2800)game = "ARC";
		else game = "AGC";
		System.out.println(game);
	}
}

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

using namespace std;

/**/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define wt(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define wt(x...)
#endif
/**/

#define LL long long
const int MAXN = 212345;
const int INF  = 0x3f3f3f3f;

LL cnt[MAXN];
std::vector<int> g[MAXN];

int vis[MAXN];

void dfs (int u) {

	vis[u] = 1;

	for (int v : g[u]) {
		// wt (u, v, cnt[u], cnt[v]);

		if (!vis[v]) {
			cnt[v] += cnt[u];
			dfs (v);
		}
	}	
}


int main () {

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

	for (int i = 1, a, b; i < n; ++i) {
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}

	while (q--) {
		int p, x;
		scanf("%d %d", &p, &x);
		cnt[p] += x;
	}


	dfs (1);

	for (int i = 1; i <= n; ++i) {
		printf("%lld%c", cnt[i], " \n"[i == n]);
	}


	return 0;
}



Measured memory_bytes: 22272
s = input()

former = s[0:2]
latter = s[2:4]

def is_month(string):
	number = int(string)
	if 1 <= number <= 12:
		return True
	else:
		return False

if is_month(former) and not is_month(latter):
	print('MMYY')
elif not is_month(former) and is_month(latter):
	print('YYMM')
elif is_month(former) and is_month(latter):
	print('AMBIGUOUS')
else:
	print('NA')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
string S;
int a, b, c;
int main() {
	cin >> S;
	for (int i = 0; i <= S.size() / 2; i++) {
		if (i > 0) {
			a = stoi(S.substr(0, i));
		}
		else {
			a = 0;
		}
		if (i < S.size()) {
			if (S[i] == '0') { 
				goto E; 
			}
			b = stoi(S.substr(i, S.size() - i));
		}
		else {
			b = 0;
		}
		if (abs(a - b) % 2 == 0 && a <= b) {
			c++; 
		}
	E:;
	}
	cout << c << endl;
	return 0;
}

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

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  string ans = "NO";
  for(int i=1;i<=B;i++){
    //cout<<A*i+C<<endl;
    if((A*i+C)%B==0){
      ans="YES";
      break;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,m,u;
	scanf("%d %d %d",&n,&m,&u);
	if(u*2>=m-n+1)
	{
		for(i=n;i<=m;i++)
		{
			printf("%d\n",i);
		}
	}
	else
	{
		for(i=n;i<n+u;i++)
		{
			printf("%d\n",i);
		}
		for(i=m-u+1;i<=m;i++)
		{
			printf("%d\n",i);
		}
	}
	return 0;
} 

Measured memory_bytes: 256
D=int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
A = []
for i, c in enumerate(C):
    A.append((i, c))
A.sort(key=lambda x: x[1])
for i in range(D):
    j, c = A[i%26]
    print(j+1)

Measured memory_bytes: 9404
#include <stdio.h>
#include <stdlib.h>

#define LEN 12

int
main(void)
{
    char line1[LEN];
    char line2[LEN];
    char *p;
    int a, b, i;

    p = &line1[0];

    fgets(line1, LEN, stdin);
    
    while(*p != ' ') {
        p++;
    }
    *p = '\0';
    a = atoi(line1);
    b = atoi(++p);

    fgets(line2, LEN, stdin);
    p = &line2[0];

    for(i = 0; i < a; i++, p++ ) {
        if ( *p < '0' || *p > '9' ) {
            printf("No\n");
            exit(0);
        }
    }
    if ( *p++ != '-' ) {
        printf("No\n");
        exit(0);
    }
    for(i = 0; i < b; i++, p++ ) {
        if ( *p < '0' || *p > '9' ) {
            printf("No\n");
            exit(0);
        }
    }
    
    printf("Yes\n");
    exit(0);
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];
    double ave = accumulate(v.begin(), v.end(), 0.0) / n;
    rep(i, n) v[i] = abs(v[i] - ave);
    double target = *min_element(v.begin(), v.end());
    int f = distance(v.begin(), find(v.begin(), v.end(), target));
    cout << f << endl;

}


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

using namespace std;

const int MAX_N=1e5+10;
int x[MAX_N];
vector <int> a,b,c;

int main()
{
    //INPUT
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> x[i];
    }
    //SOLVE
    for(int i=0;i<n;i++)
    {
        if(x[i]%4==0)
        {
            a.push_back(x[i]);
        }
        else if(x[i]%4==2)
        {
            b.push_back(x[i]);
        }
        else
        {
            c.push_back(x[i]);
        }
    }
    bool ans=0;
    if(b.size()>0 && c.size()<=a.size())
    {
        ans=1;
    }
    if(b.size()==0 && c.size()<=a.size()+1)
    {
        ans=1;
    }
    //SOLVE
    cout << (ans ? "Yes":"No");
}


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

#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define w while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

int main()
{
	FASTIO;
	ll i,j,k,x,sum=0;
	cin>>x;
	for(i=1;i<=x;i++)
    {
        for(j=1;j<=x;j++)
        {
            for(k=1;k<=x;k++)
                sum=sum + __gcd(__gcd(i, j), k);
        }
    }
    cout<<sum;


}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
// ==================================================
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,a,b) for(i64 i=(int64_t)(a);i<(int64_t)(b);i++)
#define repn(i,n) rep(i,0,n)
#define din(t, ...) t __VA_ARGS__;_din(__VA_ARGS__)
#define v(t,n) vector<t> n
void _din() {}
void dout() { cout << endl; }
template <typename T, typename ... Args> inline void _din(T& head, Args& ... rest) { cin >> head; _din(rest...); }
template <typename T, typename ... Args> inline void dout(T head, Args ... rest) { cout << head; if (sizeof...(rest)) cout << ' '; dout(rest...); }
template <typename T>inline void qsortv(vector<T>& v) { qsort(v.data(), v.size(), sizeof(T), [](const void*a, const void*b)->int {if ((*(T*)a) < (*(T*)b))return -1; if ((*(T*)a) == (*(T*)b))return 0; return 1; }); }
template <typename T, typename F>inline void qsortv(vector<T>& v, F func) { qsort(v.data(), v.size(), sizeof(T), func); }
template <typename T>inline void sortv(vector<T>& v) { sort(v.begin(), v.end()); }
// ==================================================
struct P
{
	int num;
	int count;
	bool operator<(const P& o)
	{
		if (count > o.count) return true;
		return false;
	}
};
int main()
{
	din(int, n);
	map<int, int> odd, even;
	repn(i, n)
	{
		din(int, f);
		if (i % 2)	odd[f]++;
		else even[f]++;
	}
	vector<P> oddv, evenv;
	for (auto i : odd) oddv.push_back(P{ i.first,i.second });
	sort(oddv.begin(), oddv.end());
	for (auto i : even) evenv.push_back(P{ i.first,i.second });
	sort(evenv.begin(), evenv.end());
	int mc = 0;
	rep(i, 2, oddv.size()) mc += oddv[i].count;
	rep(i, 2, evenv.size()) mc += evenv[i].count;
	int o1 = oddv.size() > 1 ? oddv[1].count : 0;
	int e1 = evenv.size() > 1 ? evenv[1].count : 0;
	if (oddv[0].num == evenv[0].num) mc += min(evenv[0].count + o1, e1 + oddv[0].count);
	else mc += o1 + e1;
	dout(mc);
}

Measured memory_bytes: 6136
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(register int (i)=(a);(i)<=(b);++(i))
#define of(i,a,b) for(register int (i)=(a);(i)>=(b);--(i))
#define rd read()
#define maxn 500001
#define ll long long
#define fre(a) freopen("a.in","r",stdin);freopen("a.out","w",stdout);
const int p=998244353;
int read() {int x=0,f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();return x*f;}
void print(int x) { if(x<0){putchar('-');x=-x;}if(x>9)print(x/10);putchar(x%10+'0');}
int qp(int a, int  b) {int ans = 1;for(; b; b >>= 1, a *= a, a %= p) if(b & 1) ans *= a, ans %= p;return ans % p;}
char a[2][2];
int main() {
    fo(i,0,2)
    fo(j,0,2)
    {
    	cin>>a[i][j];
	}
	cout<<a[0][0]<<a[1][1]<<a[2][2];
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define index_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIndex find_by_order
#define indexOf order_of_key
#define MOD 1000000007
#define MAX 200005

int dp[MAX];

void solve() {
    string x, y;
    cin>>x>>y;
    x += y;
    int k = stoi(x);
    int term = sqrtl(k);
    if(sqrtl(k) == (double)(term)){
        cout<<"Yes"<<endl;
    }else cout<<"No"<<endl;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
N=int(input())
S = input()
from itertools import accumulate
x = list(accumulate([1 if c=="E" else 0 for c in S]))
if S[0] == "E":
    cnt = N-x[N-1]
else:
    cnt = x[N-1]
if S[N-1] == "E":
    cnt = min(cnt, N-x[N-1])
else:
    cnt = min(cnt, x[N-1])
for i in range(1,N-1):
    if S[i] == "E":
        left = i-x[i-1]
        right = x[N-1]-x[i]
    else:
        left = x[i-1]
        right = N-x[i+1]
    cnt = min(cnt, left+right)
print(cnt)

Measured memory_bytes: 17996
parseInt(x) = parse(Int,x)

function main()
  N = parseInt(readline())
  A = map(parseInt, split(readline()))
  B = zeros(Int,N)
  for i = 1:N
    B[A[i]] = i
  end
  for i = 1:N
  i != N ? print(B[i]," ") : println(B[i])
  end
end

main()

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

using namespace std;

int main(){
  
  int N,T,A,ans;
  int H[1000];
  double temp,tempa=100000;
  
  
  
  cin>>N>>T>>A;
  
  for(int i=0;i<N;i++){
    cin>>H[i];
    temp=T-H[i]*0.006;
      
      if(tempa>abs(temp-A)){
        tempa=abs(temp-A);
        ans=i+1;
      }
        
  }
  
  cout<<ans<<endl;
}
  
  
  

Measured memory_bytes: 256
#[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! {
        n: usize,
        h: [i32; n],
    }
    let mut answer = 0;
    let mut highest = 0;
    for i in h {
        if highest <= i {
            highest = i;
            answer += 1;
            continue;
        }
    }

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



Measured memory_bytes: 4352
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int r,g; cin >> r >> g;
    cout << 2*g-r << endl;
    return 0;
}

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

using namespace std;

int main()
{
    // 整数の入力
    long long N,colors,beforeType,i;
    string S1,S2;
    vector<long long> A;
    cin >> N;
    cin >> S1;
    cin >> S2;
    beforeType = -1;

    if (S1[0] == S2[0]){
        colors = 3;
        beforeType = 1;
        i = 1;
    }else{
        colors = 6;
        beforeType = 2;
        i = 2;
    }

    for (;i<N;i++){
        if (S1[i] == S2[i]){
            if (beforeType == 1){
                colors = (colors * 2)% 1000000007;
            }else{
                colors = colors;
            }
            beforeType = 1;
        }else{
            if (S1[i] == S1[i-1]){
                if (beforeType == 1){
                    colors = (colors * 2) %1000000007;
                }else{
                    colors = (colors * 3)% 1000000007;
                }
                beforeType = 2;
            }
        }
    }

    cout << colors << 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);
        int nbim = sc.nextInt();
        while(nbim-- > 0) {
            int gx = sc.nextInt();
            int gy = sc.nextInt();
            int[][] dp = new int[gy+2][gx+2];
            boolean[][][] hasTabis = new boolean[gy+2][gx+2][2];
            int p = sc.nextInt();
            
            for (int i = 0; i < p; i++) {
                int x = sc.nextInt() + 1;
                int y = sc.nextInt() + 1;
                int x2 = sc.nextInt() + 1;
                int y2 = sc.nextInt() + 1;
                hasTabis[Math.max(y, y2)][Math.max(x, x2)][x != x2 ? 0 : 1] = true;
            }
            dp[0][1] = 1;
            for (int i = 1; i < gy + 2; i++) {
                for (int j = 1; j < gx + 2; j++) {
                    dp[i][j] = (hasTabis[i][j][1] ? 0 : dp[i-1][j]) + (hasTabis[i][j][0] ? 0 : dp[i][j-1]);
                }
            }
            System.out.println(dp[gy+1][gx+1] == 0 ? "Miserable Hokusai!" : dp[gy+1][gx+1]);
            
        }
                
    }

}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int len = s.length(), ans = 0;
	for (int i = len - 1; i >= 0; --i) {
		int d = s[i] - '0';
		if (d >= 6) {
			ans += 10 - d;
			if (i) s[i - 1]++;
			else ans++;
		}
		if (d <= 4) {
			ans += d;
		}
		if (d == 5) {
			ans += 5;
			if (i && s[i - 1] - '0' >= 5) s[i - 1]++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1412
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  // 入力
  ll D; cin >> D;
  ll N = 26;
  vector<ll> c(N); rep(i,N) cin >> c[i];

  vector<vector<ll> > s(D , vector<ll>(N));
  rep(i,D) rep(j,N) cin >> s[i][j];

  rep(i,D){
    ll choice = 0;
    ll tmp = 0;
    rep(j,N){
      if(tmp < s[i][j]){
        choice = j;
        tmp = s[i][j];
      }
    }
    cout << choice + 1 << endl;
  }

}


Measured memory_bytes: 3708
#include <iostream>
using namespace std;
int main(){
  int mem ,student[31]={};
  for( int i=0 ; i<28 ; i++ ){
    cin >> mem;
    student[mem] = 1;
  }

  for( int i=1 ; i<=30 ; i++ ){
    if( student[i] == 0 ){
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
signed main(){
    int n , m , ans=1;
    cin>>n>>m;
    for(int i=1;i*i<=m;i++){
        if(m%i == 0){
            if(i >= n){
                ans=max(ans,m/i);
            } if(m%(m/i) == 0 && m/i >= n){
                ans=max(ans,i);
            }
        }
    }
    
    cout<<ans<<endl;
    return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define dump(x) cerr << #x << "=" << x <<endl
#define gcd __gcd
#define popcount __builtin_popcountll
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);

void solve(){
	int N; cin >> N;
	vector<string> S(N);
	rep(i, N) cin >> S[i];
	map<string, int> mp;
	each(si, S) {
		mp[si]++;
	}
	int mf = 0;
	each(p, mp) {
		mf = max(mf, p.second);
	}
	each(p, mp) {
		if (p.second == mf) {
			cout << p.first << endl;
		}
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}

Measured memory_bytes: 25472
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;

ll N,D,Q;
ll d[500500];
ll query[500500];
ll dist[500500];
ll B[500500];
bool one_exist[500500];
int main(){
  cin >> N >> D;
  rep(i,N){
    cin >> d[i];
  }
  cin >> Q;
  rep(i,Q){
    cin >> query[i];
    query[i]--;
  }
  dist[0] = D;
  rep(i,N){
    dist[i+1] = min(dist[i],abs(dist[i] - d[i]));
  }
  B[N] = 1;
  for(int i=N-1;i>=0;i--){
    if(B[i+1] <= d[i]/2){
      B[i] = B[i+1];
    }
    else B[i] = B[i+1] + d[i];
  }
  rep(i,N+1){
    cerr << B[i] << endl;
  }
  rep(i,N+1){
    cerr << dist[i] << endl;
  }
  rep(i,Q){
    ll pos = query[i];
    if(dist[pos] >= B[pos+1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}


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

using namespace std;

void solve() {
    long long n; cin >> n;
    long long ans = (n / 500) * 1000;
    n %= 500;
    ans += (n / 5) * 5;
    cout << ans;
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 256
n, a, b = map(int, input().split())
MOD = 10**9 + 7
ans = pow(2, n, MOD)
ans -= 1 # select no flowers

def ncr(n, r, MOD):
  res = 1
  for i in range(r):
    res = res*(n-i)%MOD
  
  f = [1]*(r+1)
  inv = [1]*(r+1)

  for i in range(r):
    f[i+1] = f[i]*(i+1)%MOD
  
  inv[r] = pow(f[r], MOD-2, MOD)
  
  for i in range(r, 0, -1):
    inv[i-1] = inv[i]*i%MOD
    
  return res*inv[r]%MOD
    
ans -= ncr(n, a, MOD)
ans -= ncr(n, b, MOD)

print(ans%MOD)

Measured memory_bytes: 45040
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;

  vector<int> d(N+1, 0);
  bitset<105> db;
  REP(ii, N) db.set(ii+1);

  int tmp;
  REP(ii, K) {
    cin >> d[ii];
    REP(jj, d[ii]) {
      cin >> tmp;
      db.reset(tmp);
    }
  }
  cout << db.count() << endl;
  return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	unordered_map<long long, int> mp;
	
	cin >> N;
	for(int i = 1; i <= N; i++){
		long long a;
		cin >> a;
		if(mp.count(a) == 0){
			mp[a] = 1;
		}
		else{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 8520
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;

int n, m;
char s1[55][55], s2[55][55];
bool check(int x, int y)
{
	for(int i = 1; i <= m; i++)
	{
		for(int j = 1; j <= m; j++)
		{
			if(s1[x + i - 1][y + j - 1] != s2[i][j])
				return 0;
		}
	}
	return 1;
}

int main()
{
	while(scanf("%d %d", &n, &m) != EOF)
	{
		bool flag = 0;
		for(int i = 1; i <= n; i++)
			for(int j = 1; j <= n; j++)
				scanf(" %c", &s1[i][j]);
		for(int i = 1; i <= m; i++)
			for(int j = 1; j <= m; j++)
				scanf(" %c", &s2[i][j]);
		for(int i = 1; i <= n; i++)
		{
			for(int j = 1; j <= n; j++)
			{
				if(s1[i][j] == s2[1][1])
				{
					if(check(i, j))
					{
						flag = 1;
						i = j = n + 1;
					}
				}
			}
		}
		if(flag) printf("Yes\n");
		else printf("No\n");
		memset(s1, 0, sizeof(s1));
		memset(s2, 0, sizeof(s2));
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll arr[200000];

int n;
ll func(int b){
	ll res = 0;
	for(int i = 0; i < n; i++){
		res+=abs(arr[i]-(b+i));
	}
	return res;
}

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

	vector<ll> B(n);
	for(int i = 0; i < n; i++) B[i] = arr[i] - i;
	sort(B.begin(),B.end());
	
	ll x = B[n/2];
	cout<<func(x);

}

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

int main(){
  vector<int> v{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int i;
  cin >> i;
  cout << v[i - 1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>

using namespace std;

typedef pair<int, int> ii;

#define fi first
#define se second
#define pb push_back
#define sqr(x) ((x)*(x))

const char* fin = "BE.inp";
const char* fon = "";

#define oo (int) (1e9+7)
#define maxn (int) (1e5+5)

struct node{
    int prefix_cnt;
    bool isEnd;
    struct node *child[30];
};

node *trie;
int n, q, k;
int cnt[maxn][30][30], Greater[30][30], cntPrefix[maxn];
string s[maxn], permu;

void initTrie(){
    trie = new node();
    trie->prefix_cnt = 0;
    trie->isEnd = false;
}

void Insert(string t){
    node *cur = trie;
    ++cur->prefix_cnt;

    for(int i = 0; i < t.size(); ++i){
        int ch = t[i] - 'a';
        if (cur->child[ch] == NULL) cur->child[ch] = new node();
        cur = cur->child[ch];
        ++cur->prefix_cnt;
    }
    cur->isEnd = true;
}

void cal(int k){
    int tmp = 0;
    node *cur = trie;
    for(int i = 0; i < s[k].size(); ++i){
        int ch = s[k][i] - 'a';
        if (cur->child[ch] == NULL) return;
        for(int j = 0; j <= 25; ++j) if (ch != j && cur->child[j] != NULL) cnt[k][ch][j] += cur->child[j]->prefix_cnt;
        cur = cur->child[ch];
        if (cur->isEnd) ++cntPrefix[k];
    }
}

void init(){
    for(int i = 1; i <= n; ++i) cal(i);
}

void sol(){
    int res = cntPrefix[k];
    memset(Greater, 0, sizeof(Greater));
    for(int i = 0; i < permu.size(); ++i) {
        int x = permu[i] - 'a';
        for(int j = i + 1; j < permu.size(); ++j) {
            int y = permu[j] - 'a';
            Greater[y][x] = 1;
        }
    }

    for(char i = 'a'; i <= 'z'; ++i){
        int x = i - 'a';
        for(char j = 'a'; j <= 'z'; ++j){
            int y = j - 'a';
            if (Greater[x][y]) res += cnt[k][x][y];
        }
    }
    cout << res << '\n';
}

void inp() {
    initTrie();

    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> s[i];
        Insert(s[i]);
    }

    init();

    cin >> q;
    for(int i = 1; i <= q; ++i){
        cin >> k;
        cin >> permu;
        sol();
    }
}

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //freopen(fin,"r",stdin);freopen(fon,"w",stdout);
    inp();
    return 0;
}


Measured memory_bytes: 387840
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(){
	
	int a[10], b[10];
	
	for(int i = 0; i < 10; i++){
		cin >> a[i];
	}
	
	for(int i = 0; i < 10; i++){
		cin >> b[i];
	}
	
	sort(a, a + 10);
	sort(b, b + 10);
	
	printf("%d %d\n", (a[7] + a[8] + a[9]), (b[7] + b[8] + b[9]));
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  cin>>n>>k;
  set<int> s;
  while(k--){
    int d; cin>>d;
    while(d--){
      int a;
      cin>>a;
      s.insert(a);
    }
  }
  cout<<n-s.size();
  return 0;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();
		
		if(b - a == c - b) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 35592
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
print(100 ** a * b if b != 100 else 100 ** a * (b + 1))


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // int times = Integer.parseInt(sc.nextLine());
        // int bit = 0;

        int x1 = Integer.parseInt(sc.nextLine());
        String s = sc.nextLine();
        int x2 = Integer.parseInt(sc.nextLine());

        char c1 = s.charAt(x2 - 1);
        char c2;

        String a = "";

        for (int i = 0; i < x1; i++) {
            c2 = s.charAt(i);

            if (c2 == c1) {
                a = a + c2;
            } else {
                a = a + '*';
            }

        }

        System.out.println(a);
        sc.close();
    }
}


Measured memory_bytes: 21972
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <list>
#include <string>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;

int main()
{
    int N, Q;
    string S;

    cin >> N >> Q >> S;

    int total = 0;
    int m[1000000];
    for(int i = 1; i < S.size(); i++) {
        if (S[i - 1] == 'A' && S[i] == 'C') {
            total++;
        }
        m[i] = total;
    }

    REP(i, Q){
        int l, r;
        cin >> l >> r;

        int ret;
        if (l == 1) ret = m[r-1];
        else ret = m[r-1] - m[l-1];

        //if (r < N && S[r-1] == 'A' && S[r] == 'C') ret--;
        //if (r > 2 && S[l-3] == 'A' && S[l-2] == 'C') ret--;

        cout << ret << endl;
    }
}

void cheatsheet()
{
    // loop
    // vector<int> vec(10);
    vector<int> vecloop;
    REP(i, 10)
    {
        vecloop.push_back(i);
    }

    // swap
    int a = 1;
    int b = 5;
    swap(a, b); // -> a = 5, b = 1

    // sort
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(arr, arr + 9, greater<int>()); // 9 8 7 6 5 4 3 2 1

    // lower
    vector<int> vec(arr, end(arr));
    sort(vec.begin(), vec.end());
    cout << lower_bound(vec.begin(), vec.end(), 2)[0]; // 2

    // map
    map<Pll, ll> m;
    m[Pll(10, 100)] = 100;
}

Measured memory_bytes: 3456
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N+1];
    int[] b = new int[N+1];
    int[] c = new int[N+1];
    for (int i = 1; i <= N; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
      c[i] = sc.nextInt();
    }
    // 0 = a
    // 1 = b
    // 2 = c
    int[][] dp = new int[N+1][3];
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    for(int i = 1; i <= N; i++) {
      dp[i][0] = a[i] + Math.max(dp[i-1][1], dp[i-1][2]);
      dp[i][1] = b[i] + Math.max(dp[i-1][0], dp[i-1][2]);
      dp[i][2] = c[i] + Math.max(dp[i-1][0], dp[i-1][1]);
    }
    System.out.println(Math.max(dp[N][0], Math.max(dp[N][1], dp[N][2])));
  }
}

Measured memory_bytes: 93972
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define wuyt main
typedef long long ll;
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
//#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();
if(c == '-')Nig = -1,c = getchar();
while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
return Nig*x;}
#define read read()
const ll inf = 1e15;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
int num[maxn];
map<string,int>mp;
int main()
{
    /**int n=read;
    int flag=1;
    for(int i=1;i<=n;i++)
    {
        num[i]=read;
        if(num[i]%2==0){
            if(num[i]%3!=0&&num[i]%5!=0)
                flag=0;
        }
    }
    if(flag==0) printf("DENIED\n");
    if(flag) printf("APPROVED\n");**/
    ll n;
    ios_base::sync_with_stdio(false);
    cin>>n;
    for(ll i=0;i<n;i++)
    {
        ///scanf("%s",ss);
        ///getchar();
        string ss;
        cin>>ss;
        mp[ss]++;
    }
    int maxx=-1;
    for(const auto& x : mp){
        int temp=x.second;
        if(temp>maxx) maxx=temp;
    }
    for(auto it=mp.begin();it!=mp.end();it++){
        if(it->second==maxx)
            cout<<it->first<<endl;
    }
	return 0;
}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
using vi = vector<int>;
using vll = vector<ll>;
const ll INF = 1LL<<60;

int main(){
  string s,t; cin >> s >> t;
  bool flg = false;
  for(int i = 0; i < s.size(); i++){
    if(s == t) flg = true;
    s = s.back() + s.substr(0,s.size()-1);
  }
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include<stdio.h>
#include<string.h>
#include <algorithm>

using namespace std;

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

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

std::string cons_s[] = {"resare", "remaerd", "maerd", "esare"};

int main() {
  std::string s;
  std::cin >> s;
  std::reverse(s.begin(), s.end());
  bool found = true;
  while (found) {
    found = false;
    for (int i = 0; i < 4; i++) {
      int index = s.find(cons_s[i]);
      if (index == 0) {
        s.erase(0, cons_s[i].length());
        found = true;
      }
    }
    if (s.length() == 0) {
      std::cout << "YES" << "\n";
      break;
    }
  }
  if (!found) {
    std::cout << "NO" << "\n";
  }

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
long long a[200002];
int main()
{
    long long n,l=-2e9,r=2e9,ff=0;
    std::cin>>n;
    for(long long i=1;i<=n;i++){std::cin>>a[i];ff+=a[i];}
    while(l<=r)
    {
        long long mid=(l+r)/2;
        long long gg=0,gg1=0;

        for(long long i=1;i<=n;i++)
        {
            gg+=std::abs(a[i]-i-mid);
        }

        for(long long i=1;i<=n;i++)
        {
            gg1+=std::abs(a[i]-i-mid-1);
        }

        ff=std::min(ff,gg);
        ff=std::min(ff,gg1);

        if(gg>gg1)l=mid+1;
        else r=mid-1;
    }

    std::cout<<ff<<std::endl;

}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] L = new int[N];
            for (int i = 0; i < N; i++) {
                L[i] = in.nextInt();
            }

            int sum = 0;
            int max = 0;
            for (int i = 0; i < N; i++) {
                sum += L[i];
                max = Math.max(max, L[i]);
            }
            sum -= max;

            System.out.println(sum > max ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(){
  ll x = 3;
  vector<vector<ll>> vec(x,vector<ll>(x,0)),check(x,vector<ll>(x,0));

  rep(i,3){
    rep(j,3){
      cin >> vec[i][j];
    }
  }
  ll n;
  cin >> n;
  rep(i,n){
    cin >> t1;
    rep(i,x){
      rep(j,x){
        if(vec[i][j] == t1){
          check[i][j] = 1;
        }
      }
    }
  }
  bool can = false;
  rep(i,x){
    bool ch = true;
    rep(j,x){
      if(!check[i][j]){
        ch = false;
      }
    }
    if(ch){
      can = true;
    }
  }
  rep(j,x){
    bool ch = true;
    rep(i,x){
      if(!check[i][j]){
        ch = false;
      }
    }
    if(ch){
      can = true;
    }
  }

  if(check[0][0] && check[1][1] && check[2][2]){
    can = true;
  }
  if(check[2][0] && check[1][1] && check[0][2]){
    can = true;
  }
  if(can){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    vector<pair<int, int>> arr(len);
    for(int i = 0; i < len; i++) {
        int a, b;
        cin >> a >> b;
        arr[i] = {a + b, a - b};
    }
    sort(arr.begin(), arr.end());
    int ans = len;
    vector<bool> use(len, true);
    for(int i = 1; i < len; i++) {
        int prev = i - 1;
        while(!use[prev])
            prev--;
        if(arr[i].s < arr[prev].f) {
            use[i] = false;
            ans--;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3964
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cmath>
#include <cstring>

using namespace std;

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)
#define SCANFD(x) scanf("%d",&x)

long long int lpow(long long int x,long long int y){
    long long int res=1;
    for(int i=0;i<y;i++){
       res*=x; 
    }
    return res;
}

int main(){
    long long int D,N;
    long long int res;
    scanf("%lld %lld",&D,&N);
    if(N==100) N++;
    
    printf("%lld\n",lpow(100,D)*N);

    return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            string answer = "Even";
            if (ab[0] % 2 == 1 && ab[1] % 2 == 1) { answer = "Odd"; }
            Console.WriteLine(answer);
        }
    }
}

Measured memory_bytes: 11348
var
  n,a,max,i,ans:longint;
begin
  readln(n);
  max:=0;
  for i:=1 to n do
    begin
      read(a);
      if a>=max then
        begin
          inc(ans);
          max:=a;
        end;
    end;
  write(ans);
end.

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;

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

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
ll se=0;
ll sume(vector<int> a,int n){

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> Pa;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

int F[101][10];
int P[101][11];
int tmp[101];

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

    int N;
    cin >> N;
    REP(i, N){
        REP(j, 10){
            cin >> F[i][j];
        }
    }
    REP(i, N){
        REP(j, 11){
            cin >> P[i][j];
        }
    }
    llint ans = -10000000000;

    FOR(i, 1, 1024){
        fill(tmp, tmp+N, 0);
        int x = i;
        REP(j, 10){
            if(x&0x01){
                REP(k, N){
                    if(F[k][j]) tmp[k]++;
                }
            }
            x = x >> 1;
        }
        llint t = 0;
        REP(k, N){
            t += P[k][tmp[k]];
        }
        ans = max(ans, t);
    }

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


Measured memory_bytes: 256
// {{{ include and macros
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i, a, b) for(int i=a; i < b;i++)
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <deque>
#include <set>
using namespace std;
// }}}

// {{{ io
void newline() {cout << endl;}
template <typename T>
void display(T input){cout << input;}
template <typename T>
void put(T input){display(input); newline();}
  // }}}

const int n_max = 100000;
const int prime_number_max = 200270;
const int p_max = 100;
vector<int> prime_numbers;
int n, p;

void reserve_prime_numbers(){
   const int sievesize = prime_number_max;
   std::vector<int> sieve(prime_number_max, 1);
   sieve.reserve(prime_number_max);
   for (int i = 2; i * i < sievesize; i++)
      if (sieve[i])
         for (int j = i + i; j < sievesize; j += i)
            sieve[j] = 0;
   for (int j = 2; j < sievesize; j++)
      if (sieve[j])
        prime_numbers.push_back(j);
}

int get_index(){
  int i=0;
  for(; prime_numbers[i]<=n; i++){}
  return i;
}

int binary_search_index_rec(int s, int e){
  int i=(s+e)/2;
  if(s==e-1){return i+1;}
  if(prime_numbers[i]==n){return i;}
  if(prime_numbers[i]>n) return binary_search_index_rec(s, e-(e-s)/2);
  if(prime_numbers[i]<n) return binary_search_index_rec(s+(e-s)/2, e);
}

int binary_search_index(){
  return binary_search_index_rec(0, prime_numbers.size()-1);
}

int solve(){
  vector<int> prime_numbers_sum;
  int index = get_index();
  // int index = binary_search_index();
  for(int i=0+index; i<25+index; i++){
    for(int l=i; l<25+index; l++){
      int sum = prime_numbers[i] + prime_numbers[l];
        prime_numbers_sum.push_back(sum);
    }
  }
  sort(prime_numbers_sum.begin(), prime_numbers_sum.end());
  return prime_numbers_sum[p-1];
}

int main(){
  ios::sync_with_stdio(false);
  prime_numbers.reserve(prime_number_max);
  reserve_prime_numbers();
  while(cin >> n >> p && n != -1 && p != -1)
    put(solve());
}

Measured memory_bytes: 3412