akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }

struct PriceOrder{
    bool operator()(pair<LL,LL>& op1, pair<LL,LL>& op2){
        return (op1.first>>op1.second) < (op2.first>>op2.second);
    }
};

int main(){
    priority_queue<pair<LL,LL>, vector<pair<LL,LL>>, PriceOrder> q;
    LL n, m;
    cin >> n >> m;
    for(LL i = 0; i < n; ++i){
        LL a;
        cin >> a;
        q.push(pair<LL,LL>(a, 0));
    }
    for(LL i = 0; i < m; ++i){
        pair<LL,LL> top = q.top();
        if((top.first >> top.second) <= 0) break;
        q.pop();
        q.push(pair<LL,LL>(top.first, top.second+1));
    }
    LL ans = 0;
    while(!q.empty()){
        pair<LL,LL> top = q.top();
        ans += (top.first >> top.second);
        q.pop();
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2420
#include <iostream>
typedef long long ll;
using namespace std;

int main(void) {
    ll N;cin>>N;
    ll A[N];
    for (int i = 0; i < N; i++) cin>>A[i];
    ll exam = 1000000000000000000;
    for (int i = 0; i < N; i++) {
        if (A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        exam /= A[i];
    }
    if (exam == 0) cout << -1 << endl;
    else {
        ll result = 1;
        for (int i = 0; i < N; i++) {
            result *= A[i];
        }
        cout << result << endl;
    }
    return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair <int, int> ii;

const ll siz = 1e5 + 10;
const ll SIZ = 1e6 + 10;
const ll mod = 1e9 + 7;
const ll maxx = 2e9;
const ll MAXX = 1e18;
const double pi = 2 * acos(0);

double n;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen ("IN_4.INP", "r", stdin);
//    freopen ("OUT_4.OUT", "w", stdout);
    cin >> n;
    cout << setprecision(20) << fixed << 2 * n * pi;
    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

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

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll MOD = (ll)1e9 + 7; // 998244353
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	ll N; cin >> N;
	bitset<60> bs(N);
	vector<vector<long long>> dp(61, vector<long long>(3, 0));
	dp[60][0] = 1;
	for (int i = 60; i >= 1; --i) {
		if (bs[i - 1]) {
			dp[i - 1][0] = dp[i][0];
			dp[i - 1][1] = dp[i][0] + dp[i][1];
			dp[i - 1][2] = 2*dp[i][1] + 3*dp[i][2];
		}
		else {
			dp[i - 1][0] = dp[i][0] + dp[i][1];
			dp[i - 1][1] = dp[i][1];
			dp[i - 1][2] = dp[i][1] + 3 * dp[i][2];
		}
		dp[i - 1][0] %= MOD;
		dp[i - 1][1] %= MOD;
		dp[i - 1][2] %= MOD;
	}
	cout << (((dp[0][0] + dp[0][1]) % MOD) + dp[0][2]) % MOD << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
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; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x;cin >> x;
	if(x % 11 > 6){
		cout << x / 11 * 2 + 2 << endl;
	}
	else if(x % 11 == 0){
		cout << x / 11 * 2 << endl;
	}
	else{
		cout << x / 11 * 2 + 1 << endl;
	}
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] chars = br.readLine().toCharArray();
        int length = chars.length;
        int[] arr = new int[length + 1];
        for (int i = 0; i < length; i++) {
            arr[i + 1] = chars[i] - '0';
        }
        int kk = Integer.parseInt(br.readLine());
        long[][][] dp = new long[length + 1][2][5];
        dp[0][1][0] = 1;
        for (int i = 1; i <= length; i++) {
            for (int j = 0; j < 4; j++) {
                dp[i][0][j] += dp[i - 1][0][j];
                for (int k = 1; k < 10; k++) {
                    dp[i][0][j + 1] += dp[i - 1][0][j];
                }
                if (arr[i] == 0) {
                    dp[i][1][j] += dp[i - 1][1][j];
                } else {
                    dp[i][0][j] += dp[i - 1][1][j];
                    for (int k = 1; k < arr[i]; k++) {
                        dp[i][0][j + 1] += dp[i - 1][1][j];
                    }
                    dp[i][1][j + 1] += dp[i - 1][1][j];
                }
            }
        }
        long count = dp[length][0][kk] + dp[length][1][kk];
        System.out.println(count);
    }
}


Measured memory_bytes: 23252
class Dice:
    def __init__(self, p):
        self.y = [p[0], p[1], p[5], p[4]]
        self.x = [p[0], p[2], p[5], p[3]]
        self.z = [p[1], p[2], p[4], p[3]]
    def roll(self, c):
        if c == 'y':
            self.y.append(self.y.pop(0))
            self.x[0] = self.y[0]
            self.x[2] = self.y[2]
            self.z[0] = self.y[1]
            self.z[2] = self.y[3]
        elif c == 'x':
            self.x.append(self.x.pop(0))
            self.y[0] = self.x[0]
            self.y[2] = self.x[2]
            self.z[1] = self.x[1]
            self.z[3] = self.x[3]
        elif c == 'z':
            self.z.append(self.z.pop(0))
            self.x[1] = self.z[1]
            self.x[3] = self.z[3]
            self.y[1] = self.z[0]
            self.y[3] = self.z[2]
    def num(self, n):
        n = n - 1;
        pos_y = [0, 1, 5, 4]
        pos_x = [0, 2, 5, 3]
        if n in pos_y:
            return self.y[pos_y.index(n)]
        else:
            return self.x[pos_x.index(n)]

p = [ int(n) for n in input().split()]
q = int(input())
qq = []
for i in range(0, q):
    qq.append([int(n) for n in input().split()])

for (a, b) in qq:
    dice = Dice(p)
    for _ in range(0, 4):
        if dice.num(1) == a:
            break;
        dice.roll('x')
    for _ in range(0, 4):
        if dice.num(1) == a:
            break;
        dice.roll('y')
    for _ in range(0, 4):
        if dice.num(2) == b:
            break;
        dice.roll('z')
    print(dice.num(3))



Measured memory_bytes: 5616
#include <bits/stdc++.h>
#define CHECK cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7, inf = 1e9 + 7;
using namespace std;

void debug(string names) {
	cout << '\n';
}
template<typename A1, typename... A2>
void debug(string names, A1 par, A2... left) {
	int pos = 0;
	for (; pos < names.size() && names[pos] != ' ' && names[pos] != ','; pos++)
		cout << names[pos];
	cout << ": " << par << "  ";
	while (pos < names.size() && (names[pos] == ' ' || names[pos] == ',')) {
		pos++;
	}
	names.erase(names.begin(), names.begin() + pos);
	debug(names, left...);
}

const ll I = (md + 1) / 2;

int n, q;
int G[3003][3003] = {}, E[3003][3003] = {}, L[3003][3003] = {}, cnt[3003] = {};
vector<int> a;
ll ans = 0;

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

	cin >> n >> q;
	a.resize(n);
	for (auto &i : a) cin >> i;
	for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
		if (a[i] < a[j]) L[i][j] = 1;
		else if (a[i] == a[j]) E[i][j] = 1;
		else G[i][j] = 1;
	}
	for (int i = 0, u, v; i < q; i++) {
		cin >> u >> v, --u, --v;
		if (u > v) swap(u, v);
		int g, e, l;
		g = G[u][v], e = E[u][v], l = L[u][v];
		G[u][v] = I * (g + l) % md;
		L[u][v] = I * (l + g) % md;
		for (int st = 0; st < u; st++) {
			G[st][v] = G[st][u] = I * (G[st][u] + G[st][v]) % md;
			E[st][v] = E[st][u] = I * (E[st][u] + E[st][v]) % md;
			L[st][v] = L[st][u] = I * (L[st][u] + L[st][v]) % md;
		}
		for (int st = u + 1; st < v; st++) {
			L[st][v] = G[u][st] = I * (G[u][st] + L[st][v]) % md;
			L[u][st] = G[st][v] = I * (G[st][v] + L[u][st]) % md;
			E[st][v] = E[u][st] = I * (E[u][st] + E[st][v]) % md;
		}
		for (int st = v + 1; st < n; st++) {
			G[v][st] = G[u][st] = I * (G[u][st] + G[v][st]) % md;
			E[v][st] = E[u][st] = I * (E[u][st] + E[v][st]) % md;
			L[v][st] = L[u][st] = I * (L[u][st] + L[v][st]) % md;
		}
	}
	ll mult = 1;
	for (int i = 0; i < q; i++) mult = 2 * mult % md;
	for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
		G[i][j] = G[i][j] * mult % md;
		E[i][j] = E[i][j] * mult % md;
		L[i][j] = L[i][j] * mult % md;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++)
		ans = (ans + G[i][j]) % md;
	finish(ans);
}

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
	ll N;
	cin >> N;
	ll h[N];
	rep(i,0,N) cin >> h[i];

	ll ans = 0;
	while(true) {
		bool can = false;
		rep(i,0,N) {
			if (can) {
				if (h[i] > 0) {
					h[i]--;
					continue;
				}else{
					break;
				}
			}
			if (h[i] > 0) {
				ans++;
				h[i]--;
				can = true;
			}
		}
		if (!can) break;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
#define INF 1e9
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int n,t;
pair<int,int> food[3010];
vector<vector<int>> dp(3010,vector<int>(6010,0));
void solve(){
    rep(i,n){
        rep(j,t){
            int e,v;
            e = food[i].first;
            v = food[i].second;
            chmax(dp[i+1][j],dp[i][j]);
            chmax(dp[i+1][j+e],dp[i][j]+v);
        }
        FOR(j,t,6000){
            chmax(dp[i+1][j],dp[i][j]);
        }
    }
}
int main(){
    cin >> n >> t;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        pair<int,int> p = make_pair(a,b);
        food[i] = p;
    }
    sort(food,food+n);
    solve();
    int ans = 0;
    rep(i,6010){
        ans = max(ans,dp[n][i]);
    }
    PRINT(ans);
}


