akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int mod;
const int MX = 3010;
ll inv[MX], f[MX], invf[MX];
ll dp[MX][MX], two[MX], twotwo[MX];
void calc(){
	inv[0] = inv[1] = f[0] = f[1] = invf[0] = invf[1] = 1;
	for (int i = 2; i < MX; i++){
		inv[i] = mod - mod / i * inv[mod % i] % mod;
		f[i] = f[i - 1] * i % mod;
		invf[i] = invf[i - 1] * inv[i] % mod;
	}
	rep(i, MX) two[i] = i ? two[i - 1] * 2 % mod : 1;
	for(ll i = 0, tmp = 2; i < MX; tmp = tmp * tmp % mod) twotwo[i++] = tmp;
	
	rep(i, MX) dp[i][0] = 1;
	for(int i = 1; i < MX; i++) for(int j = 1; j <= i; j++){
		dp[i][j] = (dp[i - 1][j - 1]+ dp[i - 1][j] * (j + 1)) % mod;
	}
}
inline ll C(ll n, ll k){
	return f[n] * invf[k] % mod * invf[n - k] % mod;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n >> mod;
	calc();
	
	ll ans = 0;
	for(int i = 0; i <= n; i++){
		ll tmp = 0, t = 1;
		for(int j = 0; j <= i; j++){
			tmp += dp[i][j] * t % mod;
			t = t * two[n - i] % mod;
		}
		tmp = tmp % mod * C(n, i) % mod * twotwo[n - i] % mod;
		ans = ans + (i & 1 ? mod - tmp : tmp);
	}
	cout << ans % mod << endl;
	return 0;
}

Measured memory_bytes: 69504
n, a, *ary = $stdin.read.split.map(&:to_i)
ary[0, 0] = nil

memoed_kosu = Array.new(n + 1){ Array.new(n + 1) {Array.new(a*n + 1)}};0

cal_memo = lambda do |j, k, a_sum|
  memoed_kosu[j][k][a_sum] ||= if k == 1
    ary[1, j].count(a_sum)
  elsif j == k # なくても多分良い
    ary[1, j].reduce(&:+) == a_sum ? 1 : 0
  elsif j < k # j個の中からk個を選ぶので
    0
  elsif a_sum - ary[j] >= 0
    cal_memo.(j-1, k, a_sum) + cal_memo.(j-1, k-1, a_sum - ary[j])
  else
    cal_memo.(j-1, k, a_sum)
  end
end
puts (1..n).reduce(0){|sum, i| sum + cal_memo.(n, i, a*i)}

