akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
void ABC42(void);
void ABC43(void);
void ABC44(void);
void ABC45(void);
void ABC46(void);
void ABC47(void);

int main(void){
    ABC47();
    return 0;
}

void ABC42(void){
    int a,b,c,n=0;
    scanf("%d %d %d",&a,&b,&c);
    if(a==7||b==7||c==7){
        if((a==5&&b==5)||(b==5&&c==5)||(c==5&&a==5)){
            printf("YES");
            n++;
    }}
    if(n==0)printf("NO");
}

void ABC43(void){
    int i,n,sum=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        sum+=i;
    }
    printf("%d",sum);
}

void ABC44(void){
    int n,k,x,y,i,sum=0;
    scanf("%d",&n);
    scanf("%d",&k);
    scanf("%d",&x);
    scanf("%d",&y);
    if(n>k){
        for(i=1;i<=k;i++)sum+=x;
        for(i=k+1;i<=n;i++)sum+=y;
    }else{
        for(i=1;i<=n;i++)sum+=x;
    }
    printf("%d",sum);
}

void ABC45(void){
    int a,b,h;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&h);
    printf("%d",(a+b)*h/2);
}

void ABC46(void){
    int a,b,c,n;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b||b==c||c==a){
        n=2;
        if(a==b&&a==c)n=1;
    }else{
        n=3;
    }
    printf("%d",n);
}

void ABC47(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if((a+b==c)||(b+c==a)||(c+a==b)){
        printf("Yes");
    }else{
        printf("No");
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++) cin >> s.at(i);
  map<string, int> v;
  for(string S : s) {
    if(v.count(S)) v.at(S)++;
    else v[S] = 1;
  }
  int m = 0;
  for(auto p : v) {
    auto value = p.second;
    m = max(m, value);
  }
  vector<string> mv(0);
  for(auto p : v) {
    auto key = p.first;
    auto value = p.second;
    if(value == m) mv.push_back(key);
  }
  sort(mv.begin(), mv.end());
  for(auto S : mv) cout << S << endl;
}

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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

vector<int>E[200000];
int a[200000],b[200000];
int dep[200000];
int ans[200000];

void dfs(int v,int p,int x,int d){
	ans[v]=x;
	dep[v]=d;
	int col=1;
	for(int u:E[v]){
		if(u==p)continue;
		if(col==x)col++;
		dfs(u,v,col,d+1);
		col++;
	}
}
int main(){
	int n;cin>>n;
	rep(i,n-1){
		scanf("%d%d",&a[i],&b[i]);a[i]--;b[i]--;
		E[a[i]].push_back(b[i]);
		E[b[i]].push_back(a[i]);
	}
	dfs(0,-1,-1,0);
	int K=*max_element(ans,ans+n);
	cout<<K<<endl;
	rep(i,n-1){
		if(dep[a[i]]>dep[b[i]])swap(dep[a[i]],dep[b[i]]);
		printf("%d\n",ans[b[i]]);
	}
}

Measured memory_bytes: 13184
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut h:i64 = read();
    let n:usize = read();
    let mut v:Vec<i64> = (0..n).map(|_| read()).collect();
    v.sort();
    for _ in 0..n {
        h -= v.pop().unwrap();
    }
    if h <= 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2980
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
 
 
signed main(){
    string S;
    cin >> S;
    int Ans=INF;
    int sum=0;
    int N=S.size();
    REP(i,N){
        if(S[i]!=(char)('0'+(i%2))){
            sum++;
        }
    }
    Ans=sum;
    sum=0;
    REP(i,N){
        if(S[i]!=(char)('0'+((i+1)%2))){
            sum++;
        }
    }
    Ans=min(Ans,sum);
    cout << Ans << endl;
    return 0;
}


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

//#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

//#define int long long
using namespace std;
const int INF = 2e9;
const int MOD = 1e9 + 7;
const int MB = 20;

int n;
vector<pair<int, int>> a;

ld ansY = 0;

ld checkY(ld x, ld y) {
	ld res = 0;
	for (int i = 0; i < n; i++) {
		ld one = abs(a[i].first - x);
		ld two = abs(a[i].second - y);
		res = max(res, sqrtl(one * one + two * two));
	}
	return res;
}

ld checkX(ld m) {
	ld l = 0;
	ld r = 1000;
	for (int it = 0; it < 100; it++) {
		ld m1 = l + (r - l) / 3;
		ld m2 = r - (r - l) / 3;
		ld one = checkY(m, m1);
		ld two = checkY(m, m2);
		if (one == two) {
			l = m1;
			r = m2;
		}
		else if (one < two) {
			r = m2;
		}
		else {
			l = m1;
		}
	}
	return min(checkY(m, l), checkY(m, r));
}