Measured memory_bytes: 71040
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int check(int x,int y, vvi ch) {
  int flg = 1;
  REP(i,8) {
    if(ch[x][i]==1) {
      flg=0;
      break;
    }
    if(ch[i][y]==1)  {
      flg=0;
      break;
    }
    if(x+i<8&&y+i<8) {
      if(ch[x+i][y+i]==1)  {
      flg=0;
      break;
    }
    }
    if(x-i>=0&&y+i<8) {
      if(ch[x-i][y+i]==1)  {
      flg=0;
      break;
    }
    }
    if(x+i<8&&y-i>=0) {
      if(ch[x+i][y-i]==1)  {
      flg=0;
      break;
    }
    }
    if(x-i>=0&&y-i>=0) {
      if(ch[x-i][y-i]==1)  {
      flg=0;
      break;
    }
    }
  }
  return flg;
}

int solution(double t,double p) {
  double f=1.0-(1/1.5)*log(2)*p*pow(2,-t/1.5);
  if(f>=0) return 1;
  else if(f<0) return 0; 
}

int main() {
  int n,a;
  cin >> n;
  ll ans=0;
  REP(i,n) {
    cin >> a;
    ans+=a-1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
#include<bits/stdc++.h>
//for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;
int main(){
    int n; cin >> n;
    ll a[n+1],b[n]; 
    ll sum=0;
    cinf(n+1,a);
    cinf(n,b);

    for(int i=0;i<n;i++){
        if(b[i] > a[i]){
            if(b[i]-a[i] < a[i+1]){
                sum += b[i];
                a[i+1] -= (b[i]-a[i]);
            }else{
                sum += a[i]+a[i+1];
                a[i+1] = 0;
            }
        }else{
        sum += b[i];
        }
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 1792
def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    box = [0] * N
    for i in range(N - 1, -1, -1):
        # ボールの総数
        cnt = 0
        # (i + 1)の倍数
        num = i + 1
        while num <= N:
            cnt += box[num - 1]
            num += (i + 1)
        
        if cnt % 2 != A[i]:
            box[i] = 1

    ans = [idx + 1 for idx in range(N) if box[idx]]

    print(len(ans))
    if ans:
        print(*ans, sep=" ")

if __name__ == "__main__":
    main()

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n);
  ll sum = 0;
  ll cnt = 0;
  rep(i,n){
    cin >> a[i];
    sum += a[i];
  }

  ll  left = 0;
  ll right = sum;
  ll t = sum / 2;
  ll ans = 1e10;
  rep(i,n){
    left += a[i];
    right -= a[i];
    ans = min(ans,abs(left - right));
  }
  cout << ans << endl;
  return 0;
}


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




int main() {
	ll K;
	cin >> K;
	if (K < 10) {
		cout << K << endl;
	}
	else {
		queue<ll> s;
		vector<ll> vec(K+5);
		
		rep(i, 9) {
			s.push(i + 1);
			vec.at(i) = i + 1;
		}
		ll x = 0;
		ll j = 9;
		ll u = 0;
		while (j < K) {
			 u = s.front();
			/*cout << u << endl;*/
			if (u % 10 != 0) {
				s.push(u * 10 + (u % 10) - 1);
				vec.at(j) = u * 10 + (u % 10) - 1;
				j++;
			}
			s.push(u * 10 + u % 10);
			vec.at(j) = u * 10 + (u % 10);
			j++;
			if (u % 10 != 9) {
				s.push(u * 10 + (u % 10) + 1);
				vec.at(j) = u * 10 + (u % 10) + 1;
				j++;
			}
			x = vec.at(j);
			/*cout << x << endl;*/
			s.pop();
		}

		cout << vec.at(K-1 ) << endl;
		
	}
	


}


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

using namespace std;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  int n; cin >> n;
  int a[n], b[n], c[n];
  for(int i = 0; i<n; ++i) {
    cin >> a[i] >> b[i] >> c[i];
  }

  vector<vector<int> > dp(n, vector<int> (3, INT_MAX));

  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];

  for(int i = 1; i<n; ++i) {
    dp[i][0] = max(dp[i-1][1] + a[i], dp[i-1][2] + a[i]);
    dp[i][1] = max(dp[i-1][0] + b[i], dp[i-1][2] + b[i]);
    dp[i][2] = max(dp[i-1][0] + c[i], dp[i-1][1] + c[i]);
  }
  cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) << endl;
}


