akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
    int n,i,j,c[40]={},kb[40];
    long k,a,ans=0;
    scanf("%d%ld",&n,&k);k++;   //K+1に差し替え、0≤X<K とする。
    for(i=0;i<n;i++){
        scanf("%ld",&a);
        for(j=0;j<40;j++){
            c[j]+=a%2;a>>=1;    //j桁目にある1の数だけ保存。
        }
    }
    for(i=0;i<40;i++){          //Kを2進展開。
        kb[i]=k%2;k>>=1;
    }
    for(i=0;i<40;i++){
        if(kb[i]){
            //i桁目1のKに対し、i+1以上の桁がKに等しく、i桁目0のX
            //つまり、1~i-1桁目を独立に決定できるX
            long s=0; //f(X)。(1<<桁数)*その桁が1であるAxorXを足す
            //i+1以上の桁はkに等しい
            for(j=39;j>i;j--)s+=(1l<<j)*(kb[j]?(n-c[j]):c[j]);
            s+=(1l<<i)*c[j]; //i桁目は0
            //1~i-1桁目はj桁目に1が多ければ0, 0が多ければ1
            for(j=0;j<i;j++)s+=(1l<<j)*(c[j]>n/2?c[j]:n-c[j]);
            ans=ans>s?ans:s;
        }
    }
    printf("%ld",ans);
}

Measured memory_bytes: 128
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;
 
int main(){
string s;
cin>>s;

string t;
rep(i,0,(s.size()+1)/2){
    cout<<s[i*2];
}
cout<<endl;
return 0;
}

Measured memory_bytes: 512
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std

Jehian Norman Saviero;

// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;

// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")

// MACROS FOR ATTRIBUTE
#define fi first
#define se second

// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))

// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	int N;
	sci(N);
	vi dat(N);
	for (int i = 0; i < N; ++i) {
		sci(dat[i]);
	}
	bool valid = 1;
	for (int i = 0; i < N && valid; ++i) {
		if (dat[i] & 1) continue;
		valid = dat[i] % 3 == 0 || dat[i] % 5 == 0;
	}
	puts(valid ? "APPROVED" : "DENIED");
	return 0;
}

Measured memory_bytes: 256
//IOI 2021

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 100 * 1000 + 17;

int n, a[MAXN], mx, p[MAXN];
ll sum;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	sum += a[1] - 1;
	mx = 1;
	for (int i = 2; i <= n; i++) {
		if (a[i] == mx + 1) {
			mx++;
			continue;
		}
		sum += (a[i] - 1) / (mx + 1);
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 640
n = int(input())
diff=[int(s) for s in input().split()]
diff.sort()
MOD=10**9+7

# 奇数の場合は先頭のみ0
start=0
if n&1==1:
    start=1
    if diff[0]!=0:
        print(0)
        exit()

ans=1
for i in range(start,n,2):
    # 中央以外の0は矛盾
    if diff[i]==0:
        print(0)
        exit()
    
    # 必ず左右対称である必要がある
    if diff[i]!=diff[i+1]:
        print(0)
        exit()

    ans=ans*2%MOD

print(ans)

Measured memory_bytes: 13812
#coding:utf-8
import sys
import bisect

if __name__ == "__main__":
    A, B, Q = map(int, input().split())
    S = [-sys.maxsize] + [int(input()) for _ in range(A)] + [sys.maxsize]
    T = [-sys.maxsize] + [int(input()) for _ in range(B)] + [sys.maxsize]

    for _ in range(Q):
        x = int(input())
        sx = bisect.bisect_left(S, x)
        tx = bisect.bisect_left(T, x)
        result = sys.maxsize
        for s in [S[sx-1], S[sx]]:
            for t in [T[tx-1], T[tx]]:
                result = min(result, abs(s-x)+abs(t-s), abs(t-x)+abs(s-t))

        print(result)

Measured memory_bytes: 12800
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template <typename T> long double rad(const T& d){return d*M_PI/180.0;};
template <typename T> long double deg(const T& r){return r*180.0/M_PI;};
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    long double a,b,h,m;
    cin >> a >> b >> h >> m;

    long double aco = cos(rad(0.5 * (h*60+m)));
    long double asi = sin(rad(0.5 * (h*60+m)));

    long double bco = cos(rad(6.0 * m));
    long double bsi = sin(rad(6.0 * m));

    long double x1 = a * aco;
    long double y1 = a * asi;
    long double x2 = b * bco;
    long double y2 = b * bsi;

    cerr << "("<<x1<<","<<y1<<")"<<endl;
    cerr << "("<<x2<<","<<y2<<")"<<endl;


    cout << sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) << endl;
}