void solve() {
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}

	ld l = 0;
	ld r = 1000;
	for (int it = 0; it < 100; it++) {
		ld m1 = l + (r - l) / 3;
		ld m2 = r - (r - l) / 3;
		ld one = checkX(m1);
		ld two = checkX(m2);
		if (one == two) {
			l = m1;
			r = m2;
		}
		else if (one < two) {
			r = m2;
		}
		else {
			l = m1;
		}
	}

	cout << min(checkX(l), checkX(r));
}


signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int count=0;

    if(s.at(0)=='1')count++;
    if(s.at(1)=='1')count++;
    if(s.at(2)=='1')count++;
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint c(N),s(N),f(N);
    REP(i,N-1) cin>>c[i]>>s[i]>>f[i];

    for(int i=0;i<N;i++){
        int t=0;
        for(int j=i;j<N-1;j++){
            t=max(t,s[j]);
            t=(t+f[j]-1)/f[j]*f[j];
            t+=c[j];
        }
        cout<<t<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    double ans = 0;
    for (int i = 0; i < N; i++) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") {
            ans += x;
        }
        else {
            ans += x * 380000;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main {
  int n, m;
  cin >> n >> m;
  auto p = in(vectors(n, m, 0LL));
  auto q = in(vector<int>(m));
  rep(i, n) {
    int c = 0;
    rep(j, m) c += p[i][j] * q[j];
    cout << c << endl;
  }
}



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

int main()
{
	int n,r;
	cin >> n >> r;
	if(n>=10)
	{
		cout<<r<<endl;
	}
	else
	{
		cout<<r+(100*(10-n))<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
/*{{{*/
#include <bits/stdc++.h>
#ifdef LOCAL
int c_ = 0;
#define cout (c_?cerr:cout)
#define debug(...) \
{if(!c_++)cerr<<"\033[96;1m"; \
__VA_ARGS__; \
if(!--c_)cerr<<"\033[0m";}
#else
#define debug(...) {}
#endif
#define assrt(...) debug(\
if (not (__VA_ARGS__)) \
    exit((cerr << __LINE__ << ": " << #__VA_ARGS__ << '\n', 0));\
)
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using namespace std; using ll = long long;
template < typename t > using V = vector< t >;
template < typename t, size_t s > using A = array< t, s >;
void print() {cout << '\n';}
template< typename t, typename... v >
void print(const t& a, const v&... b)
{cout << a << (sizeof...(b)?" ":""); print(b...);}
template< typename t > void print_range(t a, const t& b)
{ while (a != b) cout << (*a++) << ' '; cout << '\n';}
#define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__))
#define dump_range(...) debug(cerr<<#__VA_ARGS__ << ": "; print_range(__VA_ARGS__))
/*}}}*/

constexpr int nax = 2e5, hax = 2e5, wax = hax;

int h, w, n;
int sr, sc;
string s, t;

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> h >> w >> n >> sr >> sc >> s >> t;
    
    int xl = 1, xh = h, yl = 1, yh = w;

    for (int i = n - 1; i >= 0; --i)
    {
        char c = t[i];
        if (c == 'L')
            yh = min(w, yh + 1);
        if (c == 'R')   
            yl = max(1, yl - 1);
        if (c == 'D')
            xl = max(1, xl - 1);
        if (c == 'U')
            xh = min(h, xh + 1);
        if (xl > xh or yl > yh)
            return print("NO"), 0;

        c = s[i];
        if (c == 'L')
            yl = yl + 1;
        if (c == 'R')   
            yh = yh - 1;
        if (c == 'U')
            xl = xl + 1;
        if (c == 'D')
            xh = xh - 1;
        if (xl > xh or yl > yh)
            return print("NO"), 0;
    }

    if (xl <= sr and sr <= xh and yl <= sc and sc <= yh)
        print("YES");
    else
        print("NO");
}

Measured memory_bytes: 920
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int total = 0;

		for(int i = 0;;i++ ){
			total += i;
			if(total >= X){
				System.out.println(i);
				break;
			}
		}
	}

}


Measured memory_bytes: 23636
n = int(input())
h = list(map(int, input().split()))
now = h.copy()

def water(now):
    for i in range(n):
        if now[i] == 0:
            continue
        else:
            for j in range(i, n):
                if now[j] != 0:
                    now[j] -= 1
                else:
                    break
            break
c=0

while True:
    if now == [0]*n:
        break
    water(now)
    c += 1

print(c)
    

Measured memory_bytes: 3060
#include<iostream>

using namespace std;
int main()
{
	int N,x[110],y[110],h[110],tmp=-1;
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> x[i] >> y[i] >> h[i];
		if(h[i] > 0) tmp = i;
	}
	if(tmp == -1){
		for(int Cx=0; Cx<=100; Cx++){
			for(int Cy=0; Cy<=100; Cy++){
				for(int H=1; H<=200; H++){
					bool flag = true;
					for(int i=0; i<N; i++){
						if(H - abs(x[i]-Cx) - abs(y[i]-Cy) > 0) flag = false;
					}
					if(flag){
						cout << Cx << ' ' << Cy << ' ' << H << endl;
						return 0;
					}
				}
			}
		}
	}
	for(int Cx=0; Cx<=100; Cx++){
		for(int Cy=0; Cy<=100; Cy++){
			for(int H=h[tmp]; H<=h[tmp]+200; H++){
				bool flag = true;
				for(int i=0; i<N; i++){
					if(h[i] == 0){
						if(H - abs(x[i]-Cx) - abs(y[i]-Cy) > 0) flag = false;
					}else if(h[i] != H - abs(x[i]-Cx) - abs(y[i]-Cy)) flag = false;
				}
				if(flag){
					cout << Cx << ' ' << Cy << ' ' << H << endl;
					return 0;
				}
			}
		}
	}
	
	return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    ll ans=0;
    for (ll i =1; i*i<=n; ++i) {
        if(n%i==0){
            ll a=n/i;
            ll b=i;
            a--;
            if(a>b){
                ans+=a;
            }
        }
    }
    cout <<ans <<endl;
}


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