Measured memory_bytes: 6912
N = int(input())
memo = [{} for _ in range(100)]

def ok(last4):
    if "AGC" in last4:
        return False
    for i in range(3):
        t = list(last4)
        t[i], t[i+1] = t[i+1], t[i]
        if "AGC" in "".join(t):
            return False
    return True
def dfs(cur, last3):
    if cur == N:
        return 1
    if last3 in memo[cur]:
        return memo[cur][last3]
    ret = 0
    for c in "ACGT":
        if ok(last3+c):
            ret += dfs(cur + 1, last3[1:] + c) % (10**9 + 7)
    memo[cur][last3] = ret
    return ret % (10**9 + 7)
print(dfs(0, "TTT"))

Measured memory_bytes: 3892
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define il inline
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define rep0(i, n) for(int i = 0; i < (n); i ++)
#define per0(i, n) for(int i = (n) - 1; i >= 0; i --)
#define ept 1e-9
#define INF 0x3f3f3f3f
#define sz(x) (x).size()
#define All(x) (x).begin(), (x).end()
#define lowbit(x) ((x) & -(x))
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const ll mod = 1e9 + 7;
const int N = 4e6 + 10;
const db pi = acos(-1);
//int a[N];
int main()
{
	int n = read();
	vi a(n);
	rep0(i, n) a[i] = read();
	a.erase(unique(a.begin(), a.end()), a.end());
	rep0(i, sz(a))
	{
		if(i) cout << " ";
		cout << a[i];
	}
	puts("");
	return 0;
}



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