Measured memory_bytes: 54652
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	while (true) {
		int n, sum, avg;
		cin >> n;
		if (n == 0) {
			break;
		}

		sum = 0;
		int max_score = -1, min_score = 1001;
		for (int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			min_score = min(min_score, tmp);
			max_score = max(max_score, tmp);
			sum += tmp;
		}
		sum -= min_score + max_score;
		avg = sum / (n - 2);
		cout << avg << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  map<char,int> mp;
  rep(i,n){
    char s;
    cin >> s;
    mp[s]++;
  }
  if(mp.size()==3){
    cout << "Three" << endl;
  }else{
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
ll gcd(ll x,ll y){if(!y)return x;return gcd(y,x%y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
void swap(ll *x,ll *y){ll tmp=*x;*x=*y;*y=tmp;}
int asc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

int main(){
    int n;scanf("%d",&n);
    int x[200];for(int i=0;i<n;i++)scanf("%d",&x[i]);

    int sum=0;
    int ans=10000000;
    int ans_i;
    for(int i=0;i<=100;i++){
        sum=0;
        for(int j=0;j<n;j++){
            sum+=pow((double)(x[j]-i),2.0);
        }
        if(ans>sum){
            ans=sum;
        }
    }

    printf("%d\n",ans);
}

Measured memory_bytes: 128
/*
    coded by - PATHAKCODES ~~Revamped
    AIT PUNE , INDIA 
     
    "The Key is not will to win ......everybody has that "
    "It is will to prepare that is important"  
     
*/
     
#include <bits/stdc++.h>
 
using namespace std ;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
const ll k = 1e9 +7;



int main ()
{
    IOS
    int n ; cin >> n ;

    vector<int> h(n,0);

    for(int i = 0;i < n ; i++)
         cin >> h[i];

     vector<int> dp(n,0);
     dp[0] = 0;
     dp[1] = abs(h[1]-h[0]);

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

     cout << dp[n-1] << endl;
}



Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
    ll n,c=0;
    std::cin >> n;
    std::vector<ll> a(n);
    rep(i,n){
        std::cin >> a[i];
        if(a[i]<0){
            a[i]=-a[i];
            c++;}
    }
    sort(all(a));
    if(c%2==0)std::cout << sum(all(a),0ll) << std::endl;
    else std::cout << sum(a.begin()+1,a.end(),0ll)-a[0] << std::endl;
    
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        cout << "x";
    }
    cout << endl;
}

Measured memory_bytes: 3588
#include <stdio.h>
int main()
{
    int A,B;
    scanf("%d%d",&A,&B);
    if(B%A==0)
    {
        printf("%d",A+B);
    }
    else if(A%B!=0)
    {
        printf("%d",B-A);
    }
    return 0;
}

Measured memory_bytes: 128
def resolve():
    x, n = list(map(int, input().split()))

    if n > 0:
        p = list(map(int, input().split()))
        q = [i for i in range(min(p)-1, max(p)+2)]
        for item in p:
            if item in q:
                q.remove(item)

        ans = []
        current_min = float('inf')
        for item in q:
            diff = abs(x-item)
            if diff < current_min:
                current_min = diff
                ans.clear()
                ans.append(item)
            elif diff == current_min:
                ans.append(item)

        print(min(ans))
    else:
        print(x)


if 'unittest' not in globals():
    resolve()


Measured memory_bytes: 62044
x = int(input())

if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <=1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)


Measured memory_bytes: 9188
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
using namespace std;

int main(){
    int N, L;
    cin >> N >> L;
    int sm = N*(L-1)+N*(N+1)/2;
    int a = L;
    int b = L+N-1;
    if(a * b <= 0) cout << sm << endl;
    else if(a > 0) cout << sm - a << endl;
    else if(b < 0) cout << sm - b << endl;
    return 0;
}


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

using namespace std;

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

int main(){
    int N;
    scanf("%d",&N);

    vector<int> h(N+1);
    vector<int> dp(N+1);
    
    for(int i=1;i<=N;i++)
        scanf("%d",&h[i]);

    dp[1] = 0;

    dp[2] = dp[1] + abs(h[2]-h[1]);
    
    for(int i=3;i<=N;i++){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    
    printf("%d\n",dp[N]);

    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    do {
        if (a[0] + a[1] == a[2]) {
            cout << "Yes" << endl;
            return 0;
        }
    }while(next_permutation(a, a + 3));
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
//package beg_163;

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		long n = Long.parseLong(a[0]);
		long k = Long.parseLong(a[1]);
		n=n+1;
		long ways=0;
		for (long i=k;i<=n;i++) {
			ways=ways+((i*(2*n-i-1)/2) - ((i-1)*i/2) + 1);
			ways = ways%(1000000007);
		}
		System.out.println(ways);
	}

}


Measured memory_bytes: 35748
#include<iostream>
#include<algorithm>
using namespace std;
int s(int a){
    return a*a;
}
int main(){
    int a[3],b[4]={0};
    while(cin>>a[0]>>a[1]>>a[2]){
        sort(a,a+3);
        if(a[0]+a[1]<=a[2]){
            cout<<b[0]<<" "<<b[1]<<" "<<b[2]<<" "<<b[3]<<endl;
            break;
        }
        if(s(a[2])>s(a[0])+s(a[1]))
            b[3]++;
        else if(s(a[2])==s(a[0])+s(a[1]))
            b[1]++;
        else
            b[2]++;
        b[0]++;
    }
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,ll> pii;
const int max_N=1e5+10;
int n;
const int inf=1e9+5;
vector <pii> G[max_N],rg[max_N];
vector<int>p(105,0);
int h[100005];
int i;

int main()
{
  cin >> n;
  for(int i=0;i<n;i++)
    {
      cin >> h[i];
    }
  vector<int>dp(n+5,inf);
  //cout << dp[0] << endl;
  dp[0]=0;
  for(int i=0;i+1<n;i++)
    {
      if(i+1<n) dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
      if(i+2<n) dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+2]-h[i]));
    }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 5760
#include <stdio.h>
int main(){
    int c;
    for(c=getchar();c!='\n';c=getchar()){
        if('a'<=c&&c<='z'){
            printf("%c",c-('a'-'A'));
        }else if('A'<=c&&c<='Z'){
            printf("%c",c+('a'-'A'));
        }else{
            printf("%c",c);
        }
    }
    printf("\n");
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)


int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  ll n;
  cin >> n;
  vector<ll> a;
  for (ll i = 0; ; i++) {
    ll t = n%26;
    if (t == 0) a.push_back(26);
    else a.push_back(t);
    n /= 26;
    if (t == 0) n--;
    if (n == 0 ) {
      break;
    }
  }
  for (ll i = a.size()-1; i >= 0; i--) {
    cout << char(a[i]+96);
  }
  cout << '\n';
}

Measured memory_bytes: 3656
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  String s = sc.next();
  char[] c = s.toCharArray();
  int ans = 0;
  for(int i = 1;i<n;i++){
    if(c[i]!=c[i-1]){
      ans++;
    }
  }
  System.out.println(ans+1);
}}

Measured memory_bytes: 27476
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