int main() {
	string S, T;
	cin >> S >> T;
	int len = S.size();
	for (int i = 0; i < len; i++) {
		int cnt = 0, flag = 0;
		for (int j = i; ; j++) {
			if (cnt == len) break;
			if (S.at(j % len) != T.at(cnt)) {
				flag = 1;
			}
			cnt++;
		}
		if (flag == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    string s="$",tmp;cin>>tmp;s+=tmp;
    vector<vector<int>> v(n+1,vector<int>(26,0));
    for(int i=1;i<=n;i++){
        for(int j=0;j<26;j++){
            v[i][j]=v[i-1][j];
        }
        int idx=s[i]-'a';
        v[i][idx]++;
    }
    int res=0;
    for(int i=1;i<n;i++){
        int cnt=0;
        for(int j=0;j<26;j++){
            if(v[i][j] && v[n][j]>v[i][j]) cnt++;
        }
        res=max(res,cnt);
    }
    cout<<res<<endl;
}


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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  double sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum +=1/a[i];
  }
  double ans=1/sum;
  cout << fixed <<setprecision(100);
  cout << ans << endl;
}

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

int main(){
  int n,k;
  string s;
  cin >> n >> s >> k;

  for(int i=0;i<n;i++){
    if(s.at(k-1) != s.at(i)) s.at(i) = '*';
  }

  cout << s << endl;
}


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


using namespace std;

int main() {
	int64_t N;
	cin >> N;
	int64_t ans = 1;
	for (int i = 0; i < 100000; i++) {
		if (N == 1) {
			break;
		}
		else {
			++ans;
			N = N / 2;
		}
	}
	int64_t answer=1;
	while (ans != 0) {
		answer = answer * 2;
		--ans;
	}

		cout << answer-1 << endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 10L^^15;

void main() {
    int n, w;
    scan(n, w);

    auto ws = new int[](n);
    auto v = new int[](n);
    int vs;

    foreach (i ; 0 .. n) {
        scan(ws[i], v[i]);
        vs += v[i];
    }

    auto dp = new long[](vs + 1);
    dp[] = inf;
    dp[0] = 0;

    foreach (i ; 0 .. n) {
        foreach_reverse (j ; 0 .. vs - v[i] + 1) {
            dp[j + v[i]] = min(dp[j + v[i]], dp[j] + ws[i]);
        }
    }

    foreach_reverse (i ; 0 .. vs + 1) {
        if (dp[i] <= w) {
            writeln(i);
            return;
        }
    }
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define fk first
#define sv second

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

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

  int m = str.length();
  REP(i, m) {
    cout << str[i];
    i++;
  }
  cout << endl;
}

Measured memory_bytes: 592
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){
    int n,k; cin>>n>>k; 
    int a[n+1],ans=1000000000LL;
    for (int i=1;i<=n;i++) cin >> a[i] ; 
    sort(a+1,a+n+1);
    for (int i=k;i<=n;i++)
        ans = min(ans,a[i]-a[i-k+1]);
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 4380
def ip():
    return int(input())
    
def ipp():
    return map(int,input().split())
    
def sar():
    return list(ipp())
    
def pars(a):
    print(''.join(list(map(str, a))))
    print('\r')
    
def parl(a):
    print('\r'.join(list(map(str, a))))
    print('\r')
    
#template ends   

if __name__=='__main__':
    T=1
    #T=int(input().strip())
    for _ in range(T):
        a,b = ipp()
        if a+b == 15:
            print('+')
        elif a*b==15:
            print('*')
        else:
            print('x')

Measured memory_bytes: 3064
import itertools
n,k=map(int, input().split())
A=[int(i) for i in input().split()]
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse = True)
    return divisors