using namespace std;
int search_combination(vector<int> int_array,int target,int count,int combination);

int main(){
    int n,x;
    while(true){
        cin >> n >> x;
        if(n ==0 && x==0) break;
        vector<int> int_array(n);
        for(int i = 0;i < n;i++){
            int_array[i] = i+1;
        }
        int combination = 0;
        for(int i = 0;i < int_array.size()-2;i++){
            for(int j = i+1;j<int_array.size()-1;j++){
                for(int k = j+1;k<int_array.size();k++){
                    if (int_array[i] + int_array[j] + int_array[k] == x) combination++;
                }
            }
        }

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



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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const ll MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値


//グローバル変数
vector<long long> fact, fact_inv, inv;

const int MAX_N = 5000;
 
long long Com[MAX_N][MAX_N];
 
/* init_nCk:二項係数のための前処理
    計算量:O(MAX_N*MAX_N)
*/
void init_nCk() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < MAX_N; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_N; j++) {
            Com[i][j] = (Com[i - 1][j - 1] + Com[i - 1][j]);
        }
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return Com[n][k];
}

int main(){
    ll N,A,B;
    cin>>N>>A>>B;
    vector<ll> v(N);
    REP(i,N) cin>>v[i];
    ll cnt=0;
    sort(v.begin(),v.end(),greater<ll>());

    long double ans=0.0;
    ll start_pos;
    REP(i,N){
        if(i<A) ans+=(v[i]);
        if(v[i]==v[A-1]){
            if(cnt==0) start_pos=i;
            cnt++;
        }
    }

    init_nCk();

    ll tmp=0;

    if(start_pos==0){
        REP2(i,A,min(cnt,B)+1){
            tmp+=nCk(cnt,i);
        }
    }else{
        tmp+=nCk(cnt,A-start_pos);
    }
    
    

    ans/=A;
    cout.precision(20);
    cout<<fixed<<ans<<endl;
    cout<<tmp<<endl;
    
}