int main() {
    int a,b;
    cin >> a >> b;

    string A = "";
    string B = "";

    for(int i = 0; i < b; i++){
        A = A + to_string(a);
    }

    for(int i = 0; i < a; i++){
        B = B + to_string(b);
    }

    if(A < B){
        cout << A << endl;
    }else{
        cout << B << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<string> S(n);
  vector<vector<pair<int, int>>> v(4);
  int sum = 0;
  rep(i, n) {
    cin >> S[i];
    int cnt=0, mn=0;
    for(char c: S[i]) {
      cnt += (c=='(' ? 1 : -1);
      mn = min(cnt, mn);
    }
    sum += cnt;
    if(mn == 0 && cnt >= 0) {
      v[0].push_back({mn, cnt});
    } else if(mn < 0 && cnt >= 0) {
      v[1].push_back({mn, cnt});
    } else if(mn == cnt && cnt <= 0) {
      v[2].push_back({mn, cnt});
    } else {
      v[3].push_back({mn, cnt});
    }
  }
  auto no = [&]() {
    cout << "No" << "\n";
    exit(0);
  };
  if(sum != 0) no();
  sum = 0;
  for(auto p: v[0]) {
    sum += p.second;
  }
  sort(all(v[1]), greater<pair<int, int>>());
  for(auto p: v[1]) {
    if(sum + p.first < 0) no();
    sum += p.second;
  }
  sum = 0;
  for(auto p: v[2]) {
    sum += -p.second;
  }
  sort(all(v[3]), [&](pair<int, int> p1, pair<int, int> p2) {
      if(p1.first == p2.first) {
        return p1.second < p2.second;
      }
      return p1.first-p1.second > p2.first-p2.second;
    });
  for(auto p: v[3]) {
    if(sum + p.first-p.second < 0) no();
    sum += -p.second;
  }
  cout << "Yes" << "\n";
  return 0;
}


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

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while(1){
      C -= B;
      if(C <= 0){
        cout << "Yes" << endl;
        break;
      }
      A -= D;
      if(A <= 0){
        cout << "No" << endl;
        break;
      }
    }
    return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef pair<pl, ll> ppl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, k, h, ans=0;
  cin >> n >> k;
  rep(i, n) {cin >> h; if(h >= k) ans++;}
  cout << ans << newl;
  return 0;
}

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

ll cnt[60][60];
ll h, w, n, k;

ll ppow(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)res = (res*a) % k;
		a = (a*a) % k;
		b >>= 1;
	}
	return res;
}
int main() {
	cin >> h >> w >> n >> k;
	int c = 0;
	rep(i, h)rep(j, w) {
		cout << "? " << i << ' ' << j << ' ' << i << ' ' << j << endl;
		cin >> cnt[i][j];
		c += cnt[i][j];
		if (c >= 250)break;
	}
	ll ans = 0;
	rep(i, h)rep(j, w) {
		ans = (ans + cnt[i][j] * ppow(2, i*w + j)) % k;
	}
	cout << "! " << ans << endl;
}

Measured memory_bytes: 724
#include<cstdio>

using namespace std;

