akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a); i >= (b); --i)
#define sz(a) int((a).size())
#define pconent(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef long double ld;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ost;
const ll MOD =  1e13;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(v) (cout<<#v<<" = "<<v<<endl)
#define endln (cout<<endl)
template <class T> inline void dbv(T a) {  for(auto x : a){ cout<<x<<", " ;} cout<<endl;}
using namespace std;
vector<ll> ans;
ll n;
ll ch;
void check(vector<ll> &a)
{
    if(a.size()==0)
    {
        return;
    }
    ll sz = a.size();
    // dbv(a);
    ll temp = 0;
    FORd(i,n-1,0)
    {
        if(a[i]==i+1 && i+1<=a.size())
        {
            a.erase(a.begin()+i);
            check(a);
            temp = 1;
            ans.pb(i+1);
            break;
        }
    }
    // cout<<temp<<" ** "<<sz<<endl;
    if(temp==0)
    {
        ch = 0;
    }
    return;
}
void output(ll tx)
{
    cin>>n;
    vector<ll> a(n);
    FOR(i,0,n)
    {
        cin>>a[i];
    }
    ch = 1;
    check(a);
    if(ch==0)
    {
        cout<<-1<<endl;
        return;
    }
    FOR(i,0,n)
    {
        cout<<ans[i]<<endl;
    }
}
int main()
{
    ll t = 1;
    // cin>>t;
    FOR(i,0,t)
    {
    	// cout<<"Case #"<<(i+1)<<": ";
        output(i+1);
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define EVEL 1
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X;}
#define TF(f) {f;}
#define END {}
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (10*10*10*10*10*10*10*10*10+7);

    string A,B,C;
    int N,M,K,X,Y;
    int ans;
    string S;
    char n[10];
    int temp[100]={0};
    bool f=true;
    bool fir=true;

int main(){
    cin>>A>>B>>C;
    while(1){
        if(fir){
            n[0]=A[0];
            A.erase(A.begin());
            fir=false;
        }else{

            if('a'==n[0]){
                if(A.size()==0){cout<<"A";return 0;}

                n[0]=A[0];A.erase(A.begin());
            }
            else if('b'==n[0]){
                if(B.size()==0){cout<<"B";return 0;}
                n[0]=B[0];B.erase(B.begin());
            }
            else if('c'==n[0]){
                if(C.size()==0){cout<<"C";return 0;}
                n[0]=C[0];C.erase(C.begin());
            }
        }
        DEB(n[0])DEB(A.size())DEB(B.size())DEB(C.size())END
    }

}

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

using namespace std;

#define allof(x) (x).begin(), (x).end()

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

int N, M;
map<int, int> freq;

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

    cin >> N >> M;

    freq[0] = 1;

    ll ans = 0;

    for(int a = 1, tot = 0; a <= N; a++){
        int x;
        cin >> x;

        tot = (tot + x) % M;
        ans += freq[tot]++;
    }

    cout << ans;
}


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

string s[510];
int r[510][510];

int main() {
	int H, W;
	while(cin >> H >> W, H + W) {
		for(int i = 0; i < H; i++) {
			cin >> s[i];
		}
		memset(r, 0, sizeof r);

		for(int i = 0; i < H; i++) {
			for(int j = W - 1; j >= 0; j--) {
				r[i][j] = r[i][j + 1];
				if(s[i][j] == '*') r[i][j] = 0;
				else r[i][j]++;
			}
		}

		int ans = 0;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				int w = r[i][j];
				for(int k = i; k < H; k++) {
					w = min(w, r[k][j]);
					ans = max(ans, (k - i + 1) * w);
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 4312
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define MM <<" "<<
#define Endl endl

signed main(void){
    int N,K;
    int a[114514],b[114514];
    vector<int> G[114514];
    int par[114514]={};
    int chi[114514]={};
    cin >> N >> K;
    REP(i,N-1){
        cin >> a[i] >> b[i];
        a[i]--;b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
        par[b[i]]=a[i];
    }
    int Ans=1;
    par[0]=104514;
    par[104514]=104514;
    
    
    queue<int> Q;
    bool al[114514]={};
    Q.push(0);
    
    while(!Q.empty()){
        int i=(int)Q.front();
        Q.pop();
        if(i==0){
            Ans=(Ans*K)%MOD;
            //cout << K << endl;
        }else{
            int num=0;
            chi[par[i]]++;
            num=chi[par[i]];
            if(par[par[i]]!=104514){num++;}
            int sum=max(0LL,K-num);
            Ans=(Ans*sum)%MOD;
            //cout << sum << endl;
        }
        al[i]=1;
        REP(j,G[i].size()){
            if(al[G[i][j]]==0){
                Q.push(G[i][j]);
                par[G[i][j]]=i;
            }
        }
    }
    
    cout << Ans << endl;
    return 0;
}




Measured memory_bytes: 11380
import java.util.*;

class Main
{
    static int MOD = 998244353;

    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        long K = sc.nextLong();
        long ans = 0;
        long[] comb = new long[n+1];
        comb[0] = 1;
        for(int i = 1; i < n+1; i++){
            comb[i] = comb[i-1] * (n - i + 1) % MOD * pow(i, MOD - 2) % MOD;
        }
        long q = K + A;
        for(int x = 0; x <= n; x++){
            q -= A;
            if(q % B == 0){
                long y = q / B;
                if(y > n) continue;
                if(y < 0) break;
                ans = (ans + comb[x] * comb[(int)y] % MOD) % MOD;
            }
        }
        System.out.println(ans);
    }
    public static long pow(long a, int b){
        if(b == 1) return a;
        if(b % 2 == 0){
            long d = pow(a, b / 2);
            return d * d % MOD;
        }
        return a * pow(a, b - 1) % MOD;
    }
 }


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

int main(){
	int A,B,C,D,P,X,Y;
	cin>>A>>B>>C>>D>>P;
	X=A*P;
	Y=max(B,B+D*(P-C));
	cout<<min(X,Y)<<endl;
	return 0;
}

Measured memory_bytes: 1164
//
// Created by mamurai on 16/09/24.
//

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X, Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64;
typedef vector<int> ivec;
typedef vector<string> svec;

int main(){
    char s[15];
    char tmp[15];
    scanf("%s", s);
    for (int i = 0; i <= 3; i++) {
        tmp[i] = s[i];
    }
    tmp[4]=' ';
    for (int i = 5; i <= 13; i++) {
        tmp[i] = s[i-1];
    }
    printf("%s\n", tmp);

    return 0;
}

Measured memory_bytes: 256
#coding:utf-8
from datetime import date


def main():
    year, month, day = map(int, input().split('/'))
    given = date(year, month, day)
    border = date(2019, 4, 30)

    if given <= border:
        print('Heisei')
    else:
        print('TBD')

if __name__ == "__main__":
    main()

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

using namespace std;

int main(void)
{
	int n, r;
	while(cin >> n >> r, n > 0){
		vector<int> card(n);
		//カード番号初期化
		for(int i=0;i<n;i++){
			card[i] = n-i;
		}
		//シャッフル処理
		for(int i=0;i<r;i++){
			int p, c;
			cin >> p >> c;
			rotate(card.begin(), card.begin()+p-1, card.begin()+p+c-1);
		}
		cout << card[0] << endl;
	}
	return 0;
}


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

int main() {
    
    int n;
    int i, j;
    ll ans=0;
    int tmp;

    cin >> n;

    ans += 2*(n-2);

    for(i=1; i<n; i++){
    	if(i*i >= n){
    		break;
    	}
    }
	tmp = i;
    ans += i-1;

    for(i=2; i<=tmp; i++){
    	for(j=i+1; i*j<n; j++){
    		if(i*j < n){
    			ans += 2;
    		}
    	}
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    string s;
    cin >> s;
    ll n = s.size();
    string ts = string(n/2+n%2,'g') + string(n/2,'p');

    int lscnt = 0;
    int wincnt = 0;
    REP(i,n){
        if(s[i] == 'g' && ts[i] == 'p'){
            wincnt ++;
        }
        else if(s[i] == 'p' && ts[i] == 'g'){
            lscnt++;
        }
    }

    cout << wincnt - lscnt << endl;

    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int r = int.Parse(str[0]);
        int g = int.Parse(str[1]);
        int b = int.Parse(str[2]);

        if((r * 100 + g * 10 + b) % 4 == 0){
            Console.WriteLine("YES");
        }else{
            Console.WriteLine("NO");
        }
    }
}



Measured memory_bytes: 13140
N, M = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
num = [0,2,5,5,4,5,6,3,7,6] 
D = {}
for i in range(M):
  n = num[A[i]]
  if D.get(n):
    D[n] = max(D[n], A[i])
  else:
    D[n] = A[i]

DP = [(-1, -1)]*(N+1)
DP[0] = (0, 0)
for i in range(N+1):
  for key in D:
    if i - key >= 0 and DP[i-key] != -1:
      temp = (DP[i-key][0] + 1, max(DP[i-key][1], D[key]))
      DP[i] = max(DP[i], temp)

ans = ''
now = N
while now > 0:
  ans += str(DP[now][1])
  now = now - num[DP[now][1]]
print(ans)

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
int main(){
  char s;
  cin>>s;
  if(s=='A'||s=='B'||s=='C'||s=='D'||s=='E'||s=='F'||s=='G'||s=='H'||s=='I'||s=='J'||s=='K'||s=='L'||s=='M'||s=='N'||s=='O'||s=='P'||s=='Q'||s=='R'||s=='S'||s=='T'||s=='U'||s=='V'||s=='W'||s=='X'||s=='Y'||s=='Z'){
    cout<<'A'<<endl;
  }else cout<<'a'<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int dist = b-a;
    if (dist%2 == 0) puts("Alice");
    else puts("Borys");
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int d = in.nextInt();
			if (d == 25) out.println("Christmas");
			if (d == 24) out.println("Christmas Eve");
			if (d == 23) out.println("Christmas Eve Eve");
			if (d == 22) out.println("Christmas Eve Eve Eve");
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public int[] nextIntArray1Index(int n) {
			int[] res = new int[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public long[] nextLongArray1Index(int n) {
			long[] res = new long[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextLong();
			}
			return res;
		}

		public double[] nextDoubleArray(int n) {
			double[] res = new double[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextDouble();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 21588
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

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

int lcm(int a, int b){
  return a / gcd(a, b) * b;
}

int main() {
  int N; cin >>N;
  int ans; cin >>ans;
  FOR(i, 1, N){
    int a; cin >>a;
    ans = lcm(ans, a);
  }
  cout <<ans <<endl;
  return 0;
}

Measured memory_bytes: 1160
// TOPSIC001_0

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;


int main(){
    int A; cin >> A;
    if(A == 7 || A == 5 || A == 3){
        cout << "YES";
        return 0;
    }

    cout << "NO";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include<set>
using namespace std;
long long int mpown(long long int m, int n);
long long int bign=1000000007;
int bitCount(int bits);
int main()
{
    int n,m;
    cin >> n >> m;
    // set<long long int> a;
    vector<long long int> a(n);
    long long int inp;
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        // a.insert(inp)
    }
    sort(a.begin(),a.end());
    pair<long long int,long long int> cb[m];
    long long int b,c;
    for(int i=0;i<m;i++){
        cin >> b >> c;
        cb[i]=make_pair(-c,b);
    }
    sort(cb,cb+m);
    long long int ind=0;
    int nokori=cb[0].second;
    long long int ans=0;
    for(int i=0;i<n;i++){
        if(nokori ==0 || ind>=m){
            ans+= a.at(i);
        }else if(a.at(i) < (-cb[ind].first)){
            ans-=cb[ind].first;
            nokori--;
            if(nokori==0){
                ind++;
                if(ind < m)nokori=cb[ind].second;
            };
        }else{
            ans+= a.at(i);
        }
        
    }
    cout << ans << endl;
    // for(int i=0;i<m;i++){
    //     if(ind+cb[i].second >= n){

    //     }
    //     if(a.at(ind+cb[i].second) >= (-cb[i].first)){
    //         ans = ans+(-cb[i].first)*cb[i].second;
    //     }

    // }

    return 0;
}

int bitCount(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); //  2bitごとに計算
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); //  4bitごとに計算
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); //  8bitごとに計算
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); //  16ビットごとに計算
    return (bits & 0x0000ffff) + (bits >> 16);             //  32ビット分を計算
}
long long int mpown(long long int m, int n)
{
    if (n == 0)
        return 1;
    else if (n == 1)
        return m;
    else
    {
        long long int temp = mpown(m, n / 2);
        return temp * temp * (n & 1 ? m : 1);
    }
}

Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
#define ll long long int
//#define d double
#define F first
#define S second
#define FastIO ios_base::sync_with_stdio(false),cin.tie(0)
#define fix std::fixed<<setprecision(10)
const int M=1e9+7;
#define f(n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
#define cl(n,m) (ceil(double(n)/double(m)))
#define T() int t; cin>>t; while(t--)
#define pi pair<ll,ll>
//const int MOD=998244353;
const int MOD=1e9+7;
#define endl "\n"
const double PI = 3.141592653589793238460;
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
//bitset<N>bs;
//bitset<512>bb[512];
//vector<vector<int>>arr;

ll power(ll a,ll b)
{
    ll res=1;
    if(a==0)return 0;
    if(a==1)return 1;
    for(;b>0;b>>=1)
    {
        if(b&1)res=(res*a);
        if(res>MOD)res%=MOD;
        a=(a*a);
        if(a>MOD)a=a%MOD;
    }
    return res;
}

bool isPrime[1000001];
vector<ll>prime;

void seive(int limit)
{
    isPrime[0]=isPrime[1]=1;

    for(int i=2;i*i<=limit;i++)
    {
        if(!isPrime[i])
        for(int j=i*i;j<=limit;j+=i)
        {
            isPrime[j]=1;
        }
    }
    for(int i=2;i<=limit;i++)if(!isPrime[i])prime.pb(i);
}

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

    set<int>r,g,b;
    vector<int>rr,gg,bb;
    f(n)
    {
        if(s[i]=='R')r.insert(i),rr.pb(i);
        if(s[i]=='G')g.insert(i),gg.pb(i);
        if(s[i]=='B')b.insert(i),bb.pb(i);
    }

    ll ans=0;

    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(s[i]==s[j])continue;

            char c='R'+'G'+'B'-s[i]-s[j];

            if(c=='R')
            {
                int pos=lower_bound(rr.begin(),rr.end(),j)-rr.begin();
                ans+=rr.size()-pos;
                if(r.count(2*j-i))ans--;
            }
            else if(c=='G')
            {
                int pos=lower_bound(gg.begin(),gg.end(),j)-gg.begin();
                ans+=gg.size()-pos;
                if(g.count(2*j-i))ans--;
            }
            else
            {
                int pos=lower_bound(bb.begin(),bb.end(),j)-bb.begin();
                ans+=bb.size()-pos;
                if(b.count(2*j-i))ans--;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3844
N, Y = map(int, input().split())

x, y, z = -1, -1, -1

for i in range(N+1):
    for j in range(N-i+1):
        if 10000*i + 5000*j + 1000*(max(N-i-j, 0)) == Y:
            x = i
            y = j
            z = N - (i+j)
            break

print(x, y, z)

Measured memory_bytes: 3064
N, K = map(int, input().split())
S, P, R = map(int, input().split())
T = input()
dic = {'s':S,'p':P,'r':R}
def solve(T):
    ans = 0
    for i in range(K):
        ans += dic[T[i]]
        serial = 1
        for j in range(i+K,N,K):
            if T[j]==T[j-K]:
                serial += 1
            else:
                serial = 1
            if serial%2==1:
                ans += dic[T[j]]
    return ans
print(solve(T))



Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>

int main()
{
    int D;
    std::cin >> D;
    std::string out;
    switch (D)
    {
    case 22:
        out = "Christmas Eve Eve Eve";
        break;
    case 23:
        out = "Christmas Eve Eve";
        break;
    case 24:
        out = "Christmas Eve";
        break;
    case 25:
        out = "Christmas";
        break;
    default:
        break;
    }
    std::cout << out << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{    int a=0,b=0;
    string str;
    cin>>str;
for(int i=0;i<str.size();i++){
    if(str[i]=='A') a++;
    else b++;
}
if(a>0 && b>0) cout<<"Yes"<<endl;
else  cout<<"No"<<endl;
   }

Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int count[10000];
  int i,j,a_num;
  unsigned short *a,*b;


  for(i = 0; i < 10000; i++){
    count[i] = 0;
  }

  scanf("%d",&a_num);
  a = malloc(sizeof(short)*a_num+1);
  b = malloc(sizeof(short)*a_num+1);

  for(i = 0; i < a_num; i++){
    scanf("%hu",&a[i+1]);
  }

  for(i = 0; i < a_num; i++){
    count[a[i+1]]++;
  }


  for(i = 1; i <= 10000; i++){
    count[i] = count[i]+count[i-1];
  }

  for(i = a_num; i > 0;i--){
    b[count[a[i]]] = a[i];
    count[a[i]]--;
  }

  for(i = 1; i < a_num; i++){
    printf("%d ",b[i]);
  }
  printf("%d\n",b[i]);

  return 0;
}

Measured memory_bytes: 8456
package main 

import (
  "fmt"
)

func main() {
  var x1, y1, x2, y2 int
  fmt.Scan(&x1, &y1, &x2, &y2)
  
  move1 := x2 - x1
  move2 := y2 - y1
  
  fmt.Println(x2 - move2,y2 + move1,x2 - move2 - move1,y2 + move1 - move2)
}

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

using namespace std; 	
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e4+50;
const int oo = 1e9;
const int mod = 1e5;

ll a[N];
int main(){
	ll n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	ll f=0,s=0;
	for(int i=0;i<n;i++){ 
		ll b;
		cin>>b;
		if(a[i]-b > 0){
			f += a[i]-b;
		}else{
			if((b-a[i])%2)f++;
			s += ceil((b-a[i])/2.0);
		}
	}
	cout << (f>s?"No":"Yes") << endl;
}

Measured memory_bytes: 384
#include "iostream"
using namespace std;
 
int main(){
  
 int ans=0;
   char S[4] = {0};
  char T[4] = {0};
  
  for(int i=1; i<=3;i++){
   cin >> S[i];
  }
   
  for(int i=1; i<=3;i++){
   cin >> T[i];
  }
  
  for(int i=1; i<=3;i++){
   if(S[i]==T[i]){
     ans++;
   }
  }

    cout <<ans;

  
  
  return 0;
}

Measured memory_bytes: 256
from collections import Counter
from itertools import combinations

N = int(input())
Name = []
Group = []
March = ['M', 'A', 'R', 'C', 'H']

for _ in range(N):
    S = input()
    Name.append(S)
    Group.append(S[0])

Group_C = Counter(Group)
ans = 0
for I in combinations(March, 3):
    ansi = 1
    for i in I:
        ansi *= Group_C[i]
    ans += ansi

print(ans)

Measured memory_bytes: 63832
/* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod 998244353
#define endl '\n'
#define MAXI (int)(3e17+10)
#define N 1000005



// Driver code to test above functions
int32_t main()
{
    
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

   int k, a, b;
   cin >> k >> a >> b;

    if((a-1)/k==b/k)
        cout << "NG";
    else
        cout << "OK";


    return 0;

} 


Measured memory_bytes: 3612
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int minCost(int *arr, int n, int *dp){
    if(n==1) return 0;
    
    if(dp[n]!=-1) return dp[n];
    
    int oneJump=abs(arr[n]-arr[n-1]) + minCost(arr,n-1,dp);
    int twoJump=n==2?INT_MAX:abs(arr[n]-arr[n-2]) + minCost(arr,n-2,dp);
    dp[n]= min(oneJump,twoJump);
    return dp[n];
}

int main(){
	int n;
  	cin>>n;
  	int *arr=new int[n+1];
    for(int i=1;i<=n;i++){
    	int h;
      	cin>>h;
      	arr[i]=h;
    }
    
    int *dp=new int[n+1];
    memset(dp,-1,sizeof(dp[0])*(n+1));
    
    cout<< minCost(arr,n,dp)<<endl;
  	return 0;
}

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

using namespace std;

int main()
{
    int k,i,j,l,x;
    long long s=0;
    cin>>k;
    for(i=1;i<=k;i++)
    {
        for(j=i;j<=k;j++)
        {
            for(l=j;l<=k;l++)
            {
                x=__gcd(__gcd(i,j),l);
                if(i!=j&&j!=l)
                    s+=6*x;
                else if(i!=j||j!=l)
                    s+=3*x;
                else
                    s+=x;
            }
        }
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 3592
a, b, c, d = [int(i) for i in input().split()]

a = a - 1


def gcd(x: int, y: int) -> int:
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x, y = y, r
    return x


cd = (c * d) // gcd(c, d)

a_c = a // c
b_c = b // c
a_d = a // d
b_d = b // d
a_cd = a // cd
b_cd = b // cd

res = b - (b_c + b_d - b_cd) - (a - (a_c + a_d - a_cd))
print(res)


Measured memory_bytes: 61932
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


n, m = nm()
l, r = nm()
for i in range(m - 1):
    l_t, r_t = nm()
    l, r = max(l, l_t), min(r, r_t)
if r >= l:
    print(r - l + 1)
else:
    print(0)


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

int main()
{
    int K, X;
    cin >> K >> X;
    rep(i, 2 * K - 1)
    {
        cout << X - K + 1 + i << endl;
    }
}

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

#include <stdlib.h>

using namespace std;

typedef long long ll;

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

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

const ll MOD = 1000000007;

vector<ll> toi(char c) {
    vector<ll> res;
    if(c == '?') {
        for (int i = 0; i < 10; i++) {
            res.push_back(i);
        }
    } else {
        res.push_back((ll) (c - '0'));
    }
    return res;
}

ll solve(const int pos, const vector<ll> &rems, const string &S) {
    if (pos >= (int) S.length()) {
        return rems[5];
    }

    vector<ll> my_rems((int) rems.size(), 0);
    vector<ll> vs = toi(S[pos]);
    for (auto v : vs) {
        ll acc = v;
        for (int i = 0; i < (int) rems.size(); i++) {
            // if ((i + acc) % 13 == 5) {
                my_rems[(i * 10 + acc) % 13] = (my_rems[(i * 10 + acc) % 13] + rems[i]) % MOD;
            // }
        }
    }

    // for (int i = 0; i < (int) my_rems.size(); i++) {
    //     cout << my_rems[i] << " ";
    // }
    // cout << endl;

    return solve(pos + 1, my_rems, S);
}

int main(void) {
    string S;
    cin >> S;

    vector<ll> xs(13, 0);
    vector<ll> vs = toi(S[0]);
    for (auto v : vs) {
        xs[v]++;
    }

    auto rems = solve(1, xs, S);

    // ll answer = 0;
    // for (int i = 0; i < (int) rems.size(); i++) {
    //     answer = (answer + rems[i]) % MOD;
    // }
    // cout << answer << endl;

    cout << rems << endl;

    return 0;
}


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

using namespace std;
typedef long long int ll;

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

    vector<ll> A(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%lld", &A.at(i));
    }

    vector<ll> heapA;
    for (int i = 0; i < n; i++)
    {
        heapA.push_back(A.at(i));
    }

    make_heap(heapA.begin(), heapA.end());

    for (int i = 0; i < m; i++)
    {
        pop_heap(heapA.begin(), heapA.end());
        int num = heapA.back();
        heapA.pop_back();
        num /= 2;
        heapA.push_back(num);
    }

    ll sum = 0;
    for (auto num : heapA)
    {
        sum += num;
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 2168
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var a     = int.Parse(spl[0]);
        var b     = int.Parse(spl[1]);
        var c     = int.Parse(spl[2]);

        if(a==b && a != c) {
            return "Yes";
        }
        if(a==c && a != b) {
            return "Yes";
        }
        if(c==b && a != c) {
            return "Yes";
        }

        return "No";
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int a = ReadInt();
        int b = ReadInt();
        int c = ReadInt();
        int k = ReadInt();
        int x = 0;
        while (b <= a)
        {
            b *= 2;
            x++;
        }
        while (c <= b)
        {
            c *= 2;
            x++;
        }
        Console.WriteLine(x <= k ? "Yes" : "No");
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
}


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

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var count0 = 0;
            var count1 = 0;
            for (var i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0 && s[i] == '1') count0++;
                else if (i % 2 != 0 && s[i] == '0') count0++;
            }
            for (var i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0 && s[i] == '0') count1++;
                else if (i % 2 != 0 && s[i] == '1') count1++;
            }
            Console.WriteLine(Math.Min(count0, count1));
        }
    }
}


Measured memory_bytes: 11232
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14)

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    string s;
    cin >> n;
    cin >> s;
    if(n%2!=0){
        cout << "No";
        return 0;
    }
    string t=s.substr(0,n/2);
    if(equal(s.begin()+(n/2),s.end(),t.begin(),t.end())){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool A(int z){
  if(z==1){
    return false;
  }
  if(z==2){
    return true;
  }
  for(int i=2;i*i<z;i++){
    if(z%i==0){
      return false;
    }
  }
  return true;
}

int main() {
  int X;
  cin>>X;
  while(!A(X)){
    X++;
  }
  cout<<X<< endl;
}
    
      
    
    
    



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,s,g;
  while(cin>>n>>m,n||m){
    cin>>s>>g;
    //cout << n << m << s << g << endl;
    s--;g--;
    int d[n][n],c[n][n];
    memset(d,-1,sizeof(d));
    memset(c,-1,sizeof(c));
    int i,j,k,l,x,y;
    for(i=0;i<m;i++){
      cin>>x>>y>>j>>k;
      x--;y--;
      d[x][y]=d[y][x]=j;
      c[x][y]=c[y][x]=k;
    }
    double v[n][50][n];
    double inf=1<<28,p,ans=inf;
    for(i=0;i<n;i++) for(j=0;j<50;j++) for(k=0;k<n;k++) v[i][j][k]=inf;
    typedef pair<int,int> PPP;
    typedef pair<int,PPP> P;
    typedef pair<double,P> PP;
    priority_queue<PP,vector<PP>,greater<PP> > q;
    q.push(PP(0,P(s,PPP(1,-1))));
    while(!q.empty()){
      x=q.top().second.first;
      y=q.top().second.second.first;
      k=q.top().second.second.second;
      p=q.top().first;q.pop();
      if(v[x][y][k]<=p) continue;
      v[x][y][k]=p;
      //cout << x+1<< ":"<< y << "/" << p << endl;
      if(x==g&&y==1) break;
      for(i=0;i<n;i++){
	if(!~d[x][i]||i==k) continue;
	for(j=-1;j<=1;j++){
	  if(k==-1&&j!=0) continue;
	  if(y+j<=0||c[x][i]<y+j) continue;
	  q.push(PP(p+(double)d[x][i]/(y+j),P(i,PPP(y+j,x))));
	}
      }
    }
    for(i=0;i<n;i++) ans=min(ans,v[g][1][i]);
    if(ans!=inf) printf("%.8f\n",ans);
    else printf("unreachable\n");
  }
  return 0;
}

Measured memory_bytes: 21376
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);    //整数の入力
      int A = sc.nextInt();
      int B = sc.nextInt();
      if(A <= 8 && B <= 8){
        System.out.println("Yay!");
      } else {
        System.out.println(":(");
      }
  }
} 

Measured memory_bytes: 21716
# 入力
N,M,C=map(int,input().split())
lb=list(map(int,input().split()))

# カウンタ
ans=0

for i in range(N):
  # 入力
  la=list(map(int,input().split()))

  sm=0
  for j in range(M):
    sm+=la[j]*lb[j]

  # 0より大きいかチェック
  if sm+C>0:
    ans+=1

# 出力
print(ans)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  if (x == 1 and y == 1) {
    cout << 1000000 << endl;
  } else if (x <= 3 and y <= 3) {
    cout << 600000 - (100000 * (x + y - 2)) << endl;
  } else if (x <= 3) {
    cout << 300000 - (100000 * (x - 1)) << endl;
  } else if (y <= 3) {
    cout << 300000 - (100000 * (y - 1)) << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

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

int main() {
    unsigned int n;
    std::cin>>n;
    std::vector<long long> a;
    for (int i = 0; i < n; ++i) {
        long long t;
        std::cin>>t;
        a.push_back(t);
    }
    std::vector<long long> lis(n,12345678910);
    for(auto i:a){
        auto it=std::lower_bound(lis.begin(),lis.end(),i);
        lis[it-lis.begin()]=i;
    }
    std::cout<<std::lower_bound(lis.begin(),lis.end(),12345678910)-lis.begin()<<std::endl;
    return 0;
}


Measured memory_bytes: 4684
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
ll in(){ ll x; cin >> x; return x; }
vector<ll> in(size_t n){ vector<ll> v(n); each(x, v) cin >> x; return v; }
/* ]]] */

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b) * c / 2 << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        int n= scn.nextInt();
        int a=scn.nextInt();
        int b=scn.nextInt();
        System.out.println(Math.min(a*n,b));
    }
}

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

int main(){
	string s, strCopy;
	while (getline(cin, s)) {
		for(int j=0 ; j<26 ; j++){
			for(int i=0 ; i<s.size() ; i++){
				if(s[i]>='a' && s[i]<='z'){
					s[i] = (s[i]=='z')? 'a' : s[i] + 1;
				}
			}
			if( s.find( "the" ) != string::npos || s.find( "this" ) != string::npos || s.find( "that" ) != string::npos){
				cout << s << endl;
			}
		}
	}
	
	return 0;
}

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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T>
vector<T> make_v(size_t size, const T& init){ return vector<T>(size, init); }

template<class... Ts>
auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }



int main() {
    int h, w, k;
    cin >> h >> w >> k;
    auto dp = make_v(h+1, w, 0);
    dp[0][0] = 1;
    for (int i = 0; i < h; ++i) {
        for (int x = 0; x < (1 << (w-1)); ++x) {
            vector<int> v(w-1, 0);
            for (int j = 0; j < w-1; ++j) {
                if (x & (1<<j)) {
                    v[j] = 1;
                }
            }
            int z = 1;
            for (int j = 1; j < w-1; ++j) {
                if(v[j-1] && v[j]) z = 0;
            }
            vector<int> vv(w, 0);
            for (int l = 0; l < w; ++l) {
                vv[l] = l;
            }
            for (int j = 0; j < v.size(); ++j) {
                if(v[j]){
                    swap(vv[j], vv[j+1]);
                }
            }
            if(z){
                for (int j = 0; j < w; ++j) {
                    (dp[i+1][j] += dp[i][vv[j]]) %= MOD;
                }
            }
        }
    }
    cout << dp[h][k-1] << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-2;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int n; int c[100];
int main() {
	cin >> n;
	int a, b; cin >> a >> b;
	int sum; cin >> sum; int pra = a;
	int ans = sum/pra;
	rep(i, n) {
		cin >> c[i];
	}
	sort(c, c + n, greater<int>());
	rep(i, n) {
		pra += b; sum += c[i];
		ans = max(ans, sum / pra);
	}
	cout << ans << endl;
	//stop
	return 0;
}


Measured memory_bytes: 3084
n, m, l = map(int, input().split())
a = [[0 for i in range(m)] for j in range(n)] 
b = [[0 for i in range(l)] for j in range(m)]
c = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    ai = list(map(int,input().split()))
    for j in range(m):
        a[i] [j] = ai[j]
#print(a)

for i in range(m):
    ai = list(map(int,input().split()))
    for j in range(l):
        b[i] [j] = ai[j]
#print(b)


for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]
        #print(c[i][j], a[i][k], b[k][j])

for c in c:
    print(*c)


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

using namespace std;

typedef long long ll;


int main()
{
    int H, N;
    cin >> H >> N;
    vector< int > dp(H + 1, 1000000000);
    dp[0] = 0;

    while ( N-- )
    {
        int a, b;
        cin >> a >> b;

        for ( int i = 1; i <= H; ++i )
        {
            int candidato = dp[ max( 0, i - a ) ] + b;
            dp[i] = min( dp[i], candidato );
        }
    }

    cout << dp[H];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll H,W;
    cin >> H >> W;
    vector<ll> A(H), B(H), ans(H);
    rep(i,H){
        cin >> A[i] >> B[i];
        A[i]--;
    }
    map<ll,ll> s;
    multiset<ll> vals;
    rep(i,W){
        s[i] = i;
    }
    rep(i,W){
        vals.insert(0);
    }
    rep(i,H){
        ll l = A[i];
        ll r = B[i];
        auto itr = s.lower_bound(l);
        ll mr = -1;
        while(itr != s.end() && itr->first <= r){
            cmax(mr, itr->second);
            ll x = itr->first - itr->second;
            vals.erase(vals.find(x));
            s.erase(itr++);
            //itr++;
            //itr++;
        }
        if(mr != -1 && r < W){
            vals.insert(r-mr);
            s[r] = mr;
        }
        ans[i] = -1;
        if(vals.size() > 0){
            ans[i] = *vals.begin() + i + 1;
        }
    }
    rep(i,H){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 29924
#include<iostream>
#include<queue>

using namespace std;

int main(){
    int tmp,i;
    queue<int> q;
    while(1){
        cin >>tmp;
        if(tmp == 0)break;
        q.push(tmp);
    }
    i = 1;
    while(1){
        cout << "Case " << i << ": " << q.front() <<endl;
        i++;
        q.pop();
        if(q.empty() == 1)break;  
    }
}



Measured memory_bytes: 3136