Measured memory_bytes: 199120
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Spandan
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BFizzBuzzSum solver = new BFizzBuzzSum();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFizzBuzzSum {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.readInt();
            long sum = 0;

            for (int i = 1; i <= n; i++) {
                if ((i % 3) != 0 && (i % 5) != 0)
                    sum += i;
            }

            System.out.println(sum);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32452
#include <stdio.h> 
long gcd_euclid(long m, long n) 
{ 
    long tmp; 
    while (n) { 
        tmp = m % n; m = n; n = tmp;
        } return m; 
    
} int main(){ 
    long a, b; 
    long tmp; 
    long gcd; 
    while(scanf("%ld %ld", &a, &b)!=EOF){ 
        gcd = gcd_euclid(a, b); 
        tmp = a / gcd;
        
        printf("%ld\n", gcd); 
        
    } return 0; 
    
}


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

int main() {
  string a,b;
  cin >> a >>b;
  int count =0;
  for (int i = 0; i < a.size(); ++i){
    if (a.at(i) != b.at(i))
      count += 1;
  }
  cout << count << endl;
 
  return 0;
}

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

typedef long long LL;
const int M=1e5+5;

vector<int> g[M];

int uf[M],cnt[M];
int find(int x)
{
	return x==uf[x]?x:uf[x]=find(uf[x]);
}
void merge(int x,int y)
{
	x=find(x); y=find(y);
	if(x==y) return;
	uf[x]=y;
	cnt[y]+=cnt[x];
}

int ans[M];

int main()
{
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
		uf[i]=i,cnt[i]=1;
	int u,v;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&u,&v);
		merge(u,v);
		ans[u]--;
		ans[v]--;
	}
	for(int i=0;i<k;i++)
	{
		scanf("%d%d",&u,&v);
		int fu=find(u),fv=find(v);
		if(fu==fv) ans[u]--,ans[v]--;
	}
	// for(int i=1;i<=n;i++)
	// 	cout<<ans[i]<<" ";
	// cout<<endl;
	for(int i=1;i<=n;i++)
	{
		ans[i]+=cnt[find(i)]-1;
		printf("%d%c",ans[i],i==n?'\n':' ');
	}
	return 0;
}

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

typedef long long ll;

int main()
{
    ll x;
    cin>>x;
    ll n = x;
    ll d=0;
    while(n>0)
    {
        n/=10;
        d++;
    }
    if(d==1)
    {
        return cout<<x , 0;
    }
    if(d==2)
    {
        return cout<<9 , 0;
    }
    if(d==3)
    {
        return cout<<x-99 + 9 , 0;
    }
    // if(d==3)
    // {
    //     return cout<<37 , 0;
    // }
    if(d==4)
    {
        return cout<<909 , 0;
    }
    if(d==5)
    {
        return cout<<x - 9999 + 909 , 0;
    }
    if(d==6)
    {
        return cout<<90909 , 0;
    }
}


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

int dp[100005];
vector<int> adj[100005];

int dfs(int i)
{
    if(dp[i] != -1) return dp[i];
    if(adj[i].size()==0) return 1;
    for(int j : adj[i]) dp[i]=max(dp[i], dfs(j)+1);
    return dp[i]; 
}

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
    }
    memset(dp,-1,sizeof(dp));
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,dfs(i));
    }
    --ans;
    cout<<ans;
    return 0;
}

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

int main(int argc, char *argv[]){
  int b, r, g, c, s, t;
  while(cin >> b >> r >> g >> c >> s >> t){
    if(b == 0 && r == 0 && g == 0 &&
       c == 0 && s == 0 && t == 0)break;
    int medal = 100, bg = 0;
    bg = 5*b + 3*r;//テ」ツδ愿」ツδシテ」ツδ甘」ツつケテ」ツつイテ」ツδシテ」ツδ?・ツ崢榲ヲツ閉ー
    t -= (bg + s);//テゥツ?堙・ツクツクテ」ツつイテ」ツδシテ」ツδ?・ツ崢榲ヲツ閉ー
    medal += g*7;//テ」ツ?カテ」ツ?ゥテ」ツ??ヲツ渉ε」ツ?」テ」ツ?淌・ツ崢榲ヲツ閉ー
    medal += 3*13*r;//テ」ツδャテ」ツつョテ」ツδ・テ」ツδゥテ」ツδシテ」ツδ愿」ツδシテ」ツδ甘」ツつケテ・ツ崢榲ヲツ閉ー
    medal += c*2;//テ」ツδ?」ツつァテ」ツδェテ」ツδシテヲツ渉ε」ツ?」テ」ツ?淌・ツ崢榲ヲツ閉ー
    medal += 15*(b + r);
    medal += 5*13*b;//テ」ツδ禿」ツδε」ツつーテ」ツδ愿」ツδシテ」ツδ甘」ツつケテ・ツ崢榲ヲツ閉ー
    medal -= t*3;//テ」ツδ。テ」ツδ?」ツδォテヲツカツ暗ィツイツサ
    std::cout << medal << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1156
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Ord

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,m] <- getIntList
    xyz <- replicateM n getIntList
    let pms = sequence $ replicate 3 [1,-1]
    let f pm = sum . take m . sortOn Down $ map (sum . zipWith (*) pm) xyz
    let ans = maximum $ map f pms
    print ans

Measured memory_bytes: 5264
/*
 	author:: tamajit banerjee
*/

#include<iostream>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
#define pb push_back
#define ll long long int
# define pll pair<ll,ll>
  
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,d,x,y;
    cin>>n>>d;
    d=d*d;
    int cnt=0;
    for(int i=0;i<n;i++){
    	cin>>x>>y;
    	x=x*x;
    	y=y*y;
    	if(x+y<=d){
    		++cnt;
		}
	}
	cout<<cnt;
	return 0;    
}
    