divlis = make_divisors(sum(A))

for res in divlis:
    tmp = [i%res for i in A]
    tmp.sort()
    tmp_l = [0]+list(itertools.accumulate(tmp))
    tmp_r = [0]*(n+1)
    
    for i in range(n-1,-1,-1):
        tmp_r[i] = tmp_r[i+1] + res-tmp[i]

    for i in range(n+1):
        if(tmp_l[i]==tmp_r[i] and tmp_l[i]<=k):
            print(res)
            exit()


Measured memory_bytes: 74544
#include<stdio.h>
#include<string.h>
int main()
{
    int p,i,count=0,r=0;
    char ar[100000];
    scanf("%s",ar);
    p=strlen(ar);
    if(ar[0]=='A')
    {
        for(i=1;i<p;i++)
        {
            if(i>1 && i!=p-1)
            {
                if(ar[i]=='C') count++;
            }
            if(ar[i]>='A' && ar[i]<='Z' && ar[i]!='C' && ar[i]!='A') r++;
        }
        if(count==1 && r==0) printf("AC\n");
        else printf("WA\n");
    }
    else printf("WA\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main() {

    int A, B;
    cin >> A >> B;

    for (int i = 1; i <= 1250; ++i) {
        if (((int) (i * 0.08) == A) and ((int) (i * 0.1) == B)) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

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

    int s, m, h;

    h = seconds/3600;
    m = seconds/60 - h*60;
    s = seconds - m * 60 - h*3600;

    cout << h << ":" << m << ":" << s << endl;

    return 0;
}


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

int main() {
    string S;
    cin >> S;
    int N = S.length();
    int A=0,B=0;
    for(int i =0;i<N/2;i++){
        A+=S.at(2*i)-'0';
        B+=S.at(2*i+1)-'0';
    }
    if(N%2==1){
        A+=S.at(N-1)-'0';
    }
    int X=0;
    if(N%2==0){
        X=min(A+N/2-B,N/2-A+B);
    }else
    {
        X=min(A+N/2-B,N/2+1-A+B);
    }
    cout << X << endl;
    
}

Measured memory_bytes: 512
s = [0] *5
for i in range(5):
    s[i] = int(input())

time = 0
fast1 = 10
lost = False
for i in range(5):
    if s[i] % 10 != 0:
        time += (s[i]//10 + 1)*10
        lost = True
        if fast1 > s[i]%10:
           fast1 = s[i]%10
        # print(str(time)+" "+str(fast1))
    else:
        time += s[i]
if lost:
    time += fast1-10


print(time)

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            B();
        }

        static void B()
        {
            var s = Read();
            var start = s.IndexOf('A');
            var end = s.LastIndexOf('Z');
            Println(s.Slice(start, end+1).Length);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static IList<string> ReadSplit() => Read().Split().ToList();
        static IList<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();

        static void Print(object value = null) => Console.Write(value.ToString());
        static void Println(object value = null) => Console.WriteLine(value.ToString());
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13224
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - Alchemist
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50;

/* typedef */

/* global variables */

int vs[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", vs + i);
  sort(vs, vs + n);

  double sum = vs[0];
  for (int i = 1; i < n; i++)
    sum = (sum + vs[i]) / 2;

  printf("%.8lf\n", sum);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using lli =  long long int ; using namespace std;
bool isprime(lli n); lli gcd(lli a, lli  b);
lli lcm(lli n, lli m); lli fact(lli n);
double dgr(double a); int fixMod(int a, int b);
long long  ncr(int n, int r); void fast();
int main() {
	fast();
	lli a, p; cin >> a >> p;
	if (a <= 5)cout << 0;
	else if (a >= 6 && a <= 12)cout << p / 2;
	else cout << p;
	//cout << (a * 3 + p) / 2 << endl;
}
void fast() { ios::sync_with_stdio(false); cin.tie(0);// cout.tie(0);
#ifndef ONLINE_JUDGE //freopen("input.in", "r", stdin); //freopen("output.out", "w", stdout);
#endif 
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int N;
    double n,probability;
    scanf("%d",&N);
    if (N==1)
    {
    	printf("1.0000000000");
	}
	else
	{
		if (N%2==0)
		{
			printf("0.5000000000");
		}
		else
		{
			probability=((N-1)/2.0+1.0)/N;
			printf("%.10f",probability);
		}
	}
    return 0;
}

Measured memory_bytes: 128
import java.lang.Math.abs
import java.lang.Math.sqrt

fun main(args: Array<String>) {
    val (x, n) = readIntList()
    if (n == 0) {
        println(x)
        return
    }
    val p = readIntList()
    val notP = (0..101).map { it }.subtract(p)

    var ans = Int.MAX_VALUE
    var min = Int.MAX_VALUE
    notP.forEach {
        if (abs(it - x) < min) {
            min = abs(it - x)
            ans = it
        }
    }
    println(ans)
}


// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 36908
program main

  ! <module> to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none
    
  ! variables for this <program>
  integer(kind=INT8) :: A, B, K
  integer(kind=INT8) :: itr_fctr, fctr_max, counter
  
  ! STEP.01
  ! read out the data
  read *, A, B, K
  
  ! STEP.02
  ! search the target divisor
  fctr_max = min (A, B)
  counter  = 0_INT8
  
  do itr_fctr = fctr_max, 1_INT8, -1_INT8

    if ( mod (A, itr_fctr) .eq. 0_INT8 .and. mod (B, itr_fctr) .eq. 0_INT8 ) counter = counter + 1_INT8

    if (counter .eq. K) then
      print '(I0)', itr_fctr
      exit
    end if

  end do

end program main

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

int main(void){
    int h, n;
    cin >> h >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    cout << ((h <= accumulate(all(a),0)) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 640
import math

n = int(input())
ans = [0]*n
for x in range(1, int(math.sqrt(n))):
    for y in range(1, int(math.sqrt(n))):
        for z in range(1, int(math.sqrt(n))):
            res = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if res <= n:
                ans[res - 1] += 1
for i in range(n):
    print(ans[i])


Measured memory_bytes: 9308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const long double pi = 3.141592653589793;



int main(){
    ll N, M, Q;
    cin>>N>>M>>Q;
    vector<vector<ll>> X(N, vector<ll>(N, 0));
    rep(i, M){
        ll L, R;
        cin>>L>>R;
        L--; R--;
        X[L][R]++;
    }
    for(ll i=N-2; i>=0; i--){
        for(ll j=i+1;j<N; j++){
            X[i][j]+=X[i+1][j]+X[i][j-1]-X[i+1][j-1];
        }
    }
  	/*rep(i, N){
      rep(j, N){
        cout<<X[i][j]<<" ";
      }
      cout<<endl;
    }*/
    rep(i, Q){
        ll p, q;
      	cin>>p>>q;
      	p--; q--;
        cout<<X[p][q]<<endl;
    }
}

Measured memory_bytes: 2944
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sn = new Scanner(System.in);
        int N = sn.nextInt();
        int amari = N % 10;
        String unit = "";

        switch (amari) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                unit = "hon";
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                unit = "pon";
                break;
            case 3:
            unit = "bon";
            break;
        }

        System.out.println(unit);
    }
}

Measured memory_bytes: 35784
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mxsize (int)1e6
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
#define UM unordered_map<int,int>
#define MP map<int,int>
void yn(bool check){
    if(check)	cout<<"YES\n";
    else		cout<<"NO\n";
}
ll a[200005];
bool isvalid(ll ans,ll k,ll n){
    for(int i=0;i<n;i++){
        if(a[i]%ans==0)
            k-=a[i]/ans-1;
        else
            k-=a[i]/ans;
    }
    return k>=0;
}
void fun(){
    ll n,k;
    cin>>n>>k;
    fi(0,n) cin>>a[i];
    int l=1,r=(int)1e9+100,ans;
    while(l<=r){
        ll mid=l+(r-l)/2;
        if(isvalid(mid,k,n)){
            r=mid-1;
            ans=mid;
        }
        else{
            l=mid+1;
        }
    }
    cout<<ans<<"\n";

}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("/ATOM/input.txt", "r", stdin);
        freopen("/ATOM/output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--){
        fun();
    }
}

Measured memory_bytes: 5200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int A, B;
	cin >> A >> B;//白黒

	vector<vector<char>> ans(100, vector<char>(100, '#'));//黒で初期化
	
	//下半分を白で初期化
	for (Int i = 50; i < 100; i++) {
		for (Int j = 0; j < 100; j++) {
			ans[i][j] = '.';
		}
	}

	A--;
	B--;

	Int flag = 0;
	for (Int i = 0; i < 50; i+=2) {
		for (Int j = 0; j < 100; j+=2) {
			if (A > 0) {
				ans[i][j] = '.';
				A--;
			}
			else {
				flag = 1;
				break;
			}
		}
		if (flag)break;
	}

	flag = 0;
	for (Int i = 51; i < 100; i += 2) {
		for (Int j = 0; j < 100; j += 2) {
			if (B > 0) {
				ans[i][j] = '#';
				B--;
			}
			else {
				flag = 1;
				break;
			}
		}
		if (flag)break;
	}

	cout << 100 << " " << 100 << "\n";
	for (Int i = 0; i < 100; i++) {
		for (Int j = 0; j < 100; j++) {
			cout << ans[i][j];
		}
		cout << "\n";
	}

}


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

int main() {
  string a, b;
  cin >> a >> b;
  int x = stoi(a + b);
  
  for(int i = 0; i < 1000; i++) {
    if(i * i == x) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace ARC073D
{
    public class WeightValuePair
    {
        public long Weight { get; }
        public long Value { get; }

        public WeightValuePair(long weight, long value)
        {
            Weight = weight;
            Value = value;
        }
    }

    public class Program
    {
        WeightValuePair[][] G;
        int N;
        long W;

        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            N = ss.Next(int.Parse);
            W = ss.Next(long.Parse);
            G = ss.Next(long.Parse, 2, N)
                .Select(a => new WeightValuePair(a[0], a[1]))
                .GroupBy(wv => wv.Weight)
                .OrderBy(g => g.Key)
                .Select(g => g.OrderByDescending(wv => wv.Value).ToArray())
                .ToArray();

            sw.WriteLine(GetAns(0, 0, 0));
            //---------------------------------
        }

        long GetAns(int num, long totalWeight, long totalValue)
        {
            if (num >= G.Length)
            {
                return totalWeight > W ? long.MinValue : totalValue;
            }

            var ret = long.MinValue;

            for (var i = 0; i <= G[num].Length; i++)
            {
                if (i != 0)
                {
                    totalWeight += G[num][i - 1].Weight;
                    totalValue += G[num][i - 1].Value;
                }
                ret = Math.Max(ret, GetAns(num + 1, totalWeight, totalValue));
            }

            return ret;
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            new Program().Solve(ss, sw);
            sw.Flush();
        }

        static readonly Func<string, string> String = s => s;
    }

    public class StreamScanner
    {
        static readonly char[] Sep = { ' ' };
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }
}

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

using namespace std;

#define vit vector<int>::iterator
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fr first
#define sc second
#define skip continue
#define PI 3.14159265

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int ui;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;

const int INF = 1e9 + 5;
const long long MAXN=2e5 + 5;;

void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool cmp(const string& a, const string& b) {
	return (a + b) < (b + a);
}

vector<int> Reversed(const vector<int>& s){
   vector<int> d = s;
   reverse(all(d));
   return d;
}

void solve(){
    ull a, b, c;
    cin >> a >> b >> c;
    ull cnt = 0;
    cout << (b + c) / c - (a + c - 1) / c << endl;
}


int main(){
    //freopen("slalom.in","r",stdin);
    //freopen("slalom.out","w",stdout);
    //faster();
    int n = 1;
    //cin >> n;
    while(n--){
        solve();
        cout << endl;
    }
    //fclose(stdout);
}


Measured memory_bytes: 3656
def partition(A,p,r):
    x = A[r]
    i = p-1

    for j in range(p,r):
        if A[j] <= x:
            i += 1
            A[i],A[j] = A[j],A[i]
    A[i+1],A[r] = A[r],A[i+1]

    return i+1

n = int(input())
A = list(map(int,input().split()))

r = partition(A,0,n-1)

for i in range(n):
    if i == r and i == n-1:
        print("["+str(A[i])+"]",end="")
    elif i == r:
        print("["+str(A[i])+"]",end=" ")
    elif i == n-1:
        print(A[i],end="")
    else:
        print(A[i],end=" ")
print()


Measured memory_bytes: 16396
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define pii                 pair<int,int>
#define vi                  vector<int>
#define vii                 vector<std::vector<int>> v;
#define begToEnd            v.begin(),v.end()
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define sonic               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define itr(it,c)           for(auto const &it : c)
#define all(c)              c.begin(), c.end()
#define ff                  first
#define ss                  second
#define INF                 INT_MAX
#define REPl(i,a,b)         for (ll i=a;i<b;i++)
#define REPi(i,a,b)         for (ll i=a;i<b;i++)
//*******Uer-Defined Functions*********//

//*******Functions end here************//
//*******Main func starts**************//
int main()
{
/*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
*/
    sonic;

    long long n;
    cin >> n;
    string res = "";
    while (n)
    {
    	n = n - 1;
    	res += 'a' + n%26;
    	n = n/26;
    }
    reverse(all(res));
    cout << res << endl;

    /*vector<char> ch;
    ch.pb('0');
    for (char c = 'a';c <= 'z';c++)
    	ch.pb(c);
    int n;
    cin >> n;
    deque <char> q;
    int rem = 0;
    while (n > 0)
    {
    	rem = n%26;
    	if (rem != 0)
    		q.push_front(ch[rem]);
    	else
    		q.push_front(ch[26])
    	n = n/26;
    }
    while (!q.empty())
    {
    	char x = q.front();
    	q.pop_front();
    	cout << x << "";
    }*/
}
//******Main Ends here****************//

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
int main() {
  int N,M,L;
  cin >> N >> M >> L;
  vector<vector<int>> Road(N,vector<int>(N,INF));
  for (int i=0; i<N; i++){
    Road.at(i).at(i) = 0;
  }
  for (int i=0; i<M; i++){
    int workA,workB,workC;
    cin >> workA >> workB >> workC;
    Road.at(workA-1).at(workB-1) = workC;
    Road.at(workB-1).at(workA-1) = workC;
  }
  int Q;
  cin >> Q;
  vector<vector<int>> Query(Q,vector<int>(2));
  for (int i=0; i<Q; i++){
    cin >> Query.at(i).at(0) >> Query.at(i).at(1);
  }
   
  for (int i=0; i<N; i++){
    for (int j=0; j<N; j++){
      for (int k=0; k<N; k++){
        Road.at(j).at(k) = min(Road.at(j).at(k), Road.at(j).at(i) + Road.at(i).at(k));
      }
    }
  }
  vector<vector<int>> Supply(N,vector<int>(N,INF));
  for (int i=0; i<N; i++){
    Supply.at(i).at(i) = 0;
  }
  for (int i=0; i<N; i++){
    for (int j=0; j<N; j++){
      if(Road.at(i).at(j) <= L){
        Supply.at(i).at(j) = 1;
      }
    }
  }
  for (int i=0; i<N; i++){
    for (int j=0; j<N; j++){
      for (int k=0; k<N; k++){
        Supply.at(j).at(k) = min(Supply.at(j).at(k), Supply.at(j).at(i) + Supply.at(i).at(k));
      }
    }
  }
  
  for (int i=0; i<Q; i++){
    int workS,workT;
    workS = Query.at(i).at(0)-1;
    workT = Query.at(i).at(1)-1;
    if (Supply.at(workS).at(workT) >= INF){
      cout << -1 << endl;
    }
    else {
      cout << Supply.at(workS).at(workT)-1 << endl;
    }
  }
}  

Measured memory_bytes: 6144
#include<bits/stdc++.h>
#define int         int long long
#define pb          push_back
#define pii         pair<int,int>
#define vi	        vector<int>
#define mii        map<int,int>
#define fs           first
#define sc          second
#define  M        1000000007
#define fr for(int i=0;i<n;i++)
#define f(i,a,b) for(int i=a;i<b;i++)
#define fm(i,a,b) for(int i=a;i>b;i--)
    
using namespace std;

signed main()
{	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int test=1;
    //cin>>test;
    while(test--){
        int n;
        cin>>n;
        map<string,int> m;
        string s;
        f(i,0,n){
        	cin>>s;
        	if(m.find(s)!=m.end()){
        		m[s]++;
        	}
        	else m[s]=1;
        }
        int ma=0;
        for(auto u:m){
        	if(u.sc>ma) ma=u.sc;
        }
        std::vector<string> v;
        for(auto u:m){
        	if(u.sc==ma){
        		v.pb(u.fs);
        	}
        }
        sort(v.begin(),v.end());
        for(auto u:v) cout<<u<<"\n";

    }
    return 0;
}       

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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100001;

int a,b,c,d;
int main() {
	ios_base::sync_with_stdio(0);
	cin >> a >> b >> c >> d;
	if (a * b >= c * d)
		cout << a * b << endl;
	else
		cout << c * d << endl;
  	return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
    int n,a,i,b[200],s=0,count=1;
    cin >> n >> a;
    for(i=0; i<n; i++)
    {
        cin >> b[i];
        s = s+b[i];
        if(s<=a){
            count++;
        }
    }
    cout << count << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int N;
	string S;
	cin >> N >> S;
	set<int> idx[3];
	int ind = 0;
	for(auto it : S){
		if(it == 'R') idx[0].insert(ind++);
		else if(it == 'G') idx[1].insert(ind++);
		else idx[2].insert(ind++);
	}
	ll ans = 0;
	for(auto it1 : idx[0]){
		for(auto it2 : idx[1]){
			int idx1 = it1, idx2 = it2;
			if(idx1 > idx2) swap(idx1,idx2);
			int dif = idx2-idx1;
			int cnt = idx[2].size();
			// first case
			if(idx[2].lower_bound(idx2+dif) != idx[2].end() && *(idx[2].lower_bound(idx2+dif)) == idx2+dif) cnt--;
			// second case
			if(idx[2].lower_bound(idx1-dif) != idx[2].end() && *(idx[2].lower_bound(idx1-dif)) == idx1-dif) cnt--;
			// third case
			if(!((idx1+idx2)&1) && idx[2].lower_bound((idx1+idx2)/2) != idx[2].end() && *(idx[2].lower_bound((idx1+idx2)/2)) == (idx1+idx2)/2) cnt--;
			ans += (ll)cnt;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3852
#include <iostream>

using namespace std;

int main() {
    int x,m=0,n=0;
    bool t=0;
	string a,b;
	cin>>a>>b;
	x=a.size();
	if(a.size()<b.size()){
        x=b.size();
        n=1;
}
if(a.size()>b.size()){
        x=a.size();
        m=1;
}

	for(int i=0;i<x;i++){
	    if(t==0)
        cout<<a[i]<<b[i];
    else if(m==1)
        cout<<a[i];
    else if(n==1)
        cout<<b[i];
        if(i==a.size()-1||i==b.size()-1)
        t=1;
}
		cout<<endl;

	return 0;
}


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

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; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N; cin>>N;
    ll res = 0;
    rep(i,N){
        ll l,r;
        cin>>l>>r;
        res += (r - l + 1);
    }
    cout<<res<<endl;
}


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

using namespace std;

int main(){
    int N; cin >> N;
    vector<long long> L(N), R(N);
    for(int i=0;i<N;i++) cin >> L[i] >> R[i];
    auto maxL = *max_element(L.begin(), L.end());
    auto minR = *min_element(R.begin(), R.end());
    long long res = 0;
    for(int i=0;i<N;i++){
        res = max(res, max(0LL, minR-maxL+1) + R[i] - L[i] + 1);
    }
    vector<pair<long long, long long>> vp;
    for(int i=0;i<N;i++) vp.emplace_back(L[i], R[i]);
    sort(vp.begin(), vp.end(), [](auto& a, auto& b){ return a.second != b.second ? a.second > b.second : a.first > b.first; });
    vector<long long> tl(N), tr(N);
    tl.back() = vp.back().first;
    for(int i=N-2;i>=0;i--) tl[i] = max(tl[i+1], vp[i].first);
    tr[0] = vp[0].second;
    for(int i=1;i<N;i++) tr[i] = min(tr[i-1], vp[i].second);
    for(int i=1;i<N;i++){
        res = max(res, max(0LL, tr[i-1]-maxL+1) + max(0LL, minR-tl[i]+1));
    }
    cout << res << endl;
}

Measured memory_bytes: 4976
from collections import deque
import math

N = int(input())
side = [[]for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    side[a-1].append(b-1)
    side[b-1].append(a-1)
ans = [0]*N
ans[0] = 1
queue = deque([0])
count = [0,1,0]
while queue:
    q = queue.popleft()
    for i in side[q]:
        if ans[i] == 0:
            ans[i] = ans[q]%2 + 1
            count[ans[i]] += 1
            queue.append(i)
if max(count) <=N - (N+1)//3:
    X = [3,2,2]
    X[count.index(max(count))] = 1
    for i in range(N):
        if X[ans[i]] <= N:
            X[ans[i]] += 3
            ans[i] = X[ans[i]]-3
        else:
            ans[i] = X[0]
            X[0] += 3
else:
    Y = 3 - count.index(max(count))
    Z = 3 - Y
    X = 3
    for i in range(N):
        if ans[i] == Y:
            ans[i] = X
            X += 3
    W = 1
    for i in range(N):
        if ans[i] == Z:
            ans[i] = W
            W += 1
            if W%3 == 0 and W < X:
                W += 1
print(*ans)
            





Measured memory_bytes: 97076
#include <iostream>
#include <math.h>
using namespace std;

int main(void) {
  
  string S;
  
  cin >> S;
  
  if ( S == "Sunny" ) {
    
    cout << "Cloudy" << endl;
  }
  
  else if ( S == "Cloudy" ) {
    
    cout << "Rainy" << endl;
  }
  
  else if ( S == "Rainy" ) {
    
    cout << "Sunny" << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll x){
    if(x%4==0) return x;
    if(x%4==1) return 1;
    if(x%4==2) return x+1;
    return 0;
}
int main()
{
    ll a,b;
    scanf("%lld%lld",&a,&b);
    ll ans=f(b)^f(a-1);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256