int main(){
	char *color[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
	int rgb[][3]={{0x00,0x00,0x00},
				  {0x00,0x00,0xff},
				  {0x00,0xff,0x00},
				  {0x00,0xff,0xff},
				  {0xff,0x00,0x00},
				  {0xff,0x00,0xff},
				  {0xff,0xff,0x00},
				  {0xff,0xff,0xff}};

	for(char sam[8];scanf("%s",sam),sam[0]-'0';){
		int b;	sscanf(sam+5,"%x",&b);	sam[5]='\0';
		int g;	sscanf(sam+3,"%x",&g);	sam[3]='\0';
		int r;	sscanf(sam+1,"%x",&r);
		int dmin=1000000,imin;
		for(int i=0;i<8;i++){
			int dis=(r-rgb[i][0])*(r-rgb[i][0])+(g-rgb[i][1])*(g-rgb[i][1])+(b-rgb[i][2])*(b-rgb[i][2]);
			if(dis<dmin)	dmin=dis,imin=i;
		}
		puts(color[imin]);
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        int A1=scan.nextInt();
        int A2=scan.nextInt();
        int B1=scan.nextInt();
        int B2=scan.nextInt();
        while(true){
            B1=B1-A2;
            if(B1<=0){
                System.out.println("Yes");
                break;
            }
            A1=A1-B2;
            if(A1<=0){
                System.out.println("No");
                break;
            }
        }
        
    }
}


Measured memory_bytes: 35768
#include<stdio.h>
#define ck 26
#include<sys/time.h>

unsigned long long seed;

unsigned long long xorshift(){
  seed=seed^(seed<<13);
  seed=seed^(seed>>7);
  seed=seed^(seed<<17);
  return seed;
}

int d;
int c[32];
int s[512][32];
int res[512];

int eval(){
  int i,j,lc[32],r=0;
  for(i=1;i<=ck;i++){lc[i]=-1;}
  for(i=0;i<d;i++){
    r+=s[i][res[i]];
    lc[res[i]]=i;
    for(j=1;j<=ck;j++){
      r-=c[j]*(i-lc[j]);
    }
  }
  return r;
}

int sum(int x){
  return (x*(x+1))/2;
}

int delq(int tg,int x){
  int r,i;
  int bfb=-1,bff=d,afb=-1,aff=d;
  r=s[tg][x]-s[tg][res[tg]];

  for(i=tg-1;i>=0;i--){
    if(res[i]==res[tg]){bfb=i;break;}
  }
  for(i=tg+1;i<d;i++){
    if(res[i]==res[tg]){bff=i;break;}
  }

  for(i=tg-1;i>=0;i--){
    if(res[i]==x){afb=i;break;}
  }
  for(i=tg+1;i<d;i++){
    if(res[i]==x){aff=i;break;}
  }
  
  r+=c[res[tg]]*sum((tg-bfb)-1);
  r+=c[res[tg]]*sum((bff-tg)-1);
  r-=c[res[tg]]*sum((bff-bfb)-1);

  r-=c[x]*sum((tg-afb)-1);
  r-=c[x]*sum((aff-tg)-1);
  r+=c[x]*sum((aff-afb)-1);
  return r;
}

void getperm(int n,int p[]){
  int i,tg,mem;
  for(i=0;i<n;i++){
    p[i]=i;
  }
  for(i=n-1;i>=1;i--){
    tg=(xorshift()%(i+1));
    mem=p[tg];
    p[tg]=p[i];
    p[i]=mem;
  }
}

int main(){
  long long stt,nt;
  struct timeval tv;
  gettimeofday(&tv, NULL);
  seed=(tv.tv_sec*1000000+tv.tv_usec);
  stt=seed;
  int i,j,q,r,tg,x,p[32];
  scanf("%d",&d);
  for(i=1;i<=ck;i++){scanf("%d",&c[i]);}
  for(i=0;i<d;i++){
    for(j=1;j<=ck;j++){
      scanf("%d",&s[i][j]);
    }
  }
  for(i=0;i<d;i++){
    res[i]=(i%ck)+1;
  }
  r=eval();
  q=0;
  while(1){
    tg=(xorshift()%d);
    getperm(ck,p);
    for(i=0;i<ck;i++){
      if(delq(tg,p[i]+1)>=0){res[tg]=p[i]+1;}
    }
    q++;
    if(q==d){
      q=0;
      gettimeofday(&tv, NULL);
      nt=(tv.tv_sec*1000000+tv.tv_usec);
      if((nt-stt)>=1980000){break;}
    }
  }
  for(tg=0;tg<d;tg++){
    getperm(ck,p);
    for(i=0;i<ck;i++){
      if(delq(tg,p[i]+1)>=0){res[tg]=p[i]+1;}
    }
  }
  for(i=0;i<d;i++){
    printf("%d\n",res[i]);
  }
  return 0;
}


Measured memory_bytes: 1788
#include <cstdio>
#include <algorithm>
#include <iostream>
#define N 100010

using namespace std;

int n,m;
int a[N];

int main(){
  scanf("%d%d",&n,&m);
  for(int i=1;i<=m;i++){
    int x,y; scanf("%d%d",&x,&y);
    a[x]++; a[y]++;
  }
  for(int i=1;i<=n;i++) if(a[i]&1) return puts("NO"),0;
  puts("YES");
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;
const int MAX = 50;

vector<int> G[MAX];
vector<pair<int, int>> e(MAX * MAX);
bool visited[MAX];

void dfs(int u, int i) {
  visited[u] = true;
  for (int v: G[u]) {
    if (visited[v]) continue;
    if (u == e[i].first && v == e[i].second) continue;
    if (v == e[i].first && u == e[i].second) continue;
    dfs(v, i);
  }
}


int main() {
  int n, m;
  cin >> n >> m;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    e[i] = {a, b};
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int ans = 0;
  rep(i, m) {
    rep(j, n) visited[j] = false;
    dfs(0, i);
    rep(j, n) {
      if (!visited[j]) {
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;



  
  return 0;
}

Measured memory_bytes: 256
# Problem https://atcoder.jp/contests/abc095/tasks/abc095_b
# Ruby 3rd Try
N,X = gets.chomp().split(' ').map(&:to_i)
mi = []
for j in 0...N do
    mi << gets.chomp().to_i
end
mmin = mi.min
misum = 0
for j in 0...N do
    misum = misum+mi[j]
end
answer = N
rquan = X - misum
answer = answer +  rquan / mmin
print(answer)

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int a, b;
  cin >> a >> b;
 
  cout << ((a%3==1 && b%3==1) || (a%3==2 && b%3==2) ?"Impossible":"Possible") << endl;
  
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, _b = y; i <= _b; i ++)
#define ff(i, x, y) for(int i = x, _b = y; i <  _b; i ++)
#define fd(i, x, y) for(int i = x, _b = y; i >= _b; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

#define fl fflush(stdout)

char c[63]; int c0;

struct P {
	string x;
	P() {}
	P(string _x) {x = _x;}
};

bool operator < (P a, P b) {
	return a.x.length() < b.x.length();
}

multiset<P> q;

int L;

int qry(string s) {
	pp("? %s\n", s.c_str()); fl;
	int v; scanf("%d", &v);
	return v;
}

string mer(string a, string b) {
	int n = a.length(), m = b.length();
	int l = 0;
	ff(i, 0, m) {
		char c = b[i];
		while(1) {
			string d = a;
			d.insert(d.begin() + l, c);
			int v = qry(d);
			if(v == L - n - i - 1) {
				break;
			}
			l ++;
		}
		a.insert(a.begin() + l, c);
		l ++;
	}
	return a;
}

int main() {
	
	fo(i, 0, 25) c[++ c0] = 'a' + i;
	fo(i, 0, 25) c[++ c0] = 'A' + i;
	fo(i, 0, 9) c[++ c0] = '0' + i;
	
	fo(i, 1, c0) {
		string s = "";
		fo(j, 1, 128) s += c[i];
		int v = qry(s);
		v = 128 - v;
		s = "";
		fo(j, 1, v) s += c[i];
		q.insert(P(s));
		
		if(v > 0 && L == 0) {
			int w = qry(s);
			L = w + v;
		}
	}
	
	while(q.size() > 1) {
		string s = (*q.begin()).x;
		q.erase(q.begin());
		string t = (*q.begin()).x;
		q.erase(q.begin());
		q.insert(P(mer(s, t)));
	}
	string s = (*q.begin()).x;
	printf("! %s\n", s.c_str());
}

Measured memory_bytes: 3796
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let h: usize = it.next().unwrap().parse().unwrap();
    let w: usize = it.next().unwrap().parse().unwrap();
    let s: Vec<Vec<char>> = (0..h).map(|_| it.next().unwrap().chars().collect()).collect();
    let mut dp = vec![vec![0; w + 1]; h + 1];
    const MOD: u32 = 1_000_000_007;
    dp[0][0] = 1;
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                continue;
            }
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;
            dp[i][j + 1] += dp[i][j];
            dp[i][j + 1] %= MOD;
        }
    }
    println!("{}", dp[h - 1][w - 1]);
}