Measured memory_bytes: 3648
N, M = map(int, input().split())
S = []
for i in range(M):
  S.append(list(map(int, input().split())))
P = list(map(int, input().split()))
ans = 0
for n in range(2 ** N):
  t = [(n >> i) & 1 for i in range(N)]
  f = 0
  for j in range(M):
    c = 0
    for k in S[j][1:]:
      c ^= t[k-1]
    if c != P[j]:
      f = 1
      break
  if f == 0:
    ans += 1
print(ans)

Measured memory_bytes: 73908
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
#include <algorithm>
#include <string>


using namespace std;
using ll = long long;
using ull = unsigned long long;


#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

int main() {
	int K, N;
	vector<int> a;
	cin >> K >> N;

	a.resize(N);

	rep(i, 0, N) {
		cin >> a.at(i);
	}

	int maxmid = abs(K-a.at(a.size()-1) + a.at(0));

	rep(i, 1, N) {
		maxmid  = max(abs(a.at(i - 1) - a.at(i)),maxmid);
	}
	
	cout << K - maxmid << endl;


	return 0;
}



Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;

  if(n % 2 == 1){
    cout << 0 << endl;
    return 0;
  }

  ll ans = 0;

  ll now = 10;
  
  while(n/now){
    ans += n/now;
    now *= 5;
  }
  
   
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,M[MAX][MAX];
int prim(){
  int sum=0,v,i,u,minv;
  int d[MAX],p[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFTY;
    p[i]=-1;
    color[i]=WHITE;
  }
  d[0]=0;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v] != INFTY){
	if(d[v]>M[u][v]){
	  d[v]=M[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i]!=-1)sum+=M[i][p[i]];
  }
  return sum;
}
int main(){
  int e,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      M[i][j]=(e==-1)?INFTY : e;
    }
  }
  printf("%d\n",prim());
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N,K;
vector<LL> a;
vector<LL> s;
vector<LL> p;