Measured memory_bytes: 3616
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int a[]=new int[n];
        long s=0, c=(long)n*(n+1)/2;
        String ans="YES";
        for(int i=0; i<n; i++) {a[i]=sc.nextInt(); s+=a[i];}

        if(s%c==0){
            long d,k=s/c;
            for(int i=0; i<n; i++) {
                d=a[(i+1)%n]-a[i]-k;
                if(d<=0 && d%n==0)continue;
                else {ans="NO";}
            }
        }
        else ans="NO";
  
        out.println(ans);
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 38132
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    string s; cin >> s;
    int ct = 0;
    rep(i,s.size()) {
        if (s[i] == '1') ct++;
    }
    cout << ct << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

long modinv(long a){long M=MOD,b=M,u=1,v=0;while(b)u-=a/b*v,swap(u,v),a%=b,swap(a,b);return (u%M+M)%M;}

int main(void) {
  cout.precision(12);

  long N, A, B, C;
  cin >> N >> A >> B >> C;

  long foo = 100 * modinv(A+B);
  foo %= MOD;

  long winA = (A * modinv(A + B)) % MOD;
  long winB = (B * modinv(A + B)) % MOD;

  vector<long> winAary(100010);
  vector<long> winBary(100010);
  winAary[0] = 1;
  winBary[0] = 1;
  for (long i = 1; i < 100010; i++) {
    winAary[i] = (winA * winAary[i-1]) % MOD;
    winBary[i] = (winB * winBary[i-1]) % MOD;
  }

  vector<long> kaijo(200020);
  kaijo[0] = 1;
  for (long i = 1; i < 200020; i++) {
    kaijo[i] = (kaijo[i-1] * i) % MOD;
  }

  long result = 0;
  for (long i = 0; i < N; i++) {
    long aaa = kaijo[N - 1 + i];
    aaa = aaa * modinv(kaijo[N - 1]);
    aaa %= MOD;
    aaa = aaa * modinv(kaijo[i]);
    aaa %= MOD;

    long _winA = winAary[N - 1] * winBary[i];
    _winA %= MOD;
    _winA *= aaa;
    _winA %= MOD;
    _winA *= (N+i);
    _winA %= MOD;
    _winA *= winA;
    _winA %= MOD;
    result += _winA;

    long _winB = winBary[N - 1] * winAary[i];
    _winB %= MOD;
    _winB *= aaa;
    _winB %= MOD;
    _winB *= (N+i);
    _winB %= MOD;
    _winB *= winB;
    _winB %= MOD;
    result += _winB;

    result %= MOD;
  }

  //cout << "result: " << result << ", foo: " << foo << endl;

  result *= foo;
  result %= MOD;

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 3328
//****** @author mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void solve() {
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22){
        cout<<"bust"<<endl;
    } else{
        cout<<"win"<<endl;
    }

}
int main()
{
    IOS;
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>
using namespace std;
int main(void) {
	stack<int>s;
	int n;
	while (cin >> n) {
		if (n == 0) {
			cout << s.top() << endl;
			s.pop();
		}
		else {
			s.push(n);
		}
	}
	return 0;
}

Measured memory_bytes: 3112
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

const int maxn=1e5+5;
int n,a[maxn];
struct stu{
	int idx,total;
	bool operator <(const stu& s)const{
		if(total!=s.total) return total<s.total;
	}
}s[maxn];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		s[i].idx=i;
		s[i].total=a[i];
	} 
	sort(s+1,s+n+1);
	for(int i=1;i<=n;i++)
	{
		cout<<s[i].idx<<" ";
	}