fn main() {
    run();
}

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

int main() {
    int N, X = 0;
    int a[1001] = {0};
    cin >> N >> X;
    int min = 100001;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        if(min > a[i]) min = a[i];
        X -= a[i];
    }
    int sum = N;
    sum += X / min;
    cout << sum << endl;
    return 0;
}


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

int main(){
  
  int N;
  cin >>N;
  vector<double> x(N);
  vector<string> u(N);
  for(int i=0;i<N;i++){
    double a;
    string b;
    cin >>a>>b;
    x[i] = a;
    u[i] = b;
  }
  
  double ans = 0;
  
  for(int i=0;i<N;i++){
    if(u[i]=="JPY"){
      ans += x[i];
    }else{
      ans += x[i]*380000;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
using namespace std;
const int SZ=1<<19,N=2e5+9,M=2*N;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
    G;while(*ip<'-')G;
    R x=*ip&15;G;
    while(*ip>'-'){x*=10;x+=*ip&15;G;}
    return x;
}
int n,rt,p,a[N],f[N],he[N],ne[M],to[M],w[M],s[N],mx[N]={N};
LL d[N];bool vis[N];
struct Edge{
    int u,v;LL w;
    inline bool operator<(const Edge&x)const{
        return w<x.w;
    }
}e[50*N];
inline void Cmx(R&x,R y){
    if(x<y)x=y;
}
void Getrt(R x){
    vis[x]=1;s[x]=1;mx[x]=0;
    for(R y,i=he[x];i;i=ne[i])
        if(!vis[y=to[i]])
            Getrt(y),s[x]+=s[y],Cmx(mx[x],s[y]);
    Cmx(mx[x],n-s[x]);
    if(mx[rt]>mx[x])rt=x;
    vis[x]=0;
}
void Dfs1(R x){
    vis[x]=1;
    if(d[rt]>d[x])rt=x;
    for(R y,i=he[x];i;i=ne[i])
        if(!vis[y=to[i]])
            d[y]=d[x]-a[x]+a[y]+w[i],Dfs1(y);
    vis[x]=0;
}
void Dfs2(R x){
    vis[x]=1;
    e[++p]=(Edge){x,rt,d[rt]+d[x]};
    for(R y,i=he[x];i;i=ne[i])
        if(!vis[y=to[i]])Dfs2(y);
    vis[x]=0;
}
void Solve(R x){
    rt=0;Getrt(x);x=rt;
    d[x]=a[x];Dfs1(x);Dfs2(x);
    vis[x]=1;
    for(R t=n,y,i=he[x];i;i=ne[i])
        if(!vis[y=to[i]])
            n=s[y]<s[x]?s[y]:t-s[x],Solve(y);
}
int Getf(R x){
    return x==f[x]?x:f[x]=Getf(f[x]);
}
int main(){
    R n=::n=in();
    for(R i=1;i<=n;++i)a[i]=in(),f[i]=i;
    for(R i=1,p=0;i<n;++i){
        R x=in(),y=in();
        ne[++p]=he[x];to[he[x]=p]=y;
        ne[++p]=he[y];to[he[y]=p]=x;
        w[p]=w[p-1]=in();
    }
    Solve(1);
    sort(e+1,e+p+1);
    LL ans=0;
    for(R i=1;i<=p;++i){
        R x=Getf(e[i].u),y=Getf(e[i].v);
        if(x!=y)f[x]=y,ans+=e[i].w;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 74368
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define INF (1 << 31) - 1

int main() {
  int N;
  cin >> N;
  set<ll> st;
  rep(i,N){
    ll a;
    cin >> a;
    st.insert(a);
  }
  if(st.size() == N)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 9600
#include <cstdio>

using namespace std;

typedef long long ll;

int main() {
	ll a, b, x;
	
	scanf("%lld %lld %lld", &a, &b, &x);
	
	ll n = b / x;
	ll i;
	
	for (i = x; i < a; i += x) n--;
	
	if (a == 0) n++;
	
	printf("%lld\n", n);
	
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
int main(){
    int N,day,x;  cin >> N >> day >> x;
    int a[N],choco=0;
    for(int i=0;i<N;i++){
        cin >> a[i];
        for(int j=1;j<=day;j+=a[i]){
            choco++;
        }
    }
    cout << choco+x << endl;
}

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 1e5 )+10;
const int MOD  = int( 360 );
const int oo   = INT_MAX;

string s;
ll cnt[ 26 ];

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif

  cin >> s;
  for( int i = 0; i < SIZE(s); ++i ) {
    ++cnt[ s[i]-'a' ];
  }
  ll ans = ll(SIZE(s));
  ans = ans*(ans-1)/2LL;
  for( int i = 0; i < 26; ++i ) {
    ans -= cnt[i]*(cnt[i]-1)/2LL;
  }
  cout << ans+1LL << endl;

  return 0;
}


Measured memory_bytes: 720
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class dwacon5_a {
public:
    void solve(istream& in, ostream& out) {
        int N;
        in >> N;
        vector<int> a(N);
        for (int i = 0; i < N; ++i) {
            in >> a[i];
        }
        int sum = accumulate(begin(a), end(a), 0);
        double avg = sum / (double)N;
        int i = 0;
        for (int j = 1; j < N; ++j) {
            if (abs(a[j] - avg) < abs(a[i] - avg)) {
                i = j;
            }
        }
        out << i << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	dwacon5_a solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 892
# coding: utf-8
N = int(input())
T = [[0 for i in range(3)] for i in range(N+1)]
for i in range(1,N+1):
  input_lines = input().split()
  T[i][0] = int(input_lines[0])
  T[i][1] = int(input_lines[1])
  T[i][2] = int(input_lines[2])
T[0][0] = 0
T[0][1] = 0
T[0][2] = 0

for i in range(1,N+1):
  t = T[i][0] - T[i-1][0]
  d = abs(T[i][1] - T[i-1][1]) + abs(T[i][2] - T[i-1][2])
  if (t-d)%2 ==1:
    print("No")
    break
  if t < d:
    print("No")
    break
  if i == N:
    print("Yes")

Measured memory_bytes: 21108
#include <iostream>
#include <fstream>
#include <algorithm>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer","inline")
//#pragma GCC option("arch=native","tune=native","no-zero-upper")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getrnd(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

ll getrndll(ll l, ll r) {
    return uniform_int_distribution<ll>(l, r)(rng);
}

template <typename T1, typename T2>
inline bool relax(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T1, typename T2>
inline bool strain(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

// :::::::::::::::::::::::::::::::

const int N = 2005;
const ll INF = 1e16;

ll dp[N][N];

void solve() {
    int n;
    cin >> n;
    
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i].first, a[i].second = i;
    sort(a.rbegin(), a.rend());
    
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            dp[i][j] = -INF;
        
    // |i - d| = max(i - d, d - i)
    dp[0][0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; i + j < n; ++j) {
            int cur = i + j;
            strain(dp[i + 1][j], dp[i][j] + 1LL * a[cur].first * (a[cur].second - i));
            strain(dp[i][j + 1], dp[i][j] + 1LL * a[cur].first * ((n - 1 - j) - a[cur].second));
        }
    }
    
//    for (int i = 0; i <= n; ++i) {
//        for (int j = 0; i + j <= n; ++j)
//            cout << dp[i][j] << ' ';
//        cout << '\n';
//    }
    
    ll ans = -INF;
    for (int i = 0; i <= n; ++i)
        strain(ans, dp[i][n - i]);
    cout << ans << '\n';
}

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



Measured memory_bytes: 35028
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <cstdio>
#include <cstdint>
using namespace std;

int_fast8_t d;
uint_fast32_t M = 0;
uint_fast64_t c, sd = 0, sc = 0;
constexpr int buff_size = 1 << 17;
char buff[buff_size], *ci = buff + buff_size, *ce = ci, ct;

inline char read_input() {
    if (ci == ce) { fread_unlocked(buff, 1, buff_size, stdin); ci = buff; }
	return *ci++;
}

int main() {
    while((ct=read_input())>47) M = (M<<1) + (M<<3) + ct - 48;
    while(M--) {
        d = read_input() - 48;
        read_input();
        for(c=0; (ct=read_input())>47;) c = (c<<1) + (c<<3) + ct - 48;
        sc += c;
        sd += c * d;
    }
    printf("%lld", --sc + --sd / 9);
	return 0;
}


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

using namespace std;

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

int main(){
	for(int n,m;cin>>n>>m,n;){
		int x=1,y=1,dir=1;
		while(1){
			string s;	cin>>s;
			if     (s=="STOP")	break;
			else if(s=="FORWARD"){
				int k;	cin>>k;
				x=max(1,min(n,x+k*dx[dir]));
				y=max(1,min(m,y+k*dy[dir]));
			}
			else if(s=="BACKWARD"){
				int k;	cin>>k;
				x=max(1,min(n,x-k*dx[dir]));
				y=max(1,min(m,y-k*dy[dir]));
			}
			else if(s=="RIGHT")	dir=(dir+3)%4;
			else if(s=="LEFT")	dir=(dir+1)%4;
		}
		cout<<x<<' '<<y<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi >
#define vvvi vector<vvi >
#define pii pair<int,int>
#define INF 1e9
#define MOD 1e9+7
typedef long long llong;
using namespace std;

int main(){
	int r,d,x;
	cin>>r>>d>>x;
	
	for(int i=1;i<=10;++i){
		x=r*x-d;
		cout<<x<<endl;
	}
}

Measured memory_bytes: 256
H, W, h, w = map(int, input().split())
p = 1000
if H % h > 0 or W % w > 0:
    print("Yes")
    a = [ [p] * W for i in range(H) ]
    for i in range(h-1, H, h):
        for j in range(w-1, W, w):
            a[i][j] = - p * (h * w - 1) - 1
    for i in range(H):
        print(' '.join(map(str, a[i])))
else:
    print("No")


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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int num = r*100 + g*10 + b;
  if (num%4 == 0) cout << "YES\n";
  else cout << "NO\n";
  return 0;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

const int MAX_N = 1e5;
int dp[MAX_N + 1];

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;

    vector<int> nums;
    nums.push_back(1);

    int k = 9;
    while (true) {
        nums.push_back(k);
        if (k > 100000) break;
        k *= 9;
    }
    k = 6;
    while (true) {
        nums.push_back(k);
        if (k > 100000) break;
        k *= 6;
    }

    sort(nums.begin(), nums.end(), greater<int>());
    fill(dp, dp+MAX_N+1, INF);
    dp[0] = 0;

    for (int n=0; n<=N; n++) {
        for (int i=0; i<nums.size(); i++) {
            if (dp[n] != INF && n+nums[i] <= N) dp[n+nums[i]] = min(dp[n]+1, dp[n+nums[i]]);
        }
    }

    cout << dp[N] << endl;
}



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

int main(){

  int a = 0 ,b = 0;

  cin >> a >> b;
  
  if(a > b){
    cout << "a > b\n"; 
  }else if(a == b){
    cout << "a == b\n";
  }else if(a < b){
    cout << "a < b\n";
  }
  return 0;


}

Measured memory_bytes: 1124
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int main(void) {
	long long int n, sum;
	long long int l;
	int m;
	map<int,long long int> a;
	queue <long long int> b;
	int i;
	cin >> n;
	sum = 0;
	for (i = 0; i < n; i++) {
		cin >> m;
		b.push(m);
		a[m]++;
	}
	for (auto s : a) {
		sum += (s.second * (s.second - 1)) / 2;
	}
	for (i = 0; i < n; i++) {
		l = a[b.front()];
		l--;
		cout << sum - l << endl;
		b.pop();
	}

	return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n,k;
  cin >> n;
  k = n;
  int sumn = 0;
  while(n > 0){
    sumn += n % 10;
    n /= 10;
  }
  if(k % sumn == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

typedef struct {
	int from, to;
	int weight;
} Edge;

const int INF = 10000000000;

int main(void)
{
	Edge edges[10000];
	int n, m; 
	int i, j;
	int a, b, v;
	int min, sum;
	int ch[105], ind;
	
	while (1){
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		scanf("%d", &m);
		
		for (i = 0; i < m; i++){
			scanf("%d,%d,%d", &a, &b, &v);
			edges[i].from = a;
			edges[i].to = b;
			edges[i].weight = (v / 100) - 1;
		}
		for (i = 0; i < n; i++) ch[i] = 0;
		
		sum = 0;
		ch[0] = 1;
		
		for (i = 0; i < n; i++){
			min = INF;
			for (j = 0; j < m; j++){
				
				if ( (ch[edges[j].from] == 1 && ch[edges[j].to] == 0) || (ch[edges[j].from] == 0 && ch[edges[j].to] == 1)){
					if (edges[j].weight < min){
						min = edges[j].weight;
						ind = j;
					}
				}
			}
			
			
			if (min == INF){
				break;
			}
			if (ch[edges[ind].from] == 1 && ch[edges[ind].to] == 0){
				ch[edges[ind].to] = 1;
			}
			else {
				ch[edges[ind].from] = 1;
			}
			sum += edges[ind].weight;
		}
		
		printf("%d\n", sum);
	}
	
	
	return (0);
}

Measured memory_bytes: 664
n,q = map(int,input().split())
s = input()
acl = [0]*n #'AC'のCの個数
for i in range(n-1):
  if s[i] == 'A' and s[i+1] == 'C':
    acl[i+1] = acl[i] + 1
  else:
    acl[i+1] = acl[i]
for i in range(q):
  l,r = map(int,input().split())
  l -= 1
  r -= 1
  count = acl[r] - acl[l]
  print(count)

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

int main() {
    double a, b, h, m, hang, mang, ang, ans;
    cin >> a >> b >> h >> m;

    hang = (30 * h) + (30 * m / 60);
    mang = 6 * m;
    ang = hang - mang;
    if (ang > 180) {
        ang = 360 - ang;
    }
    ans = sqrt(a * a + b * b - 2 * a * b * cos(M_PI * ang / 180.0));
    cout << fixed;
    cout.precision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4200
#include <stdio.h>
int max(int a,int b){
    if(a<b){
        return b;
    }
    else{
        return a;
    }
}
int main(int argc, char *argv[]){
    int A,B,C,X,Y,i,sum,min;
    scanf("%d %d %d %d %d",&A,&B,&C,&X,&Y);
    for (i = 0; i <= 100000; i++) {
        sum=i*2*C+max(0,X-i)*A+max(0,Y-i)*B;
        if(i==0||sum<min){
            min=sum;
        }
    }
    printf("%d",min);
}

Measured memory_bytes: 128
S = input()

n = len(S) - 1
ans = 0
for i in range(2 ** n):
    b = 0
    for j in range(n):
        if (i >> j) & 1 == 1:
            ans += int(S[b:j + 1])
            b = j + 1
        else:
            pass
    ans += int(S[b:])
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

set<ll>sset;
ll mas=3234566667;
map<string,int>used;
void dfs(string t){
	int n=t.size();
	int last=t[n-1]-'0';
	deque<string>cand;
	rep(i,3){
		string now=t;
		int d=-1+i;
		if(last+d>=0&&last+d<10){
			now.push_back('0'+last+d);
		}
		ll num=stoll(now);
	//	cout<<num<<endl;
		if(mas>=num){
			sset.insert(num);
			cand.push_back(now);
		}
	}
	rep(i,cand.size()){
		if(!used[cand[i]]){
			used[cand[i]]++;
			dfs(cand[i]);
		}
	}
	

}

void solve()
{
	int n;
	cin>>n;
/*	vector<vector<char>>next(10);
	rep(i,10){
		next[i].push_back('0'+i);
	}
	FOR(i,0,9){
		next[i].push_back('0'+i+1);
	}
	FOR(i,1,10){
		next[i].push_back('0'+i-1);
	}
	rep(i,10){
		rep(j,next[i].size()){
		//	cout<<next[i][j];
		}
		cout<<endl;
	}
	*/
	rep(i,9){
		string m="0";
		m[0]+=i+1;
		//cout<<m<<endl;
		sset.insert(i+1);
		dfs(m);
	}
	auto i=sset.begin();
	int cnt=0;
	ll ans;
	while(i!=sset.end()){
		//cout<<*i<<endl;
		if(cnt==n-1){
			ans=*i;
			break;
		}
		i++;
		cnt++;
	}
	cout<<ans<<endl;

}

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


Measured memory_bytes: 17280
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n := scanInt(sc)
	a := scanIntSlice(sc, n)
	fmt.Println(solve(n, a))
}

func solve(n int, a []int) int {
	cnt, next := 0, 0
	flg := true
	done := 0
	for num := 1; num <= n; num++ {
		for i := next; i < n; i++ {
			if a[i] == 1 {
				flg = false
			}
			if a[i] == num {
				next = i + 1
				done = num
				break
			}
			cnt++
		}
		if flg {
			return -1
		}

		if done + cnt == n {
			break
		}
	}
	return cnt
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanFloat64(sc *bufio.Scanner) float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func scanFloat64Slice(sc *bufio.Scanner, n int) []float64 {
	fs := make([]float64, n)
	for i := 0; i < n; i++ {
		fs[i] = scanFloat64(sc)
	}

	return fs
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 5096
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS


    int n;
    cin >> n;
    
    int arr[n+1][2];
    bool ok = false;

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

    for(int i = 1; i + 2 <= n; i++)
    {
    	if(arr[i][0] == arr[i][1] and arr[i+1][0] == arr[i+1][1] and arr[i+2][0] == arr[i+2][1])
    	{
    		ok = true;
    		break;
    	}
    }


    if(ok)cout << "Yes";
    else cout << "No";


    return 0;
}


Measured memory_bytes: 3644