int main(void){
    cin>>N>>K;
    REP(i,N){
        LL aa;cin>>aa;a.pb(aa);
    }
    REP(i,N){
        if(i==0){
            s.pb(a[i]);
            p.pb(((0<a[i])?a[i]:0));
        }else{
            s.pb(s[i-1]+a[i]);
            p.pb(p[i-1]+((0<a[i])?a[i]:0));
        }
    }
    LL ans=0;
    REP(i,N-K+1){
        LL r=max(0LL,s[i+K-1]-(i==0?0:s[i-1]));
        // printf("s[i+K-1]-(i==0?0:s[i-1])=%lld\n",s[i+K-1]-(i==0?0:s[i-1]));
        r+=(i==0?0:p[i-1]);
        r+=p[N-1]-p[i+K-1];
        ans=max(r,ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3444
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int n;
	cin >> n;

	int h, m, s;
	h = n / 3600;
	m = n % 3600;

	m = m / 60;
	s = n - (h * 3600 + m * 60);
	cout << h << ":"<< m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  long long D, G, p, c;
  cin >> D >> G;
  vector<int> p_num(D);
  vector<int> bonus(D);
  vector<int> p_sum(D);
  long long ans = 10000, p_cnt = 0, sum = 0;
  
  for (int i = 0; i < D; i++) {
    cin >> p_num.at(i);  
    cin >> bonus.at(i);
    p_sum.at(i) = (i+1) * 100 * p_num.at(i) + bonus.at(i);
  }

  for (int i = 0; i < (1 << D); i++) {
    bitset<11> bs(i);
    p_cnt = 0;
    sum = 0;
    for (int j = 0; j < D; j++) {
      if (bs.test(j) == 1) {
        sum += p_sum.at(j);
        p_cnt += p_num.at(j);
      }
    }
    
    if (sum >= G) {
      ans = min(ans, p_cnt);
      continue;
    }
    else {
      for (int j = D; j > 0; j--) {
        if (bs.test(j-1) == 0) {
          for (int k = 1; k < p_num.at(j-1); k++) {
            sum += (100 * j);
            p_cnt++;
            if (sum >= G) {
              ans = min(ans, p_cnt);
              break;
            }
          }
        }
        if (sum >= G) break;
      }
    }
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 256
import copy

n = int(input())

a = [0] + list(map(int,input().split())) + [0]

#print(a)
anst = 0
for j in range(1,len(a)):
    anst += abs(a[j]-a[j-1])

for j in range(1,len(a)-1):
    ans = anst
    ans -= abs(a[j-1]-a[j]) + abs(a[j]-a[j+1])
    ans += abs(a[j-1]-a[j+1])
    print(ans)

Measured memory_bytes: 14560
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        r: u64,
        g: u64,
        b: u64,
    }
    let mix = 100 * r + 10 * g + b;
    println!("{}", if mix % 4 == 0 { "YES" } else { "NO" });
}


Measured memory_bytes: 4352
<?php
    /*
        Problem URL : http://agc012.contest.atcoder.jp/tasks/agc012_b

        Score  :
        Result :
        Time   : ms
        Memory : KB
     */

    ini_set('error_reporting', E_ALL & ~E_NOTICE);

    // define('DEBUG', true);
    define('DEBUG', false);

    if (DEBUG) {
        $start = microtime(true);
    }

    fscanf(STDIN, "%d %d\n", $N, $M);
    $ans = array_pad(array(), $N+1, 0);
    for ($i = 0; $i < $M; $i++) {
        fscanf(STDIN, "%d %d\n", $a, $b);
        $e[$a][$b] = true;
        $e[$b][$a] = true;
    }
    fscanf(STDIN, "%d\n", $Q);
    for ($i = 0; $i < $Q; $i++) {
        $idx = $Q - $i - 1;
        fscanf(STDIN, "%d %d %d\n", $v[$idx], $d[$idx], $c[$idx]);
    }
    if (DEBUG) var_dump($v);
    for ($i = 0; $i < $Q; $i++) {
        solve($v[$i], $d[$i], $c[$i]);
    }
    // echo "ANS:\n";
    for ($i = 1; $i < count($ans); $i++) {
        echo $ans[$i] . PHP_EOL;
    }

    if (DEBUG) {
        $t = microtime(true) - $start;
        printf ("Elapsed time: %7.3f sec\n", $t);
    }

    // 頂点xから距離yの色$cを塗る、のみに専念
    function solve($x, $y, $c) {
        global $m, $e, $ans;
        if (DEBUG) printf("solve x:%d y:%d c:%d\n", $x, $y, $c);
        // sleep(1);
        if (!isset($m[$x][$y])) {
            // 先にフラグを立てておく
            $m[$x][$y] = 1;

            if ($ans[$x] == 0) {
                $ans[$x] = $c;
            }
            if ($y > 0) {
                if (DEBUG) echo $x . " => " . implode(",", array_keys($e[$x])) . PHP_EOL;
                if (is_array($e[$x])) {
                    foreach ($e[$x] as $k => $dummy) {
                        solve($k, $y-1, $c);
                    }
                }
            }
        }
        return $ans;
    }


Measured memory_bytes: 177016
#include <stdio.h>

void putQueen(int);
void printBoard();
void Sort(int *,int *);

#define N 8
#define FREE 0
#define NOT_FREE 1

int row[N] = {}; //行
int col[N] = {}; //列
int dpop[15] = {}; //対角線上に女王がいないことを意味する0
int dneg[15] = {};
int input_row[8];
int input_col[8];
int k;

int main() {
  int i;
  int r,c;

  scanf("%d",&k);
  for(i=0;i<k;i++) {
    scanf("%d %d",&r,&c);
    input_row[i] = r;
    input_col[i] = c;
    row[r] = c;
    col[c] = NOT_FREE;
    dpop[r+c] = NOT_FREE;
    dneg[r-c+N-1] = NOT_FREE;
  }
  Sort(input_row,input_col);
  /*for(i=0;i<k;i++) {
    printf("%d , %d\n",input_row[i],input_col[i]);
  }*/
  putQueen(0);

  //printBoard();

  return 0;
}

void putQueen(int i) {
  int j;
  int s,t;
  int count=0;

  if(i==N) {
    printBoard();
    //printf("\n");
    return;
  }

  for(s=0;s<k;s++) { //指定したクイーンの位置は動かさない
    if(i == input_row[s]) { //指定したクイーンの位置が移動してる
      //printf("%d -> %d : %d\n",i,input_col[s],row[i]);
      //printf("%d : check\n",i);
      i++; //単純にiを一つずらすだけではダメ？
      if(i==N) {
        printBoard();
        return;
      }
      //backtrack
      //col[j] = dpop[i+j] = dneg[i-j+N-1] = FREE;
    }
  }

    for(j=0;j<N;j++) {
      //can't put
      //if((i==0 && j==0)|| (i==N-1 && j==0)) continue;
      //printf("(i,j) = (%d,%d) : %d , %d , %d\n",i,j,col[j],dpop[i+j],dneg[i-j+N-1]);
      //printf("(i,j) = (%d,%d) : %d , %d , %d\n",i,j,col[j],dpop[i+j],dneg[i-j+N-1]);
      if(col[j] == NOT_FREE || dpop[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE) {
        //printf("%d ; %d\n",i,j);
        continue;
      }
      row[i] = j; //その行の何列目にQueenを入れるか、都度更新
      col[j] = dpop[i+j] = dneg[i-j+N-1] = NOT_FREE;

      //NEXT
      putQueen(i+1);
      //backtrack
      col[j] = dpop[i+j] = dneg[i-j+N-1] = FREE;
      //printf("・・・(i,j) = (%d,%d) : %d , %d , %d\n",i,j,col[j],dpop[i+j],dneg[i-j+N-1]);
      //printf("///(i,j) = (%d,%d) : %d , %d\n",i,j,dpop[i+j],dneg[i-j+N-1]);
    }
}

void printBoard() {
  int i,j;
  for(i=0;i<N;i++) {
    for(j=0;j<N;j++) {
      if(j == row[i]) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void Sort(int *array,int *A) {
  int tmp;
  int tmp2;
  int i,j;

  for(j=1;j<k;j++) {
    tmp = array[j];
    tmp2 = A[j];
    //i=j-1;
    for(i=j-1;i>=0;i--) {
      if(array[i+1]<array[i]) {
        array[i+1] = array[i];
        array[i] = tmp;
        A[i+1] = A[i];
        A[i] = tmp2;
      }
    }
  }

}



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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){
  int a,b;cin >> a >> b;
  cout << (a-1)*(b-1) << endl;

  return 0;
}


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

int main(){
	
	int a,b,c,k=0;
	cin>>a>>b>>c;
	
	for(int i=a;i<=b;i++){
		if(c%i==0)
			k++;
	}
	cout<<k<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
int main()
{
    int x; cin >> x;
    cout << ((x==1)?"0":"1") << endl;
    return 0;
}

Measured memory_bytes: 3608
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=rd())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int rd(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	c^'-'?(k=1,x=c&15):k=x=0;
	while(isdigit(Gc(c)))x=x*10+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
#define N (20)
int n,m,x,c[N],a[N][N],ans(INF);
signed main(){
	Rd(n),Rd(m),Rd(x);
	Frn1(i,1,n){
		Rd(c[i]);
		Frn1(j,1,m)Rd(a[i][j]);
	}
	Frn0(i,1,1<<n){
		int tmp(0),b[N]{};
		Frn1(j,1,n)if(i&(1<<(j-1))){
			tmp+=c[j];
			Frn1(k,1,m)b[k]+=a[j][k];
		}
		bool f(1);
		Frn1(j,1,m)if(b[j]<x)f=0;
		if(f)ans=min(ans,tmp);
	}
	wr(ans==INF?-1:ans),exit(0);
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int x, happy500, happy5;

	scanf("%d", &x);
	
	happy500 = 1000 * (x / 500);
	x = x % 500;
	happy5 = 5 * (x / 5);

	printf("%d", happy500 + happy5);

	return 0;
}

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


int main() {
	int n, a, b;
	int sum = 0;
	//scanf_s("%d%d%d", &n, &a, &b);
	scanf("%d%d%d", &n, &a, &b);
	for (int i = 1; i <= n; i++) {
		int j = i; //iの値を操作すると、順番が狂う。
		int remainder = 0;
		while (j > 0) {
			remainder += j % 10;
			j /= 10;
		}
		if (a <= remainder && remainder <= b) {
			sum += i;
		}
	}
	printf("%d", sum);

	return 0;
}


Measured memory_bytes: 3196
from numpy import*;N,K=map(int,input().split());m=zeros((3*K,3*K),dtype=int);L=2*K;o=0
for _ in[0]*N:x,y,c=input().split();t=c=='W';m[int(x)%L,int(y)%L]+=2*t-1;o+=t
for _ in[0,0]:m[L:]=m[:K];m=cumsum(m,axis=0);m[:L]-=m[K:];m=m.T
m=m[:L,:L];print(o-int((m+roll(roll(m,K,axis=0),K,axis=1)).min()))

Measured memory_bytes: 167372
import sys
from collections import Counter
n, k = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]
ct = Counter(a_ls)
variety = len(ct.keys())

cnt = 0
ans = 0
for key, v in sorted(ct.items(), key=lambda x:x[1]):
    if cnt >= variety - k:
        break
    ans += v
    cnt += 1
print(ans)

Measured memory_bytes: 39524
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int triple_max(int x, int y, int z);

int main(){
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0){
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;
}

int triple_max(int x, int y, int z){
    int ans = x;
    if (y > x && y > z) ans = y;
    else if (z > x && z > y) ans = z;

    return ans;
}


Measured memory_bytes: 256