akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL << 60;
const int MOD = (int) 1e9 + 7;

signed main(){
    int x;
    cin >> x;
    int ans = (x / 11) * 2;
    if (x % 11 != 0) {
        if (x % 11 <= 6)
            ans++;
        if (x % 11 > 6)
            ans += 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define no cout<<"NO"<<endl;
#define pb push_back
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define mod 1000000007
#define gcd(x,y) __gcd(x, y)
using namespace std;
int main()
{
	char s;
	cin>>s;
	if(s>=65&&s<=90)
	cout<<'A'<<endl;
	else
	{
		cout<<'a'<<endl;
	}
}

Measured memory_bytes: 3632
from math import sqrt
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

def max(num):
    k = int(sqrt(2*num))
    for i in range(k):
        if (k-i)*(k-i+1)<=2*num:
            return k-i
    return

n = int(input())

if n == 1:
    print(0)
    exit()

li = factorization(n)

ans = 0
for i in li:
     ans +=max(i)
print(ans)


Measured memory_bytes: 9428
/********************************
*** ******** ********** *********
*** * ****** ********* * ********
*** ** ***** ******** *** *******
*** *** **** ******* ***** ******
*** **** *** ****** ******* *****
*** ***** ** ***** +++++++++ ****
*** ****** * **** *********** ***
*** *******  *** ************* **
*** ******** ** *************** *
**********_**********************
* |   /  / \  \     /    /\     *
* |  /  |   |  \   /    /  \    *
* | /   |   |   \ /    /    \   *
* |+\   |   |    |    /______\  *
* |  \  |   |    |   |        | *
* |   \  \_/     |   |        | *
********************************/
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define lsb(i) (i & -i)
#define Pi 3.141592653589793238
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define all(a) a.begin(), a.end()
#define remax(a, b) (a = ((a<b) ? b : a))
#define remin(a, b) (a = ((a<b) ? a : b))
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define precise(a) cout<<fixed<<setprecision(a)
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

lli power(lli x,lli y,lli p = (lli)(1e13)) { 
	lli res = 1;	 
	x = x % p; 
	while (y > 0) 
	{ 
		if (y & 1) 
			res = (res*x) % p; 
		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
}

long double dst(pair<lli,lli> p) {
    return sqrt(p.fi*p.fi + p.se*p.se);
}

void solve(){
    lli k; cin >> k;
    if(k==7) {
        cout << 1 << '\n';
    } else if(k%2==0) {
        cout << -1 << '\n';
    } else {
        lli r = 0, md = 0;
        bool fg = 0;
        NA(i,0,k) {
            md*=10, md=(md+7)%k;
            if(md%k==0) {cout << (i+1) << '\n'; fg = 1; break;}
        }
        if(!fg) cout << -1 << '\n';
    }
    return;
}


int main(){
    fastIO;
    lli t = 1;
    // cin >> t;
    NA(i,0,t){ 
		// cout << "Case #" << i+1 << ": \n";
		solve();
	}
	return 0;
}


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

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

using namespace std;

template <class T>
void printv(vector<T> v)
{
  cout << '[';
  for (auto vec: v)
  {
    cout << vec << ' ';
  }
  cout << ']' << endl;
}

int main()
{
  long long n, result = 0;
  vector<int> v;

  cin >> n;

  for (int i = 0; i < n * 2; i++)
  {
    long long tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  sort(v.begin(), v.end());

  for (int i = 0; i < n * 2; i += 2)
  {
    result += min(v[i], v[i + 1]);
  }
  cout << result << endl;
}


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

using namespace std;

int n;
string s;
long long tmp=0;
void dfs(int i,long long ans,long long num){
    if(i==n){
        tmp+=ans;
        return ;
    }
    dfs(i+1,ans+num*10+(s[i]-'0'),0);
    if(i<n-1)dfs(i+1,ans,num*10+(s[i]-'0'));
}

int main()
{
    cin >> s;
    n=(long long)s.size();
    dfs(0,0,0);
    cout << tmp<< endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <complex>
using namespace std;
typedef complex<double> P;
typedef vector<P> G;
const double EPS = 1e-9;

struct L : public vector<P> {
	L(P a,P b){ push_back(a); push_back(b); }
};

struct C{
	P p;
	double r;
	C(P p,double r) : p(p) , r(r) {}
	C(){}
};


double dot(P a,P b){
	return real(conj(a)*b);	
}
P projection(const L &l,const P &p){
	double t = dot(p-l[0],l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}

double distanceLP(L l,P p){
	return abs(p-projection(l,p));
}

bool eq(double a,double b){
	return fabs(a-b) < EPS;
}

vector<L> contact(C p,C q){
	vector<L> ret;
	if( p.r < q.r ) swap(q,p);
	double d = abs(p.p-q.p);
	P n = q.p - p.p;
	n /= abs(n);
	if( d + EPS < abs(p.r - q.r)){
		ret.clear();
	}else if( eq(d,abs(p.r-q.r)) ){
		P t,u;
		t = p.p+p.r*n;
		u = t+n*P(0,1);
		ret.push_back(L(t,u));
	}else{
		if( !eq(p.r,q.r) ){
			P  t= p.p + (p.r*d/(p.r-q.r))*n;
			long double theta = asin((p.r-q.r)/d);
			P u = n * P(cos(theta),sin(theta));
			P v = n * P(cos(-theta),sin(-theta)); 
			u += t;
			v += t;
			ret.push_back(L(t,v));
			ret.push_back(L(t,u));
		}else{
			P t = p.p + n * P(0,1) * p.r;
			P u = p.p - n * P(0,1) * p.r;
			ret.push_back(L(t,t+n));
			ret.push_back(L(u,u+n));
		}
		
		if( eq(d,p.r+q.r) ) {
			P t,u;
			t = p.p+p.r*n;
			u = t+n*P(0,1);
			ret.push_back(L(t,u));
		}else if( d > q.r + p.r ){
			P  t= p.p + (p.r*d/(p.r+q.r))*n;
			long double theta = asin((p.r+q.r)/d);
			P u = n * P(cos(theta),sin(theta));
			P v = n * P(cos(-theta),sin(-theta)); 
			u += t;
			v += t;
			ret.push_back(L(t,v));
			ret.push_back(L(t,u));
		}
	}
	return ret;
}

double M[100];

int main(){
	int n;
	while(cin >> n && n){
		vector<C> c;
		vector<C> X;
		for(int i = 0 ; i < n ; i++){
			double x,y,r,m;
			cin >>x  >> y >> r >> m;
			c.push_back(C(P(x,y),r));
			M[i] = m;
			X.push_back(C(P(x,y),r));
			X.push_back(C(P(x,y),r+m));
		}
		vector<L> l;
		for(int i = 0 ; i < X.size() ; i++){
			for(int j = i+ 1; j < X.size() ; j++){
				vector<L> con = contact(X[i],X[j]);
				for(int k = 0 ; k < con.size() ; k++)
					l.push_back(con[k]);
			}
		}
		int ans = 1;
		for(int i = 0 ; i < l.size() ; i++){
			int sub = 0;
			for(int j = 0 ; j < c.size() ; j++){
				
				if( distanceLP(l[i],c[j].p) < c[j].r - EPS ){
					continue;
				}
				if( distanceLP(l[i],c[j].p) < c[j].r+M[j] + EPS ){
					sub++;
				}
			}
			ans = max(sub,ans);
		}
		cout << ans << endl;
		
	}
}

Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		for(int i=1;i<s.length();i++){
			
			String si=s.substring(0, s.length()-i);
			
			if(si.length()%2==0){
				if(si.substring(0, si.length()/2).equals(si.substring(si.length()/2,si.length()))){
					System.out.println(si.length());
					return;
				}
			}
		}
		
	}

}


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

int main(){
  string S, T;
  cin>>S>>T;
  
  int l=S.size();
  int num=0;
  for(int i=0; i<l; i++){
    if(S.at(i)!=T.at(i)){
      num++;
    }
  }
  cout<<num<<endl;
}

Measured memory_bytes: 3908
#include <stdio.h>
static int n, m, a[100][100], b[100], c[100];
int main(void) {
    int i, j;
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; ++i)
        for (j = 0; j < m; ++j)
            scanf("%d", &a[i][j]);
    for (j = 0; j < m; ++j)
        scanf("%d", &b[j]);
    for (i = 0; i < n; ++i)
        for (j = 0; j < m; ++j)
            c[i] += a[i][j] * b[j];
    for (i = 0; i < n; ++i)
        printf("%d\n", c[i]);
    return 0;
}

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

inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
using namespace std;
#define lowbit(x) ((x)&(-x))
const int maxn = 5000 + 50;
int n , K , a[maxn];
short prefix[maxn][maxn] , suffix[maxn][maxn] , sum[maxn][maxn];

int main( int argc , char * argv[] ){
	n = read() , K = read();
	for(int i = 1 ; i <= n ; ++ i)
		a[i] = read();
	sort( a + 1 , a + n + 1 );
	int ans = n;
	int base = n;
	while( n >= 1 && a[n] >= K )
		-- n;
	prefix[0][0] = suffix[n + 1][0] = 1;
	for(int i = 1 ; i <= n ; ++ i){
		for(int j = 0 ; j < K ; ++ j)
			if( prefix[i - 1][j] ){
				prefix[i][j] = 1;
				if( j + a[i] <= K )
					prefix[i][j + a[i]] = 1;
			}
	}
	for(int i = n ; i >= 1 ; -- i){
		for(int j = 0 ; j < K ; ++ j)
			if( suffix[i + 1][j] ){
				suffix[i][j] = 1;
				if( j + a[i] <= K )
					suffix[i][j+a[i]]=1;
			}
		for(int j = 1 ; j < K ; ++ j)
			sum[i][j] = sum[i][j - 1] + suffix[i][j];
	}
	for(int i = 1 ; i <= n ; ++ i){
		int l = K - a[i] , r = K - 1 , ok = 1;
		for(int j = 0 ; j < K ; ++ j)
			if( prefix[i - 1][j] ){
				if(j >= l){
					ok = 0;
					break;
				}
				else{
					int rangel = l - j , ranger = r - j;
					if( sum[i + 1][ranger] - sum[i + 1][rangel - 1] ){
						ok = 0;
						break;
					}
				}
			}
		ans -= ok;
	}
	printf( "%d\n" , base - ans );
	return 0;
}

Measured memory_bytes: 149248
#include <stdio.h>
int main(){
	int a, b, c, x;
	scanf("%d %d %d", &a, &b, &c);
	if(a > c){
		x = a;
		a = c;
		c = x;
	}
	if(b > c){
		x = b;
		b = c;
		c = x;
	}
	if(a > b){
		x = a;
		a = b;
		b = x;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}

Measured memory_bytes: 1756
//G = G_1 + … + G_kとk個の連結グラフに分け、G_1の頂点番号≦G_2の頂点番号≦…≦G_kの頂点番号となるように番号を振りなおし,
//G_iの頂点番号行, G_jの頂点番号列で一つのブロックを作ると, 異なるブロック間に辺が存在しないので、
//f(G_i, G_j) = 2つの連結グラフG_i, G_jで頂点数|G_i| * |G_j|のグラフを作ったときの連結成分数、とおくとΣf(G_i, G_j)が答えになる。
//
//また、表の行と列を適切に並べ替えても、N^2頂点の表は連結成分数を保ったままなので、番号の振り直しをしなくても↑の議論が成り立つ。
//f(G_i, G_j)の値は（直線グラフや木で実験すると）、G_i, G_jの頂点数がともに2以上のとき2以下になることが分かる。また、
//G_i, G_jの頂点数がともに2以上のとき、共に2部グラフなら(黒, 黒) -- (白, 白)または(黒, 白) -- (白, 黒)としか結べないように表の頂点を彩色できるので、
//連結成分数が2以上(=2)になる。また、どちらか一方でも非2部グラフなら、連結成分数が1になると予想できる。
//((黒,黒)->(黒,白)みたいな辺が存在してしまうため。) また、頂点数がどちらか1なら、辺を張れないので、|Gi| * |Gj|が連結成分数になる。
//
//これよりO(k^2)アルゴリズムは導出できたが、これでは最悪O(N^2)となり間に合わない。
//しかし, 頂点数1の連結成分がx個, 2部グラフの連結成分がy個, 非2部グラフの連結成分がz個あるとすると、x,y,zから答えを求めることができるので、
//O(N)で答えを求めることができる。

#include <iostream>
#include <vector>
#include <queue>
#define int long long
using namespace std;

struct Edge { int from, to; Edge(int from, int to) { this->from = from; this->to = to; } Edge() { } };
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int n, m;
Graph g;
vector<Graph> gs;

void labeling() {
	static bool used[100000] = {false};
	static int num[100000];
	queue<int> que;
	int i, j, k;
	
	for (i = 0; i < n; i++) {
		if (used[i]) continue;
		
		vector<int> vs;
		
		used[i] = true; que.push(i); num[i] = 0; vs.push_back(i);
		
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (j = 0; j < g[v].size(); j++) {
				int nv = g[v][j].to;
				if (!used[nv]) {
					used[nv] = true;
					que.push(nv);
					num[nv] = vs.size();
					vs.push_back(nv);
				}
			}
		}
		
		//gs[-]の作成
		Graph gg;
		
		gg.resize(vs.size());
		for (j = 0; j < vs.size(); j++) {
			for (k = 0; k < g[vs[j]].size(); k++) {
				int to = g[vs[j]][k].to;
				gg[j].push_back(Edge(j, num[to]));
			}
		}
		gs.push_back(gg);
	}
}

//連結なグラフが与えられるので、2彩色できるか判定する。
bool isBinary(Graph &g) {
	vector<int> color(g.size());
	queue<int> que;
	int i;
	
	for (i = 0; i < g.size(); i++) color[i] = -1;
	que.push(0);
	color[0] = 0;
	
	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (i = 0; i < g[v].size(); i++) {
			int nv = g[v][i].to;
			if (color[nv] == -1) {
				que.push(nv);
				color[nv] = !color[v];
			}
			else if (color[nv] == color[v]) {
				return false;
			}
		}
	}
	return true;
}

signed main() {
	int i;
	
	cin >> n >> m;
	g.resize(n);
	for (i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		g[u].push_back(Edge(u, v));
		g[v].push_back(Edge(v, u));
	}
	
	labeling();
	
	int x = 0, y = 0, z = 0;
	for (i = 0; i < gs.size(); i++) {
		if (gs[i].size() == 1) x++;
		else if (isBinary(gs[i])) y++;
		else z++;
	}
	
	//cout << x << " " << y << " " << z << endl;
	
	int ans = 2 * x * (n - x) + x * x;
	
	ans += y * y * 2;
	ans += y * z * 1;
	
	ans += z * y * 1;
	ans += z * z * 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 35700
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let a: usize = sc.read();
    let b: usize = sc.read();
    println!("{}", a * b);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1000000000
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repM(i, n) for (int i = n; i > 0; i--)

int main() {
    int N;
    string S;
    cin >> N;
    cin >> S;
    string T = "";
    rep(i,N/2){
        T += S[i];
    }
    if(S == T + T){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
A, B = [x for x in input().split()]

def main():
    num = int(A + B)
    i = 1
    result = "No"
    while i ** 2 <= num:
        if i ** 2 == num:
            result = "Yes"
            break
        i = i + 1
    print(result)

if __name__ == "__main__":
    main()

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int s; cin>>s;

	int a = s/100;
	int b = s%100;



	if(a >0 && a<=12 && b>0 && b<=12){
		writeln("AMBIGUOUS");
	}else if (a >=0  && b>0 && b<=12) {
		writeln("YYMM");
	}else if (a >0 && a<=12 && b>=0) {
		writeln("MMYY");
	}else {
		writeln("NA");
	}




}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x,y,xmax=0,xmin=0,ymax=0,ymin=0;
int v=0,ans=0;
ll f[1000]={};

ll dp(ll a){
	if(a<=1){
		return a;
	}
	if(f[a] != 0){
		return f[a];
	}else{
		return f[a]=dp(a-1)+dp(a-2);
	}
}

int main(){
	cin>>x>>y;
	ll k=2;
	ans=1;
	while(true){
		if(xmin<=x&&xmax>=x&&ymin<=y&&ymax>=y){
			break;
		}
		if(v==0){
			xmax+=dp(k);
			v++;
		}else if(v==1){
			ymax+=dp(k);
			v++;
		}else if(v==2){
			xmin-=dp(k);
			v++;
		}else{
			ymin-=dp(k);
			v=0;
		}
		//cout<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax<<endl;
		k++;
		if(ans==3){
			ans=1;
		}else{
			ans++;
		}
	}
	//cout<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax<<endl;
	//cout<<k<<endl;
	//for(int i=0;i<k;i++){
	//	cout<<f[i]<<" ";
	//}
	//cout<<endl;
	cout<<ans<<endl;
}
			
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		


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

int di[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dj[8] = {1, 1, 0, -1, -1, -1, 0, 1};


int main(){
    
    while(1){
        int h, w; cin >> h >> w;
        if(h == 0) break;
        vector<string> a(h);
        for(int i = 0; i < h; i++) cin >> a[i];
        string ans = "[";
        set<string> s;
        
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                for(int k = 0; k < 8; k++){

                    string tmp;
                    tmp += a[i][j];
                    int ni = (h + i + di[k]) % h;
                    int nj = (w + j + dj[k]) % w;
                    while(!(ni == i && nj == j)){
                        tmp += a[ni][nj];
                        //cout << i << " " << j << " " << ni << " " << nj << " " <<  tmp << endl;
                        
                        ni = (h + ni + di[k]) % h;
                        nj = (w + nj + dj[k]) % w;

                        //cout << i << " " << j << " " << ni << " " << nj << " " <<  tmp << endl;
                        if(s.find(tmp) != s.end()){
                            //cout << "find" << endl;
                            if(ans.size() < tmp.size()){
                                ans = tmp;
                            }else if(ans.size() == tmp.size() && ans > tmp){
                                ans = tmp;                                
                            }
                        }else{
                            //cout << "insert" << endl;
                            s.insert(tmp);
                        }                
                    }
                }
            }
        }

        //string hoge = "ABCDEFGHIJKLMNOPQRSTUVWXYZHHHHHABCDEFGHIJKLMNOPQRSTUVWXYZ";
        //cout << hoge.size() << endl;
    
        if(ans == "[") cout << 0 << endl;
        else cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 35716
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

sum = 0

for i in range(n):
    sum = sum + b[a[i]-1]
    if i >= 1:
        if a[i] == a[i-1] + 1:
            sum = sum + c[a[i-1]-1]

print(sum)

Measured memory_bytes: 3064
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
using namespace std;

int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d;
	if(a>=c){
		if(b>=d){
			if(d-a>=0){cout<<d-a<<endl;}else{cout<<"0"<<endl;}
		}else{
			if(b-a>=0){cout<<b-a<<endl;}else{cout<<"0"<<endl;}
		}
	}else{
		if(b>=d){
			{cout<<d-c<<endl;}
		}else{
			if(b-c>=0){cout<<b-c<<endl;}else{cout<<"0"<<endl;}
		}	
	}
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define ForE(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

int a,b,c;
int n,m,cnt,ans;
string s,t;

ll fact(int n)
{
        if(n==1)return 1;
        return n*fact(n-1);
}

ll comb(int i,int j)
{
        return fact(i)/fact(j)/fact(i-j);
}

main()
{
        cin>>n;

        vi v(n);
        ForE(&it,v)cin>>it;

        sort(All(v));
        int i=v[n-1];
        v.pop_back();

        rep(t,n-2)
        {
                if((double)v[t]>(double)i/2)
                {
                        if(t==0)
                        {
                                printf("%d %d\n",i,v[0]);
                                return 0;
                        }

                        double d=abs((double)v[t]-(double)i/2)-abs((double)v[t-1]-(double)i/2);

                        if(d<0)
                        {
                                printf("%d %d\n",i,v[t]);
                                return 0;
                        }else
                        {
                                printf("%d %d\n",i,v[t-1]);
                                return 0;
                        }

                }
        }

        printf("%d %d\n",i,v[n-2]);
}

Measured memory_bytes: 640
D=int(input())
*c,=map(int,input().split())
s=[]
for i in range(D):
    *x,=map(int,input().split())
    s.append(x)

dt=[]
last=[-1]*26
v=0
for d in range(D):
    news=[s[d][i]-c[i]*(d-last[i]) for i in range(26)]
    maxi=0
    tmp=-float('inf')
    for i in range(26):
        if tmp<news[i]:
            maxi=i
            tmp=news[i]
    last[maxi]=d
    v+=s[d][maxi]
    for i in range(26):
        v-=c[i]*(d-last[i])
    dt.append(maxi+1)

for i in dt:
    print(i)

Measured memory_bytes: 74168
#include<bits/stdc++.h>
using namespace std;
#if defined __has_include
# if __has_include(<bits/debug_aamir.h>)
#  define dbg(...) DEBUG(#__VA_ARGS__, __VA_ARGS__);
#  include<bits/debug_aamir.h>
# else
#  define dbg(...)
# endif
#endif

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll, ll> pll;
#define sz(x) int(x.size())
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define rep(i, begin, end) for(__typeof(end) i=begin; i<end; i++)
#define per(i, begin, end) for(__typeof(end) i=begin; i>=end; i--)
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 1e18 + 1;


template<typename T>
T gcd(T a, T b){	return b ? gcd(b, a%b): a; }
template<typename T>
T lcm(T a, T b){	return a/gcd(a, b) * b;		}

const int nax=1e5+5;
vi g[nax];
vi dp(nax), topo, vis(nax);

void dfs(int u){
	vis[u] = 1;
	for(int v:g[u])	if(!vis[v])
		dfs(v);
	topo.eb(u);
}

int main()
{
	fastio;
	int n, m, u, v;
	cin >> n >> m;
	rep(i, 0, m){
		cin >> u >> v;
		g[u].eb(v);
	}
	for(int i=1; i<=n; i++)	if(!vis[i])
		dfs(i);
	reverse(topo.begin(), topo.end());
	for(auto u:topo){
		for(int v:g[u])
			dp[v] = max(dp[v], 1+dp[u]);
	}
	printf("%d\n", *max_element(dp.begin(), dp.end()));
}



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

int main() {
  int N,suma,sumb;
  suma,sumb = 0;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0;i<N;i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int i = 0;i<N;i++){
    if (2 * i > N -1)
      break;
    else if(2 * i == N - 1){
      suma += vec.at(N - 1);
      break;
    }  
    suma += vec.at(2 * i);
    sumb += vec.at(2 * i + 1);
   
  }
  cout << suma - sumb << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
using namespace std;

#define N 1e5
#define EPS 1e-9


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int k;
	string s;
	cin >> k >> s;
	if (s.length() > k) {
		cout << s.substr(0, k) << "..." << '\n';
	} else {
		cout << s << '\n';
	}
	
	
}


Measured memory_bytes: 3092
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);
        int N;
        String S;
        int K;
        N = scanner.nextInt();
        S = scanner.next();
        K = scanner.nextInt();

        char c = S.charAt(K-1);
        System.out.println(S.replaceAll("[^" + c + "]", "*"));
    }
}

Measured memory_bytes: 21716
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N (200010)
//n<=50000
struct edge {
	int to;
	long long dis;
};

int n, m;
vector<edge>e[N];
long long d[N];
bool dec[N];

void init(void) {
	f(i, N) {
		d[i] = 100000000000000000;
		dec[i] = false;
	}
}

void dijkstra(int s) {
	int xv;
	d[s] = 0;
	priority_queue<pair<long long, int> >pq;
	pq.push(make_pair(0, s));
	while (!pq.empty()) {
		while (dec[pq.top().second]) {
			pq.pop();
			if (pq.empty())return;
		}
		xv = pq.top().second;
		dec[xv] = true;
		f(i, e[xv].size()) {
			if (d[e[xv][i].to] > (d[xv] + e[xv][i].dis)) {
				d[e[xv][i].to] = d[xv] + e[xv][i].dis;
				pq.push(make_pair(-d[e[xv][i].to], e[xv][i].to));
			}
		}
	}
	return;
}


//1<=v<=n
int main(void) {
	int x, y;
	long long z;
	scanf("%d %d", &n, &m);
	init();
	f(i, n - 1) {
		e[i + 1].push_back({ i,0 });
	}
	f(i, m) {
		scanf("%d %d %lld", &x, &y, &z);
		x--;
		y--;
		e[x].push_back({ y, z });
	}
	dijkstra(0);

	if (d[n - 1] < 10000000000000000)printf("%lld\n", d[n - 1]);
	else printf("-1\n");


	return 0;
}

Measured memory_bytes: 13560
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var A = input[0];
            var B = input[1];
            var C = input[2];

            if ((A == B && B == C) || (A != B && B != C && C != A))
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll H, W, n;
    cin >> H >> W >> n;

    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    vector<ll> v;
    rep(i, n) {
        rep(j, a[i]) v.push_back(i + 1);
    }

    vector<vector<ll> > res(H, vector<ll>(W));
    ll cnt = 0;
    rep(i, H) {
        rep(j, W) {
            ll x = j;
            if (i % 2 == 1) {
                x = W - 1 - j;
            }
            res[i][x] = v[cnt];
            cnt++;
        }
    }

    rep(j, H) {
        rep(i, res[j].size()) cout << res[j][i] << (i == res[j].size() - 1 ? "" : " ");
        cout << endl;
    }

}
signed main(){ Main();return 0;}

Measured memory_bytes: 3708
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcount(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second<b.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
int main()
{
    FAST
    FO
    FI
    long double l;
    IN l;
    long double temp= l/3.0;
    temp+=0.0;
    long double ans= temp*temp;
    ans*=temp;
    OUT fixed<<setprecision(10)<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("in", "r", stdin),freopen("out", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //FL;
    FIN;
    char c;
    cin >> c;
    if(c >= 'A' && c <= 'Z')
        cout << "A\n";
    else
        cout << 'a' << '\n';
    EjecuteTime;
    return 0;
}       


Measured memory_bytes: 3800
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		long ans = 0;
		int tmp = Math.min(x, y);
		x -= tmp;
		y -= tmp;
		if(a + b < 2 * c) {
			ans += tmp * (a + b);
		} else {
			ans += tmp * 2 * c;
		}
		if(x % 2 == 1) {
			if(a < 2 * c) {
				ans += a;
			} else {
				ans += 2 * c;
			}
			x--;
		}
		if(a < 2 * c) {
			ans += a * x;
		} else {
			ans += 2 * c * x;
		}
		if(y % 2 == 1) {
			if(b < 2 * c) {
				ans += b;
			} else {
				ans += 2 * c;
			}
			y--;
		}
		if(b < 2 * c) {
			ans += b * y;
		} else {
			ans += 2 * c * y;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 22608
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {
	ll n;
	cin >> n;
	string an = "";
	vector<string> S(n);
	rep(i, n) {
		cin >> S.at(i);
	}
	rep(j, 26) {
		char k = 'a' + j;
		ll M = 99;
		rep(i, n) {
			ll co = 0;
			rep(h, S.at(i).size()) {
				
				if (S.at(i).at(h) == k) {
					co++;
				}
			}
			M = min(M, co);
		}

		rep(i, M) {
			an += k;
		}
	}
	cout << an << endl;

}


Measured memory_bytes: 3580
#include "bits/stdc++.h"
using namespace std;

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector <int> pre (n), suf (n);
	for(int i = 1; i < n; i++) {
		pre[i] = pre[i - 1] + (s[i - 1] == 'W');
	}
	for(int i = n - 2; i >= 0; i--) {
		suf[i] = suf[i + 1] + (s[i + 1] == 'E');
	}
	int ans = n;
	for(int i = 0; i < n; i++) {
		ans = min(ans, pre[i] + suf[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

int n,A[50];

int solve(int i,int m){
  if(m==0) return 1;
  if(i>=n || m<0) return 0;
  int res=solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}

int main(){
  int q,M,i;

  cin>>n;
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  cin>>q;
  for(i=0;i<q;i++){
    scanf("%d",&M);
    if(solve(0,M)) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}



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

const int inf = 1000000005;

int32_t main() {

    int n, k;
    cin >> n >> k;
    int h[n];
    for (int i=0; i<n; ++i) {
		
		cin >> h[i];
		
	}
	
	int dp[n];
	memset (dp, inf, sizeof(dp));
	
	dp[0] = 0;
	for (int i=0; i<n; ++i) {
		
		for (int j=i+1; j<=i+k; ++j) {

			if (j < n) {
				
				dp[j] = min (dp[j], dp[i] + abs (h[j] - h[i]));
				
			}

		}
		
	}

		cout << dp[n-1] << endl;
	
	     return 0;

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <sstream>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define ALL(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cout << __FILE__ << ":" << __LINE__ << endl;

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

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

int H, W;
int M[500][500];
vector<string> ans;
void dfs(int i, int j, int m) {
    ostringstream ostr;
    ostr << i + 1 << " " << j + 1 << " ";

    int f = false;
    if (M[i][j] % 2 == 1) {
        M[i][j]--;
        f = true;
    }

    if (m == 0) {
        if (j + 1 < W) {
            if (f) {
                M[i][j+1]++;
                ostr << i + 1 << " " << j + 2;
                ans.push_back(ostr.str());
            }
            dfs(i, j + 1, m);
        } else if (i + 1 < H) {
            if (f) {
                M[i+1][j]++;
                ostr << i + 2 << " " << j + 1;
                ans.push_back(ostr.str());
            }
            dfs(i + 1, j, 1);
        }
    } else {
        if (j - 1 >= 0) {
            if (f) {
                M[i][j-1]++;
                ostr << i + 1 << " " << j;
                ans.push_back(ostr.str());
            }
            dfs(i, j - 1, m);
        } else if (i + 1 < H) {
            if (f) {
                M[i+1][j]++;
                ostr << i + 2 << " " << j + 1;
                ans.push_back(ostr.str());
            }
            dfs(i + 1, j, 0);
        }
    }
}

int main() {
    cin >> H >> W;
    rep(i, H) rep(j, W) cin >> M[i][j];
    dfs(0, 0, 0);

    cout << ans.size() << endl;
    rep(i, ans.size()) {
        cout << ans[i] << endl;
    }
}


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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    int ans=0;
    char w[11];
    char t[1001];
    scanf("%s",w);
    int ww=strlen(w);
    for (;;) {
        scanf("%s",t);
        if (!strcmp(t,"END_OF_TEXT")) break;
        int tt=strlen(t);
        for (int j=0;j<tt;j++) if (isupper(t[j])) t[j]=t[j]+32;
        if (!strcmp(t,w)) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b; cin>>a>>b;
	int c=b*2+1;
	cout<<(a+c-1)/c<<endl;
	
	return 0;
}

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

int main(){
    string S;
    cin>>S;
    int ans=0;

    if(S.size()==1){
        cout<<"0"<<endl;
        return 0;
    }else{
        for(int i=0;i<S.size();i++){
            if(S[i]==S[i+1]&&S[i]=='0'){
                S[i+1]='1';
                ans++;
            }else if(S[i]==S[i+1]&&S[i]=='1'){
                S[i+1]='0';
                ans++;
            }
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
#include<functional>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

uint64_t getZ() {
  uint64_t v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int64_t getN() {
  int c = getchar_unlocked();
  if(c == '-') return -getZ();
  int64_t v = c - '0';
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int const MAXN = 2e5;
int const MAXNN = 1<<18;
std::pair<int,int> xy[MAXN];

template<typename T, int NN>
struct bit {
  typedef std::function<T(T,T)> OP;
  T data_[NN], e_; // 0-base
  OP& op_;
  bit(OP& op, T e) : op_(op), e_(e) { std::fill_n(data_, NN, e_); }
  int lb(int i){ return i&-i; }
  T query(int i) { // 1-base
    T res = e_;
    while(i > 0) { res = op_(res, data_[i-1]); i -= lb(i); }
    return res;
  }
  void add(int i, T const& v) { // 1-base
    while(i <= NN) { data_[i-1] = op_(data_[i-1], v); i += lb(i); }
  }
};

int64_t const MOD = 998244353;

template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};
typedef mod_int<MOD> mint;

int main() {
  int N = getZ();
  for(int i = 0; i < N; ++i) {
    xy[i].first = getN(); xy[i].second = getN();
  }
  // y-compress
  std::sort(xy, xy+N, [&](auto const&l, auto const&r){ return l.second < r.second; });
  for(int i = 0; i < N; ++i) xy[i].second = i+1;
  // x-sort
  std::sort(xy, xy+N);

  bit<int64_t, MAXNN>::OP op = [](int64_t x, int64_t y){ return x+y; };
  bit<int64_t, MAXNN> n3t(op, 0);
  mint ans = mint(N)*(mint(2).pow(N) - 1);
  for(int i = 0; i < N; ++i) {
    int n23 = i, n14 = N-1-i, n34 = xy[i].second - 1;
    int n12 = N-1-n34, n3 = n3t.query(n34);
    int n2 = n23 - n3, n4 = n34 - n3;
    int n1 = n12 - n2;
    ans += mint(2).pow(n1) + mint(2).pow(n2) + mint(2).pow(n3) + mint(2).pow(n4);
    ans -= mint(2).pow(n12) + mint(2).pow(n23) + mint(2).pow(n34) + mint(2).pow(n14);
    n3t.add(xy[i].second, 1);
  }
  fin(ans.v_);
  return 0;
}


Measured memory_bytes: 3840
#[warn(unused_mut)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[warn(unused_mut)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[warn(unused_mut)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        n: usize,
        r: usize,
    }

    let ans = if n >= 10 {
        r
    } else {
        r + 100 * (10 - n)
    };

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=1000000000000000000;
int main(){
	int n,T;cin>>n>>T;
	int ans=INF;
	for(int i=0;i<n;i++){
		int c,t;cin>>c>>t;
		if(t<=T){
			ans=min(ans,c);
		}
	}
	if(ans==INF){
		cout<<"TLE"<<endl;
		return 0;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long first = in.nextLong();
        final long v = in.nextLong();
        in.nextLine();
        final long second = in.nextLong();
        final long w = in.nextLong();
        in.nextLine();
        final long t = in.nextLong();
        if (v <= w) {
            System.out.println("NO");
        } else {
            final long diff = Math.abs(v - w);
            if (t * diff >= Math.abs(second - first)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


Measured memory_bytes: 35968
#include <stdio.h>

int main(void) {
	int a, b;
	scanf("%d%d", &a, &b);
	if (a % 2 != 0 && b % 2 != 0) {
		printf("Odd\n");
	}
	else {
		printf("Even\n");
	}
	return 0;

}

Measured memory_bytes: 128
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        String a = sc.next();
        String b = sc.next();

        if (a.equals("H")) {
            _out.println(b);
        } else {
            if (b.equals("H")) {
                _out.println("D");
            } else {
                _out.println("H");
            }
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 19924
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

K = int(input())
A, B = [int(_) for _ in input().split(" ")]

for i in range(A, B+1, 1):
    if i % K == 0:
        print("OK")
        exit()
print("NG")


Measured memory_bytes: 10464