/*	for(int j=1;j<=n;j++)
	{
		for(int i=1;i<=n;i++)
		{
			if(j==a[i]) cout<<i<<" ";
		}
	}*/ 
	
	return 0;
} 

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define repz(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

using namespace std;
void debug_out(){ cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
  cout << H << " ";
  debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
// 1E+9 +7
const ll mod = 1000000000+7;
int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n; cin >> n;
  cout << (n+2-1)/2 << endl;
  
  return 0;
}


Measured memory_bytes: 256
from itertools import permutations

k = int(input())

points = {tuple(map(int, input().split())) for _ in range(k)}

for perm in permutations(range(8), 8):
    test = {(i, perm[i]) for i in range(8)}
    if test & points == points:
        flg = 0
        for x, y in test:
            diag = {(x - i, y - i) for i in range(1, min(x, y) + 1)} | {(x + i, y + i) for i in range(1, min(7 - x, 7 - y) + 1)} | {(x - i, y + i) for i in range(1, min(x, 7 - y) + 1)} | {(x - i, y + i) for i in range(1, min(7 - x, y) + 1)}
            if diag & test == set():
                flg += 1
        if flg == 8:
            ans = test
            break

for i in range(8):
    col = ""
    for j in range(8):
        if (i,j) in ans:
            col += "Q"
        else:
            col += "."
    print(col)



Measured memory_bytes: 5668
def main():
    n, k = (int(i) for i in input().split())
    a = [int(i) for i in input().split()]
    MOD = 10**9 + 7
    ans = 0
    alpha = 0
    for i in range(n):
        for j in range(i+1,n):
            if a[i] > a[j]:
                alpha += 1
    ans = ans + (alpha * k)%MOD

    beta = 0
    for i in range(n):
        for j in range(n):
            if a[i] > a[j]:
                beta += 1
    ans = ans + (((k*(k-1)) // 2) * (beta) ) %MOD
    ans = ans % MOD
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42220
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int dot(int x1, int y1, int x2, int y2) {
    return x1 * x2 + y1 * y2;
}
i64 s, t, u, v;
int solve() {
    i64 x, y;
    cin >> x >> y;
    x -= s;
    y -= t;
    double d = double(dot(x, y, u, v)) / dot(u, v, u, v);
    printf("%.12f %.12f\n", d * u + s, d * v + t);
}
int main() {
    cin >> s >> t >> u >> v;
    u -= s;
    v -= t;
    int q;
    cin >> q;
    while (q--) solve();
    return 0;
}


Measured memory_bytes: 3228
a, b = map(int, input().split())

a_ = int(a / 0.08)
if a_ * 0.08 != float(a):
  a_ += 1

b_ = int(b / 0.1)
if b_ * 0.1 != float(b):
  b_ += 1

n = max(a_, b_)
if int(n * 0.08) == a and int(n * 0.1) == b:
    print(n)
else:
    print(-1)

Measured memory_bytes: 3064
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define endl "\n"
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);
const int size=1e6+10;
int spf[size];
void solve() {
    spf[0]=0;spf[1]=1;
    for(int i=2;i<size;i++){
        if(!spf[i]){
            for(int j=i;j<size;j+=i){
                if(!spf[j])spf[j]=i;
            }
        }
    }
    map<int,int> mp;
    int ans=0;
    int n;cin>>n;
    for(int i=0;i<n;i++){
        int num;cin>>num;
        int temp=fast_pow(num,MOD-2,MOD);
        ans+=temp;ans%=MOD;
        while(spf[num]!=1){
            int count=0;
            int div=spf[num];
            while(num%div==0){
                num/=div;
                count++;
            }
            mp[div]=max(mp[div],count);
        }
    }
    int lcm=1;
    for(auto x:mp){
        int temp=fast_pow(x.F,x.S,MOD);
        lcm=(lcm*temp)%MOD;
    }
    ans=(ans*lcm)%MOD;
    cout<<ans<<endl;
}
int32_t main() {
    IOS;
    int test = 1;
 //   cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 8704
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()
L = []
for i in range(M-1):
    L.append(X[i+1]-X[i])
L.sort()
a = (M-1) - (N-1)
if a >= 1:
    print(sum(L[:a]))
else:
    print(0)

Measured memory_bytes: 13840
import java.util.*;
import java.util.ArrayList;
public class Main{
	public static void main(String[] args) {
		int i,j;i=0;
		ArrayList<Integer> array=new ArrayList<Integer>();
		Scanner sc=new Scanner(System.in);
			for(;sc.hasNextInt();){
				array.add(i,sc.nextInt());
				if( array.get(i)==0){
                  System.out.println(array.get(i-1));i--;}
				else i++;
			
			
		}
	}
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<double>v(n); for(auto&&i:v)cin>>i;
	sort(v.begin(),v.end());
	for(int i=1;i<n;++i){
		v.at(i)=(v.at(i-1)+v.at(i))/2;
	}
	cout<<v.back()<<"\n"s;
}


Measured memory_bytes: 3828
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(), (a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//
int main() {
	int N, Q;
	cin >> N >> Q;
	struct Event {
		int t, q, x;
		bool operator < (const Event& e) const { return t < e.t; }
	};
	Vec< Event > event;
	for_(i,0,N) {
		int S, T, X;
		cin >> S >> T >> X;
		event.push_back(Event{S-X, 1, X});
		event.push_back(Event{T-X, 0, X});
	}
	sort(allof(event));
	multiset< int > stop;
	size_t e = 0;
	for_(i,0,Q) {
		int D;
		cin >> D;
		while (e < event.size() && event[e].t <= D) {
			if (event[e].q) stop.insert(event[e].x);
			else stop.erase(stop.lower_bound(event[e].x));
			++e;
		}
		cout << (stop.empty() ? -1 : *stop.begin()) << endl;
	}
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 16108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll A,B,K;
	cin>>A>>B>>K;
	if(A>=K){
		cout<<A-K<<" "<<B<<endl;
	}
	else{
		cout<<0<<" "<<max((ll)0,B-(K-A))<<endl;
	}

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)

int main()
{
	while (1)
	{
		int N, A, B, C, X;
		int Y[100];
		cin >> N >> A >> B >> C >> X;
		if (N == 0)break;
		REP(i, N)cin >> Y[i];
		int index = 0;
		if (Y[index] == X)
		{
			index++;
		}
		FOR(i, 0, 10002)
		{
			if (i >= 10001)
			{
				cout << -1 << endl;
				break;
			}
			if (index >= N)
			{
				cout << i << endl;
				break;
			}
			int temp = (A*X + B) % C;
			if (Y[index] == temp)index++;
			X = temp;
		}
	}
	return 0;
}

Measured memory_bytes: 3080
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val a = new Array[Long](n)
    for (i <- 0 until n) {
      a(i) = sc.nextLong
    }

    val st = scala.collection.mutable.Set.empty[Long]
    var flg = true
    var index = 0
    while (flg && index < n) {
      if (st.contains(a(index))) flg = false
      else st.add(a(index))
      index += 1
    }


    println(if (flg) "YES" else "NO")
  }
}


Measured memory_bytes: 72424
#include <iostream>
#include <string>
using namespace std;
int main(){
	string S;
  	int A=0,B=0;
  	cin >> S;
  	for(int i=0;i<3;i++){
    	if(S[i]=='A') A=1;
      	else if(S[i]=='B') B=1;
    }
  	if(A and B ==1) cout << "Yes" << endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
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; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
int main() {
	ll h,cnt=1,pp=0;
	cin >> h;
	while (true) {
		if (h <= 1)return cout << fixed << setprecision(0) << cnt << endl, 0;
		h /= 2;
		pp++;
		cnt += pow(2,pp);
	}
}

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

using namespace std;

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

int main() {
    //初期化
    int    ch[26] = {};
    string str;

    //処理
    while (cin >> str) {
        for (int i = 0; i < str.size(); i++) {
            if (!isalpha(str[i])) continue;
            if (isupper(str[i])) str[i] = tolower(str[i]);
            ch[str[i] - 'a']++;
        }
    }

    //出力
    rep(i, 26) {
        printf("%c : ", i + 'a');
        cout << ch[i] << "\n";
    }

    return 0;
}



Measured memory_bytes: 3276
fun main(args: Array<String>) {
    val array = IntArray(readLine()?.toInt()?.plus(1) ?: 0)
    readLine()?.split(" ".toRegex())
        ?.map(String::toInt)
        ?.forEachIndexed { index, value ->
            array[index + 1] = value
        }
    array.buildMaxHeap()
    println(" " + array.sliceArray(1..array.lastIndex).joinToString(" "))
}

fun IntArray.maxHeapify(index: Int) {
    val l = left(index)
    val r = right(index)
    var largest = if (l <= lastIndex && this[l] > this[index]) {
        l
    } else {
        index
    }
    if (r <= lastIndex && this[r] > this[largest]) {
        largest = r
    }
    if (largest != index) {
        swap(index, largest)
        maxHeapify(largest)
    }
}

fun IntArray.buildMaxHeap() {
    for (i in lastIndex / 2 downTo  1) {
        maxHeapify(i)
    }
}

fun IntArray.swap(i: Int, j: Int) {
    val tmp = this[i]
    this[i] = this[j]
    this[j] = tmp
}

fun parent(index: Int) = index / 2
fun left(index: Int) = index * 2
fun right(index: Int) = index * 2 + 1


Measured memory_bytes: 145592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int N;cin>>N;
    int cnt=0;
    for(int i=1;i<=N;i++){
        if(1<=i&&i<=9) cnt++;
        if(100<=i&&i<=999) cnt++;
        if(10000<=i&&i<=99999) cnt++;
    }
    
    cout<<cnt<<endl;
}


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

int main() {
  int N , A ;
  cin >> N >> A ;
  if (N % 500 == 0){
  	cout << "Yes" << endl;
  }else{
  	if(N % 500 <= A){
     cout << "Yes" << endl;
    }else{
     cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/5/ALDS1_5_B

n = int(input())
A = list(map(int, input().split()))
	
# マージソート
def merge_sort(arr, left, right):
	# merge_sort(lst, 0, len(lst))
	global cnt
	if right - left == 1:
		return 
	mid = left + (right - left) // 2
	merge_sort(arr, left, mid)
	merge_sort(arr, mid, right)
	a = [arr[i] for i in range(left, mid)] \
		+ [arr[i] for i in range(right - 1, mid - 1, -1)]
	iterator_left = 0
	iterator_right = len(a) - 1
	for i in range(left, right):
		cnt += 1
		if a[iterator_left] <= a[iterator_right]:
			arr[i] = a[iterator_left]
			iterator_left += 1
		else:
			arr[i] = a[iterator_right]
			iterator_right -= 1

cnt = 0
merge_sort(A, 0, n)
print(*A)
print(cnt)


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    double a, b, x; cin >> a >> b >> x;
    double ans;
    if(a * a * b /2 > x){
        double talpha = b * b * a / (x * 2);
        ans = 180 * atan(talpha) / M_PI;
    } else{
        double talpha = 2 * (a * a * b - x) / (a * a * a);
        ans = 180 * atan(talpha) / M_PI;
    }
    
    printf("%.11f\n", ans);

    return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

class Main {

    public static void main(String[] args) throws IOException {
        ReaderA.init(System.in);
        String S = ReaderA.next();
        int counter;
        Set<Character> used = new HashSet<>();
        for (int i = 0; i < S.length(); i++) used.add(S.charAt(i));


        if (S.length() < 26) {
            String ans = "";
            counter = S.length();
            for (int i = 0; i < 26; i++) {
                if (!used.contains((char)(i + 'a'))) {
                    ans = S.substring(0, counter) + (char) (i + 'a');
                    break;
                }
            }
            System.out.println(ans);
        }
        else {
            counter = S.length() - 2;
//            used.remove(S.charAt(counter + 1));
            for (int i = counter; i >= -1; i--) {
//                System.out.println(S.charAt(i) + " " + used);
                for (int j = S.charAt(i + 1) - 'a' + 1; j < 26; j++) {
                    if (!used.contains((char)(j + 'a'))) {
                        System.out.println(S.substring(0, i + 1) + (char) (j + 'a'));
                        return;
                    }
                }
                used.remove(S.charAt(i + 1));
            }
            System.out.println(-1);
        }
    }
}

/**
 * Reader class based on the article at "https://www.cpe.ku.ac.th/~jim/java-io.html"
 */
class ReaderA {
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

//    static int nextInt() throws IOException {
//        return Integer.parseInt(next());
//    }
//
//    static long nextLong() throws IOException {
//        return Long.parseLong(next());
//    }
//
//    //    Get a whole line.
//    static String line() throws IOException {
//        return reader.readLine();
//    }
//
//    static double nextDouble() throws IOException {
//        return Double.parseDouble(next());
//    }
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n;
  cin >> n;
  vi s(n);
  vi t;
  int sum = 0;
  rep(i,n){
    cin >> s[i];
    sum += s[i];
    if(s[i] % 10 != 0) t.push_back(s[i]);
  }
  sort(all(t));
  if(sum % 10 != 0){
    cout << sum << endl;
    return 0;
  }
  if(t.empty()){
    cout << 0 << endl;
    return 0;
  }
  sum -= t[0];
  cout << sum << endl;

}

Measured memory_bytes: 256
import fractions

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()
    return divisors

A,B=map(int,input().split())

gcd = fractions.gcd(A,B)
divs = make_divisors(gcd)

#print(divs)

ans=[]

for d in divs:
    
    is_so=True
    for i in range(1,len(ans)):
        if d % ans[i] == 0:
            is_so = False
#    print(str(d)+','+str(is_so))
    if is_so:
        ans.append(d)

print(len(ans))

Measured memory_bytes: 5216
using System;
using System.Linq;
 
class MainClass
{
    public static void Main()
    {
        while(true)
        {
            string[] str = Console.ReadLine().Split(' ');
            int h = int.Parse(str[0]);
            int w = int.Parse(str[1]);
 
            if (h == 0 && w == 0)
                break;
 
            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (i == 0 || i == h - 1 || j == 0 || j == w - 1)
                        Console.Write('#');
                    else
                        Console.Write('.');
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 8864
n = int(input())
a = list(map(int, input().split()))

from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in range(len(value)):
    if value[i] > 1:
        sv += (value[i]*(value[i]-1))//2
for i in range(n):
    cur = a[i]
    cursv = sv
    if acnt[cur] > 2:
        cursv = cursv - acnt[cur] + 1
    elif acnt[cur] == 2:
        cursv -= 1
    print(cursv)


Measured memory_bytes: 26912
#include <iostream>
#include <deque>
#include <string>

using namespace std;

class Process {
public:
    Process() {}
    Process(string name, int32_t t) : name(name), t(t) {}

    string name;
    int32_t t;
};

int main() {
    int64_t n;
    int32_t q;
    deque<Process> dq;

    cin >> n >> q;

    while (n--) {
        string name;
        int32_t t;
        cin >> name >> t;
        dq.push_back(Process(name, t));
    }

    int64_t sum = 0;
    while (!dq.empty()) {
        Process proc = dq.front();
        dq.pop_front();

        if (proc.t > q) {
            sum += q;
            proc.t -= q;
            dq.push_back(proc);
        } else {
            sum += proc.t;
            cout << proc.name << " " << sum << endl;
        }
    }

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    set<string> ss;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        ss.insert(s);
    }
    cout << ss.size() << endl;
    return 0;
}


Measured memory_bytes: 19228
import java.io.*;
import java.util.*;

// Solution class
class Solution {
    public Solution() { }
    private static final InputReader scan = new InputReader();
    // solve method
    public void solve() throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        // code goes here...
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        int count = 0;
        for (int i = a; i <= b; i++) {
            if (c % i == 0) {
                count++;
            }
        }
        out.println(count);

        out.close();
    }
}

// InputReader class
class InputReader {
    private final BufferedReader br;
    private StringTokenizer st = new StringTokenizer("");
    public InputReader() { br = new BufferedReader(new InputStreamReader(System.in)); }
    public String next() throws IOException {
        while (!st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException ie) { ie.printStackTrace(); }
        }
        return st.nextToken();
    }
    public String nextLine() throws IOException {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException ie) { ie.printStackTrace(); }
        return str;
    }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public long nextLong() throws IOException { return Long.parseLong(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
}

// Main class
public class Main {
    public Main() { }
    // driver method
    public static void main(String[] args) throws IOException {
        new Solution().solve();
    }
}



Measured memory_bytes: 24512
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N, K = map(int, input().split())
    
    res = K
    for i in range(N-1):
        res *= K - 1
    
    print(res)
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 63980
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int M=10000;
		for(;;)
		{
			int n=in.nextInt();//路線数
			int m=in.nextInt();//駅数
			if((n|m)==0)
				return;
			int cost[][]=new int[m+1][m+1];
			int time[][]=new int[m+1][m+1];
			for(int i=0;i<=m;i++)	{
				Arrays.fill(cost[i], M);
				Arrays.fill(time[i], M);}
			for(int i=0;i<=m;i++){
				cost[i][i]=0;
				time[i][i]=0;	}
			for(int i=0;i<n;i++)
			{
				int S=in.nextInt();
				int T=in.nextInt();
				int c=in.nextInt();
				int t=in.nextInt();
				cost[S][T]=c;
				cost[T][S]=c;
				time[S][T]=t;
				time[T][S]=t;
			}
			int nn=in.nextInt();
			for(int I=0;I<nn;I++)
			{
				int s=in.nextInt();
				int t=in.nextInt();
				int or=in.nextInt();
				if(or==0)
				{
					int p=0;
					int leng[]=new int[n+1];// minimum distance
					int v[] = new int[n+1];// decision flag
					for(int k=0;k<=m;k++)
					{
						leng[k]=M;
						v[k]=0;
					}
					leng[s]=0;
					for(int i=0;i<=m;i++)
					{
						int min=M;//最小の節点を探す
						for(int k=0;k<=m;k++)
						{
							if(v[k]==0&&leng[k]<min)
							{
								p=k;
								min=leng[k];
							}
						}
						v[p]=1;//確定フラグ
						for(int k=0;k<=m;k++) //pを経由してkに至長さがそれまでの最短経路より小さければ更新
						{
							if((leng[p]+cost[p][k])<leng[k])
								leng[k]=leng[p]+cost[p][k];
						}
					}
					System.out.println(leng[t]);
				}
				else
				{
					int p=0;
					int leng[]=new int[n+1];// minimum distance
					int v[] = new int[n+1];// decision flag
					for(int k=0;k<=m;k++)
					{
						leng[k]=M;
						v[k]=0;
					}
					leng[s]=0;
					for(int i=0;i<=m;i++)
					{
						int min=M;//最小の節点を探す
						for(int k=0;k<=m;k++)
						{
							if(v[k]==0&&leng[k]<min)
							{
								p=k;
								min=leng[k];
							}
						}
						v[p]=1;//確定フラグ
						for(int k=0;k<=m;k++) //pを経由してkに至長さがそれまでの最短経路より小さければ更新
						{
							if((leng[p]+time[p][k])<leng[k])
								leng[k]=leng[p]+time[p][k];
						}
					}
					System.out.println(leng[t]);
				}
			}
		}
	}
}

Measured memory_bytes: 14000
#include <stdio.h>

int main() {
    // insert code here...
    int i = 0;
    int size;
    scanf("%d",&size);
    int arr[size];
    int max[size];
    for(;i<size;i++){
        scanf("%d",&arr[i]);
    }
    
    for(int j = 0;j<size ;j++){
        max[j] = 0;
        //printf("%d番目です\n", j);
        for(int k = arr[j]; k%2==0;){
            k=k/2;
            //printf("k %d\n", k);
            max[j] += 1;
            //printf("max %d\n", max[j]);
        }
    }
    
    int m = max[0];
    for(int l = 0;l<size;l++){
        if(m>max[l]){
            m = max[l];
        }
    }
    printf("%d\n", m);
    return 0;
}


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

int main(void)
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((a-1)*(b-1)*(c-1)*(d-1)==0&&(a-4)*(b-4)*(c-4)*(d-4)==0&&(a-7)*(b-7)*(c-7)*(d-7)==0&&(a-9)*(b-9)*(c-9)*(d-9)==0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }

    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};

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

    int n;
    cin >> n;
    vector<int> pos(n);
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        int h;
        cin >> h;
        pos[--h] = i;
    }
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    // dp[i] := 区間 [0, i] における、花の美しさの総和の最大値
    SegmentTree<ll> dp(n + 5, [](ll a, ll b){return max(a, b);}, 0ll);
    for(int i = 0; i < n; ++i){
        // 更新前における区間 [0, pos[i]) の dp の最大値
        ll max_e = dp.query(0, pos[i]);
        dp.update(pos[i], max_e + a[pos[i]]);
    }
    cout << dp.query(0, n) << endl;
}

Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>
#include <queue>

constexpr long long INFLL = 1e18;

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int x;
    cin >> x;
    if (x >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
bool used[4];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int A, B;
    cin >> A >> B;
    used[A] = true;
    used[B] = true;
    for(int i = 1; i <= 3; i++){
        if(!used[i]) cout << i << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)

int const MOD = 1e9 + 7;
using namespace std;


int dp[100010], num[100010];
int32_t main(){
    int n;
    cin>>n;
    for(int i = 1; i<=n; i++)
        cin>>num[i];
    
    for(int i = 2; i<=n; i++)
        dp[i] = 1e9+7;

    dp[1] = 0;
    for(int i = 1; i<=n-1; i++){
        dp[i+1] = min(dp[i+1], dp[i] + abs(num[i] - num[i+1]));
        dp[i+2] = min(dp[i+2], dp[i] + abs(num[i] - num[i+2]));
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
  int A,B;
  scanf("%d%d",&A,&B);

  long ans = A+B;
  if(ans < A-B){
    ans = A-B;
  }
  if(ans < A*B){
    ans = A*B;
  }

  printf("%ld",ans);
  return 0;
}

Measured memory_bytes: 128
-- import Debug.Trace
import Data.List
import Data.Ord

getInts :: IO [Int]
getInts = map read . words <$> getLine

getData 0 xs = return xs
getData n xs = do
  (a:b:[]) <- getInts
  getData (n - 1) ((a,b):xs)

scoreA [] n = n
scoreA ((a,b):xs) n = scoreB xs (n + a)

scoreB [] n = n
scoreB ((a,b):xs) n = scoreA xs (n - b)

getScore (a,b) = a + b

main = do
  (n:ns) <- getInts
  xs <- getData n []
  print $ scoreA (sortBy (comparing (Down . getScore)) xs) 0


Measured memory_bytes: 80892
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

result = 0
was = -100
for a in A:
    result += B[a-1]
    if was + 1 == a:
        result += C[was-1]
    was = a

print(result)


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

int main(){
	int N, sum=0;
	cin >> N;
	int A[N+1];
	A[0]=0;
	for(int i=1; i<=N; i++){
		cin >> A[i];
		sum += abs(A[i]-A[i-1]);
	}
	sum += abs(A[N]);

	for(int i=1; i<N; i++){
		if(A[i]<A[i-1]&&A[i]<A[i+1]){
			if(A[i-1]<A[i+1]){
				cout << sum - 2*(A[i-1]-A[i]) << endl;
			} else {
				cout << sum - 2*(A[i+1]-A[i]) << endl;
			}
		} else if(A[i]>A[i-1]&&A[i]>A[i+1]){
			if(A[i-1]<A[i+1]){
				cout << sum - 2*(A[i]-A[i+1]) << endl;
			} else {
				cout << sum - 2*(A[i]-A[i-1]) << endl;
			}
		} else {
			cout << sum << endl;
		}
	}
	if(A[N-1]<0&&A[N]<0&&A[N-1]>A[N]||A[N-1]>0&&A[N]>0&&A[N-1]<A[N]){
		cout << sum - abs(2*(A[N-1]-A[N])) << endl;
	} else if(A[N-1]<0&&A[N]>0||A[N-1]>0&&A[N]<0){
		cout << sum - abs(2*A[N]) << endl;
	} else {
		cout << sum << endl;
	}
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ff first
#define ss second
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const ll INF = 1e18 + 5;
int get_jj(int i, int j){
    int x = (i / 2) - 3;
    return j - x;
}
int main() {
    IO;
    int n;
    cin >> n;
    vector<ll> a(n);
    for(ll &x: a)
        cin >> x;
    // dp[i][j][k] -> maximum sum when chose j elements from first i elements, and no two elements are adjacent
    //                  k says, if last element was taken or not
    vector<vector<vector<ll> > > dp(n, vector<vector<ll> >(7, vector<ll>(2, -INF)));;
    dp[0][get_jj(0, 0)][0] = 0;
    dp[0][get_jj(0, 1)][1] = a[0];
    for(int i = 0; i < n - 1; i++){
        for(int j = (i / 2) - 3; j <= (i / 2) + 3 && j <= (i + 1); j++){
            if(j < 0) continue;

            for(int k = 0; k < 2; k++) {
                if (dp[i][get_jj(i, j)][k] == -INF) continue;
                if (k == 1) {
                    if(get_jj(i + 1, j) >= 0 && get_jj(i + 1, j) < 7)
                        dp[i + 1][get_jj(i + 1, j)][1 - k] = max(dp[i + 1][get_jj(i + 1, j)][1 - k], dp[i][get_jj(i, j)][k]);
//                    cout << i << ' ' << j << ' ' << k << " -> " << i + 1 << ' ' << j << ' ' << 1 - k << '\n';
                }
                else{
                    if(get_jj(i + 1, j + 1) >= 0 && get_jj(i + 1, j + 1) < 7)
                        dp[i + 1][get_jj(i + 1, j + 1)][1 - k] = max(dp[i + 1][get_jj(i + 1, j + 1)][1 - k], dp[i][get_jj(i, j)][k] + a[i + 1]);
                    if(get_jj(i + 1, j) >= 0 && get_jj(i + 1, j) < 7)
                        dp[i + 1][get_jj(i + 1, j)][k] = max(dp[i + 1][get_jj(i + 1, j)][k], dp[i][get_jj(i, j)][k]);

//                    cout << i << ' ' << j << ' ' << k << " -> " << i + 1 << ' ' << j + 1 << ' ' << 1 - k << " And " << i + 1 << ' ' << j << ' ' << k << '\n';
                }
            }
        }
    }

//    int x = 0;
//    jj = (n - 1) / 2 - 1;
//    x += (n / 2) - jj;
    cout << max(dp[n - 1][get_jj(n - 1, n / 2)][0], dp[n - 1][get_jj(n - 1, n / 2)][1]) << '\n';
    return 0;
}


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

int main(){
	int A,B,C,D,E,F;		cin>>A>>B>>C>>D>>E>>F;
	int ansL=min(A,B)*100, ansS=0;

	for(int i=0; A*i*100<=F; i++){
		for(int j=0; A*i*100 + B*j*100<=F; j++){
			int w=A*i*100 + B*j*100;
			if(w>F)continue;

			for(int k=0; w+(k*C)<=F; k++){
				for(int l=0; w+(k*C)+(l*D)<=F; l++){
					int s=k*C + l*D;
					if(w+s>F||w+s==0||E*(A*i + B*j)<s)continue;

					double now=(double)(100*s)/(double)(w+s);
					double tmp=(double)(100*ansS)/(double)ansL;

					if(now>tmp){
						ansL=w+s;
						ansS=s;
						//printf("(W,S)=(%d,%d)\n",ansL,ansS);
					}

				}
			}
		}
	}
	cout<<ansL<<" "<<ansS<<endl;

	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int A, B, C, K;

  scanf("%d %d %d", &A, &B, &C);
  scanf("%d", &K);

  int flag = 0;
  for (size_t i = 0; i <= K; i++) {
    for (size_t j = 0; j <= K - i; j++) {
      for (size_t k = 0; k <= K - i - j; k++) {
        int a, b, c;
        a = A << i;
        b = B << j;
        c = C << k;
        if (a < b && b < c) {
          flag = 1;
        }
      }
    }
  }

  if (flag) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 1624