akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;


int main() {

    int n;
    cin >> n;
    int d, x;
    cin >> d >> x;

    int ans = x;
    rep(i, n) {
        int a;
        cin >> a;
        int now = ((d - 1) / a) + 1;
        ans += now;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N, g[500][500];

int main() {
    cin >> N;
    for(int src = 0; src < N; ++src) {
        for(int dst = src + 1; dst < N; ++dst) {
            int bit = 0;
            while((src & (1<<bit)) == (dst & (1<<bit))) ++bit;
            g[src][dst] = bit;
        }
    }

    for(int i = 0; i < N; ++i) {
        for(int j = i + 1; j < N; ++j) {
            cout << g[i][j] + 1 << (j==N-1?'\n':' ');
        }
    }
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s; cin >> s;
	int p = 0;
	bool f = true;
	while (p < s.size())
	{
		if (s[p] == 'e')
		{
			if (p + 4 >= s.size() || s.substr(p, 5) != "erase")
			{
				f = false;
				break;
			}
			p += 5;
			if (p < s.size() && s[p] == 'r') p++;
		}
		else if (s[p] == 'd')
		{
			if (p + 4 >= s.size() || s.substr(p, 5) != "dream")
			{
				f = false;
				break;
			}
			p += 5;
			if (p == s.size() || s[p] != 'e') continue;
			if (p + 1 < s.size() && s[p + 1] == 'r')
			{
				if (p + 2 == s.size() || s[p+2] != 'a')
				{
					p += 2;
				}
			}
			else
			{
				f = false;
				break;
			}
		}
		else
		{
			f = false;
			break;
		}
	}
	cout << (f ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long

int num[200005];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,i,t,base=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>t;
        num[i]=t;
        base=base^t;
    }
    for(i=0;i<n;i++){
        cout << (base^num[i]) << " ";
    }
    cout << endl;
    return 0;
}

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

int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    int x=0;
    rep(i,n){
        if(x==1){
            cout<<i<<endl;
            return 0;
        }
        x=a[x];
    }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;
#define LL long long
#define pr(a,b) make_pair(a,b)
const int MAXN=20;
const long long INF=5e18;
int N;long long A[MAXN];
long long Solve(int L,int R,LL X,LL Y){
	if(L+1>=R)return 0;
	long long ret=INF;
	for(int i=L+1;i<=R-1;i++)
		ret=min(ret,Solve(L,i,X,X+Y)+Solve(i,R,X+Y,Y)+A[i]*(X+Y));
	return ret;
}
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
		scanf("%lld",&A[i]);
	printf("%lld\n",A[1]+A[N]+Solve(1,N,1,1));
}

Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    m=n//2
    a=list(map(int,readline().split()))

    s=sum(a)//2
    ans=[0]*n
    k=n-1
    t=0
    if n==3:
        for i in range(n):
            ans[k]=(s-a[i])*2
            k+=1
            k%=n
    else:
        for i in range(n):
            if i==0:
                tmp=i
                for j in range(m):
                    t+=a[i]
                    i+=2
                    i%=n
                nex=i
            else:
                t-=a[tmp]
                tmp+=2
                tmp%=n
                t+=a[nex]
                nex+=2
                nex%=n
            ans[k]=(s-t)*2
            k+=2
            k%=n

    print(*ans)

if __name__=="__main__":
    main()

Measured memory_bytes: 14196
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    int n,res;
    double p;
    while(scanf("%d",&n)==1)
    {
        res=0;
        for(int i=1;i<1000;i++)
        {
            for(int j=2;j<1000;j++)
            {
                p=pow(i,j);
                if(p>n)
                    break;
                else if(p==n)
                {
                    res=p;
                    break;
                }
                else if(p<n)
                {
                    if(p>res)
                        res=p;
                }
            }
        }
        printf("%d\n",res);
    }
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
import math

p = 0
for i in range(1, N+1):
    if i >= K:
        p += (1/N)
    else:
        n = math.ceil(math.log((K/i), 2))
        p += (1/N)*(1/2)**n
print(p)


Measured memory_bytes: 3064
// 14/06/19 // 8:03 PM //

#include <iostream>
#include <cmath>
#include <cstring>

using  namespace std;

#define  MAXN 100010
#define INF 2000000000

int n, k;
int h[MAXN];

int memo[MAXN];

int funcao(int i){
    if(memo[i]>=0) return memo[i];

    if(i>=n) return memo[i] = 0;

    memo[i] = INF;

    for(int j=1; j<=k; j++){
        if( (i+j)<=n )
            memo[i] = min(memo[i], abs(h[i]-h[i+j]) + funcao(i+j));
        else
            break;
    }

    return memo[i];
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    memset(memo, -1, sizeof(memo));

    cin >> n >> k;

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

    cout << funcao(1) << "\n";

    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int        long long
#define inf       ((ll)1e18)
#define double    long double
#define ull       unsigned long long
#define mod       1000000007
#define vi        vector<ll>
#define extreme   inline
#define ppi       pair<ll,pair<ll,ll>>
#define pb        push_back
#define mp        make_pair
#define pi        2*acos(0.0)
bool cust(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);} 
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define p(a)      cout<<a;
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"THIS_AND_THIS"<<endl;
#define str       string
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	str s;cin>>s;
	if(s.find("AC")!=std::string::npos){cout<<"Yes";}
	else{cout<<"No";}
}
int32_t main(){
	kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define endl '\n'
#define lose {printf("NO\n");return;}
#define win {printf("YES\n");return;}
#define all(A) (A).begin(),(A).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define PER(I, A, B) for (int I = (A); I >= (B); --I)
#define DB(A) cout<<(A)<<endl 
#define lson k*2
#define rson k*2+1
#define fi first
#define se second
#define PB push_back
#define Pair pair<int,int>
#define MP make_pair
#define LL long long
#define ull unsigned long long
#define int LL
using namespace std;
#define DB1(args...) do { cout << #args << " : "; dbg(args); } while (0)
void dbg() { std::cout << "  #\n"; }
template<typename T, typename...Args>
void dbg(T a, Args...args) { std::cout << a << ' '; dbg(args...); }
//var
const int maxn=4e6+10;
const int MAX=4e6;
const int inf=0x3f3f3f3f;   
const int mod=1e9+7;
//head
int n,m;
int a[maxn]; 

LL fac[maxn];
LL inv[maxn];
//LL facinv[maxn];
void fac_init()//reload fac, inv, facinv
{
    fac[0]=fac[1]=1;//both 0 1 initiate
    for (int i=1;i<=MAX;i++) fac[i]=(fac[i-1]*(i%mod))%mod;
    inv[0]=inv[1]=1;    
    for(int i=2;i<=MAX;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    
//	facinv[0]=facinv[1]=1;
//	for(int i=2;i<=MAX;i++) facinv[i]=inv[i];    
//  for(int i=2;i<=MAX;i++) facinv[i]=facinv[i]*facinv[i-1]%mod;
}
LL fpow(LL x, LL power, LL mod) 
{
    x %= mod;
    LL ans = 1;
    for (; power; power >>= 1, (x *= x) %= mod)
        if(power & 1) (ans *= x) %= mod;
    return ans;
}
LL qinv(LL a)
{
    LL x = fpow(a, mod - 2, mod);
    return x;
}
LL C(LL i,LL j)
{
	if (i<j) return 0;
	if (i<0||j<0) return 0;
//  return fac[i]*facinv[i-j]%mod*facinv[j]%mod;    
    return fac[i]*qinv(fac[i-j])%mod*qinv(fac[j])%mod;
}

int G(int row,int col)
{
	int ans=0;
	FOR(j,0,col)
	{
		ans+=C(j+row+1,row);
		ans%=mod;
	}
	return ans;
}

signed main()
{
	fac_init();
	int r1,c1,r2,c2;
	cin>>r1>>c1>>r2>>c2;
	int a1=G(r2,c2);
	int a2=G(r2,c1-1);
	int a3=G(r1-1,c2);
	int a4=G(r1-1,c1-1);
	int ans=(a1-a2-a3+a4);
	while (ans<mod) ans+=mod;
	ans%=mod;
	DB(ans);
}

Measured memory_bytes: 63744
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

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

int main() {
    string S;
    cin >> S;
    REP(i, S.size()-1) {
        if (S[i] == 'A' && S[i+1] == 'C') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

func nextStr(s *bufio.Scanner) string {
	s.Scan()
	ref := s.Bytes()
	cp := make([]byte, len(ref))
	copy(cp, ref)
	return string(cp)
}

func nextInt(s *bufio.Scanner) int {
	n, _ := strconv.Atoi(nextStr(s))
	return n
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	N := nextInt(s)
	m := make(map[string]int)
	for i := 0; i < N; i++ {
		key := nextStr(s)
		m[key]++
	}

	fmt.Printf("AC x %d\n", m["AC"])
	fmt.Printf("WA x %d\n", m["WA"])
	fmt.Printf("TLE x %d\n", m["TLE"])
	fmt.Printf("RE x %d\n", m["RE"])
}


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

string key[] = {"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};

int main(){
    int n;
    
    cin >> n;
    while(n--){
        string str,tmp = "";
        cin >> str;

        int cnt = 0 ,t = 0;
        string s = "";
        for(int i = 0 ; i < str.size() ; i++){
            if(str[i]=='0'){
                if(!cnt) continue;
                tmp += key[t][cnt-1];
                t = cnt = 0;
            }
            else{
                t = str[i]-'0';
                if((cnt>2)&&(t==2||t==3||t==4||t==5||t==6||t==8)) cnt -= 3;
                else if((cnt>3)&&(t==7||t==9)) cnt -= 4;
                else if((cnt>4)&&t==1) cnt -= 5;
                cnt++;
            }
        }
        cout << tmp << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1216
#include<stdio.h>
int main()
{
	int N, D;
	scanf("%d %d",&N, &D);
	int fanwei;
	fanwei = D*2+1;
	int i;
	for( i = 0; N>0; i++)
	{
		N = N-fanwei;
	}
	printf("%d",i);
}

Measured memory_bytes: 1700
def main():
    N, K = map(int, input().split())
    h = []
    for i in range(N):
        h.append(int(input()))
    h.sort()
    min = float('inf')
    for i in range(N - K + 1):
        if h[i + K - 1] - h[i]  < min:
            min =  h[i + K - 1] - h[i]
    print(min)
main()


Measured memory_bytes: 7384
var l = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n')[1].split(' ').map(a=>Number(a));
var c = 0;
for (var i = 0; i < l.length; i++) {
  var s = true;
  for (var k = 0; k < i; k++) {
    if (l[i] < l[k]) {
      s = false;
      break;
    }
  }
  if (s) c++;
}
console.log(c);


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int N; cin >> N; int P[N*N], now[N][N]={}, ans=0; bool flg[N][N]={};
REP(i, N*N){ cin >> P[i]; P[i]--; }
REP(i, N){ REP(j, N){ now[i][j]=min(min(i, j), min(N-1-i, N-1-j)); } }

REP(i, N*N){ 
  int x=P[i]/N, y=P[i]%N, n=now[x][y]; ans+=now[x][y]; flg[x][y]=true;
  vector< vector<int> > V={{x, y, 0}};
  for(int k=0; k<V.size(); k++){
  int a=V[k][0], b=V[k][1], c=V[k][2];
  if(a>0 && now[a-1][b]>n+c){ now[a-1][b]--; if(flg[a-1][b]){ V.push_back({a-1, b, c}); }else{ V.push_back({a-1, b, c+1}); } }
  if(b>0 && now[a][b-1]>n+c){ now[a][b-1]--; if(flg[a][b-1]){ V.push_back({a, b-1, c}); }else{ V.push_back({a, b-1, c+1}); } }
  if(a<N-1 && now[a+1][b]>n+c){ now[a+1][b]--; if(flg[a+1][b]){ V.push_back({a+1, b, c}); }else{ V.push_back({a+1, b, c+1}); } }
  if(b<N-1 && now[a][b+1]>n+c){ now[a][b+1]--; if(flg[a][b+1]){ V.push_back({a, b+1, c}); }else{ V.push_back({a, b+1, c+1}); } }
  }
}
cout << ans << "\n";
}


Measured memory_bytes: 18804
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
	string[] inputs = split(readln());
	int A = to!int(inputs[0]);
	int B = to!int(inputs[1]);
	int C = to!int(inputs[2]);
	int D = to!int(inputs[3]);
	max(A*B, C*D).writeln;
}


Measured memory_bytes: 256
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()
p = RI()

count = 0
for i in range(n):
    if p[i]==(i+1):
        if i==(n-1):
            p[0],p[i] = p[i],p[0]
        else:
            p[i+1],p[i] = p[i],p[i+1]
        count += 1
# print(p)
print(count)

Measured memory_bytes: 89956
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll to, cost;
	bool operator<(const edge& right) const {
		return cost == right.cost ? to < right.to : cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

string s[3];
ll index[3], cs;

int main() {
	repi(i, 0, 3) {
		rd(s[i]);
	}
	while (1) {
		if (index[cs] == s[cs].length()) {
			wrln((char)('A' + cs));
			return 0;
		}
		char next_char = s[cs][index[cs]];
		index[cs]++;
		cs = (ll)(next_char - 'a');
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define dr 1000000007

int main(){
  long n,k,d[200005],i,m=0,a;
  scanf("%ld",&n);
  scanf("%ld",&k);
  d[1]=n;
  a=1;
  for(i=1;i<=n;i++){
    d[i+1]=(d[i]+n-(i<<1))%dr;
  }
  for(i=k;i<=n+1;i++){
    m+=d[i]+1;
    m%=dr;
  }
  printf("%ld",(m+dr)%dr);
  return(0);
}

Measured memory_bytes: 3244
s=input()

#長さ2
#xx
#長さ3
#xxy←長さ2に内包,yxx,xyx
#長さ5:xyxzx　←長さ３に内包

if len(s)==2:
    if s[0]==s[1]:
        print(1,2)
        exit()

for i in range(len(s)-2):
    if s[i]==s[i+1]:
        print(i+1,i+1+1)
        exit()
    elif s[i]==s[i+2]:
        print(i+1,i+2+1)
        exit()

print(-1,-1)

    



Measured memory_bytes: 39792
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int main(){
  int a,b;cin>>a>>b;
  string s;cin>>s;
  rep(i,a){
    if(s[i] < '0' || s[i] > '9'){
      cout << "No" << endl;
      return 0;
    }
  }
  if(s[a] != '-'){
    cout << "No" << endl;
    return 0;
  }
  repd(i,a+1,a+b+1){
    if(s[i] < '0' || s[i] > '9'){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		int[][] a;
		int[] b;
		int[] r;
		int n, m;

		n = sc.nextInt();
		m = sc.nextInt();
		a = new int[n][m];
		b = new int[m];
		for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j) {
			a[i][j] = sc.nextInt();
		}
		for (int i = 0; i < m; ++i) {
			b[i] = sc.nextInt();
		}
		
		r = new int[n];
		for (int i = 0; i < n; ++i) {
			r[i] = 0;
			for (int j = 0; j < m; ++j) {
				r[i] += a[i][j] * b[j];
			}
		}
		
		for (int i = 0; i < n; ++i) {
			out.println(r[i]);
		}
				
		sc.close();
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

}

Measured memory_bytes: 40692
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

ll MOD = 1000000007;

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

    vector<ll> a(n);
    ll total = 0;
    rep(i, n) {
        cin >> a[i];
        total = (total + a[i]) % MOD;
    }

    ll ans = 0;
    rep(i, n) {
        total -= a[i];
        total += MOD;
        total %= MOD;
        ans += (a[i] * total) % MOD;
        ans %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4820
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

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

int main(void) {
  int n, y;
  cin>>n>>y;
  for(int i=0; i<=n; i++) {
    for(int j=0; j<=n-i; j++) {
      if(y==i*10000+j*5000+(n-(i+j))*1000) {
	std::cout << i<<" "<<j<<" "<<(n-(i+j)) << std::endl;
	return 0;
      }
    }
  }
  std::cout << -1 << " " << -1 << " " << -1 << std::endl;
  return 0;
}



Measured memory_bytes: 256
#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 int long long int
// #define ll int128_t
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
#if !defined(ONLINE_JUDGE)
#include "debugging.h"
#endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 1e5+5;
int const inf = 2e9;

void solve(){  
    int i,j;
    int n;
    cin>>n;
    set<string> s;
    for(i=0;i<n;i++){
        string x; cin>>x;
        s.insert(x);
    }
    int ans = s.size();
    cout<<ans<<endl;
}           

int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*

*/

Measured memory_bytes: 19252
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <list>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
long long gcd(long long a,long long b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
long long m,n, mn;
long long s[1266],ind,gd;
int main()
{
	while(cin>>n&&n)
	{
		m=(n+1)*n/2;
		double mn;
		ind=0;
		mn=1e100;
		for(int i=0;i<m;i++)
		{
			long long z;
			scanf("%lld",&z);
			if(z>(1LL<<62))while(1);
			if(z%2==0)
				s[ind++]=z;
			else mn=min(mn,z+0.0);
		}
		sort(s,s+ind);
		if(ind!=n)while(1);
		long long da=sqrt(s[0]*1.0*s[1]/mn)+0.5;

		cout<<da<<endl;
		//if(da==0)continue;
		for(int i=0;i<n;i++)
		{
			if(i)cout<<' ';
			cout<<s[i]/da;
		}cout<<endl;
	}
}

Measured memory_bytes: 1264
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int a , b , c;

int main(){
    cin >> a >> b >> c;
    swap(a , b);
    swap(a , c);
    cout << a << " " << b << " " << c << endl;
}


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

ll mod = 1e9 + 7;

int main() {
    int n; cin >> n;
    int ans = 0;
    for(int i=0; i<n; i++) {
        int x; cin >> x;
        if(i % 2 == 0 && x % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3588
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);

#ifdef BUGGY
	bool DEBUG = 1;
#endif
#ifndef BUGGY
	bool DEBUG = 0;
#endif



int main()
{
	int A, B;
	cin >> A >> B;
	string S;
	cin >> S;

	int limit = S.size();

	for(int i = 0; i < limit; i++) {
		if (i == A) {
			if(S[i] != '-') {
				printf("No\n");
				return 0;
			}
		} else {
			if (S[i] >= '0' && S[i] <= '9') {

			} else {
				printf("No\n");
				return 0;
			}
		}
	}

	printf("Yes\n");

	return 0;
}
/*
	Powered by Buggy Plugin
*/

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(void) {
	int a, b, c, d; cin >> a >> b >> c >> d;
	if (b < c) { cout << "0" << endl; }
	else { cout << max( 0,min(b, d) - max(c, a) ) << endl; }
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  string s;
  cin >> s;
  int r = s.size() - 1;
  int len = 1;
  int result = 0;
  for (;;) {
    for (char c = 'a'; c <= 'z'; ++c) {
      bool ok = true;
      for (int i = 0; i <= r; ++i) {
        bool found = false;
        for (int j = i; j < i + len; ++j) if (s[j] == c) found = true;
        if (!found) ok = false;
      }
      if (ok) {
        //cerr << len << " " << c << endl;
        cout << result << endl;
        return 0;
      }
    }

    result++;
    len++;
    r--;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int n,i,a,b,c;
  char s[100],t[100];
  scanf("%d",&n);
  while(n--){
    scanf("%s %s",s,t);
    for(i=0;s[i];i++){
      if(s[i]-t[i])break;
    }
    if(s[i]==0){
      printf("0\n");
      continue;
    }
    a=i;
    for(i=0;s[i];i++){
      if(s[i]=='1')b=i;
      if(t[i]=='1')c=i;
    }//printf("%d %d %d\n",a,b,c);
    if(b<a)a=b;
    if(c<a)a=c;
    printf("%d\n",b-a+c-a);
  }
  return 0;
}



Measured memory_bytes: 2140
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
  int N, M, C;
  cin >> N >> M >> C;

  vector<int> B(M);
  for (int i = 0; i < M; ++i) cin >> B[i];

  int count = 0;
  for (int i = 0; i < N; ++i)
  {
    int sum = 0;
    for (int j = 0; j < M; ++j)
    {
      int A;
      cin >> A;
      sum += A * B[j];
    }
    sum += C;
    if (sum > 0) ++count;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
N, M = [int(_) for _ in input().split()]
PYI = [[int(_) for _ in input().split()] + [i] for i in range(M)]
PYI.sort(key = lambda x: x[1])
P_count = [0 for _ in range(N + 1)]
Ans = ['' for _ in range(M)]
for i in range(M):
    P_count[PYI[i][0]] += 1
    Ans[PYI[i][2]] = str(PYI[i][0]).zfill(6) + str(P_count[PYI[i][0]]).zfill(6)
print('\n'.join(Ans))

Measured memory_bytes: 35220
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / __gcd(a, b) * b
#define range(a) (a).begin(),(a).end()
const int inf = 2147483647;

int main (){
    string S;cin >> S;
    cout << (S=="BBB"||S=="AAA" ? "No" : "Yes") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {


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

	int A, B; std::cin >> A >> B;


	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)std::cout << "Possible";
	else std::cout << "Impossible";


	return 0;


}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
if N == 2:
    print(1)
    exit()
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

pf = make_divisors(N)
ans = 0
for i in pf:
    if i == 1:
        continue
    n = N
    while n >= i:
        if n % i == 0:
            n //= i
        else:
            n %= i
    if n == 1:
        ans += 1

pf = prime_factorize(N-1)
p = list(Counter(pf).values())
z = 1
for i in p:
    z *= (i+1)
z -= 1
print(ans+z)




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

string s(int a,int b,int c,int d){
  int e;
  string f;
  string g;
  string h;
  for(int i=0;i<8;i++){
    e=a;
    if((i/4)%2==0){
      f="+";
      e+=b;
    }
    else{
      f="-";
      e-=b;
    }
    if((i/2)%2==0){
      g="+";
      e+=c;
    }
    else{
      g="-";
      e-=c;
    }
    if(i%2==0){
      h="+";
      e+=d;
    }
    else{
      h="-";
      e-=d;
    }
    if(e==7){
      return to_string(a)+f+to_string(b)+g+to_string(c)+h+to_string(d)+"=7";
    }
  }
}

int main() {
  vector<char> e(4);
  for(int i=0;i<4;i++){
    cin>>e.at(i);
  }
  int a=int(e.at(0)-'0');
  int b=int(e.at(1)-'0');
  int c=int(e.at(2)-'0');
  int d=int(e.at(3)-'0');
  string ans=s(a,b,c,d);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime

x = int(input())
p = primes(10**6)

while True:
    if p[x]:
        break
    else:
        x += 1
print(x)

Measured memory_bytes: 46832
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;
 
#define REP(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)(a); i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007
#define _SPLIT " "
 
template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T,class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<class T> void write(T a){cout << setprecision(24) << a << endl;}
template<class T,class ...Args> void write(T a, Args... args){cout << setprecision(24) << a << _SPLIT; write(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
template<class T> void warr(T begin, T end, const char* c = " "){cout << *begin;for(auto i = begin+1; i != end; i++)cout << c << *i;cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ll gcd(ll a, ll b){while(true){ll k = a % b;if(k == 0)return b;a = b;b = k;}}
ll comb(ll n, ll m){ll p=1;m=min(m,n-m);for(ll i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    bool f[100][100]={0};
    int w,h,n;
    read(w,h,n);
    rep(i,n){
        int x,y,a;
        read(x,y,a);
        if(a==1){
            rep(ya,h)rep(xa,x)f[ya][xa]=true;
        }
        if(a==2){
            rep(ya,h)REP(xa,x,w)f[ya][xa]=true;
        }
        if(a==3){
            rep(ya,y)rep(xa,w)f[ya][xa]=true;
        }
        if(a==4){
            REP(ya,y,h)rep(xa,w)f[ya][xa]=true;
        }
    }
    int res=0;
    rep(i,h){
        rep(j,w){
            if(!f[i][j])res++;
            //cout<<(int)f[i][j];
        }
        //cout<<endl;
    }
    write(res);
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

const int limit = 100010;
int r[limit];
int t[limit],p[limit];

int ans[limit];

int x,k;
int a = 0, b = 0, c = 0;

void action(int d){
	c += d;
	
	if(c < 0){
		a += -c;
		chmin(a,b);
		chmax(c,0);
	}

	if(c + b - a > x){
		b -= c + b - a - x;
		chmin(a,b);
		chmin(c,x);
	}
}

int calc(int pos){
	if(pos <= a) return c;
	if( b<= pos) return c + b - a;
	return c + pos - a;
}

int main(void){
	cin >> x >> k,b = x;

	k++;
	rep(i,1,k) cin >> r[i];
	const int inf = 1 << 30;
	r[k++]=inf;

	
	int q;
	cin >> q;
	rep(i,q) cin >> t[i] >> p[i];

	int prv = 0, idx = 0;
	rep(i,1,k){
		while(idx < q and t[idx]<=r[i]){	
			if(i%2==1){
				action(-t[idx]+prv);
				ans[idx] = calc(p[idx]);
			}else{
				action(t[idx]-prv);
				ans[idx] = calc(p[idx]);
			}
			prv = t[idx++];
		}

		if(i%2==1)
			action(-r[i]+prv);
		else
			action(r[i]-prv);
		prv = r[i];
	}


	rep(i,q) cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 2816
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll N, A, B, C, D;

bool solve() {
    ll L = B - A + (N-1) * C;
    ll R = B - A + (N-1) * D;
    ll a = C + D;
    for (ll k = max(0LL, L / a); k <= min(N-1, R / a + 1); k++) {
        if (L <= k * a && k * a <= R)
            return true;
    }
    return false;
}

void input() {
    cin >> N >> A >> B >> C >> D;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << (solve()?"YES":"NO") << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> data(N);
  for(int i = 0; i < N; i++){
  cin >>  data.at(i);
  }
  int count = 0;
  bool exist_odd = false;
 while(!exist_odd){
   for(int i = 0; i < N; i++){
     if(data.at(i) % 2 != 0){
       exist_odd = true;
       break;
     }
   }
     if(!exist_odd){
       for(int i = 0; i < N; i++){
       data.at(i) /= 2;
       }
        count++;
     }
   }
   cout << count << endl;
 
 }


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

void make_set(set<int>& water, int A, int B, int F, int mul) {
    int a = 0;
    while(1) {
        int aA = a * A;
        if (mul * aA > F) break;

        int b = 0;
        while(1) {
            int bB = b * B;
            if (mul * (aA + bB) > F) break;
            water.insert(aA + bB);
            b += 1;
        }

        a += 1;
    }
}

int main(void)
{
    cin.sync_with_stdio(false);
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    set<int> water;
    set<int> sugar;
    make_set(water, A, B, F, 100);
    make_set(sugar, C, D, F, 1);

    double mx = -1.0;
    int ans_ws = 0;
    int ans_s = 0;
    for (auto w : water) {
        for (auto s : sugar) {
            if (E * w - s >= 0
                && w != 0
                && 100 * w + s <= F
                ) {
                double val = (double)s / w;
                if (val > mx) {
                    ans_ws = 100 * w + s;
                    ans_s = s;
                    mx = val;
                }
            }
        }
    }
    cout << ans_ws << " " << ans_s << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

int n,a,b,c;
int l[8];

int solve(int aa,int bb,int cc,int now){
  if(now==n){
    if(aa!=0 && bb!=0 && cc!=0){
    return abs(a-aa)+abs(b-bb)+abs(c-cc)-30;
    }else return INF;
  }
  int x=solve(aa+l[now],bb,cc,now+1)+10;
  int y=solve(aa,bb+l[now],cc,now+1)+10;
  int z=solve(aa,bb,cc+l[now],now+1)+10;
  int num=solve(aa,bb,cc,now+1);
  return min(x,min(y,min(z,num)));
}
  

signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  cin>>n>>a>>b>>c;
  rep(i,n) cin>>l[i];
  cout<<solve(0,0,0,0)<<endl;
  

  return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
dp = [0 for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

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

int main(){
    using namespace std;
    unsigned long X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<unsigned long> A(X), B(Y), C(Z);
    for(auto& i : A)cin >> i;
    for(auto& i : B)cin >> i;
    for(auto& i : C)cin >> i;
    priority_queue<unsigned long, vector<unsigned long>, greater<>> AB{}, ABC{};
    {
        unsigned long cnt{0};
        for(const auto &i : A){
            for(const auto &j : B){
                AB.push(i + j);
                if(cnt == K){
                    AB.pop();
                    --cnt;
                }
                ++cnt;
            }
        }
    }
    {
        unsigned long cnt{0};
        vector<unsigned long> v;
        while(!AB.empty()){
            v.push_back(AB.top());
            AB.pop();
        }
        for(const auto &i : v){
            for(const auto &j : C){
                ABC.push(i + j);
                if(cnt == K){
                    ABC.pop();
                    --cnt;
                }
                ++cnt;
            }
        }
    }
    vector<unsigned long> v;
    while(!ABC.empty()){
        v.push_back(ABC.top());
        ABC.pop();
    }
    reverse(v.begin(), v.end());
    for(auto& i : v)cout << i << endl;
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

maxa = max(a)
index_max = a.index(maxa)

for i in range(0, n):
    if i == index_max:
        print(sorted(a)[-2])
    else:
        print(maxa)

Measured memory_bytes: 14168
#include<stdio.h>
#include<math.h>
struct   TPoint
{
         double x,y;
};
TPoint a[1005],d;
double r;

double   distance(TPoint   p1,   TPoint   p2)
{
          return (sqrt((p1.x-p2.x)*(p1.x -p2.x)+(p1.y-p2.y)*(p1.y-p2.y)));
}
double multiply(TPoint   p1,   TPoint   p2,   TPoint   p0)
{
          return   ((p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y));
}
void MiniDiscWith2Point(TPoint   p,TPoint   q,int   n)
{
d.x=(p.x+q.x)/2.0;
d.y=(p.y+q.y)/2.0;
r=distance(p,q)/2;
int k;
double c1,c2,t1,t2,t3;
for(k=1;k<=n;k++)
{
if(distance(d,a[k])<=r)continue;
if(multiply(p,q,a[k])!=0.0) ////不平行
{
   c1=(p.x*p.x+p.y*p.y-q.x*q.x-q.y*q.y)/2.0;
   c2=(p.x*p.x+p.y*p.y-a[k].x*a[k].x-a[k].y*a[k].y)/2.0;

   d.x=(c1*(p.y-a[k].y)-c2*(p.y-q.y))/((p.x-q.x)*(p.y-a[k].y)-(p.x-a[k].x)*(p.y-q.y));
   d.y=(c1*(p.x-a[k].x)-c2*(p.x-q.x))/((p.y-q.y)*(p.x-a[k].x)-(p.y-a[k].y)*(p.x-q.x));
   r=distance(d,a[k]);
}
else        //平行
{
    t1=distance(p,q);
    t2=distance(q,a[k]);
    t3=distance(p,a[k]);
    if(t1>=t2&&t1>=t3)
    {d.x=(p.x+q.x)/2.0;d.y=(p.y+q.y)/2.0;r=distance(p,q)/2.0;}
    else if(t2>=t1&&t2>=t3)
    {d.x=(a[k].x+q.x)/2.0;d.y=(a[k].y+q.y)/2.0;r=distance(a[k],q)/2.0;}
    else
    {d.x=(a[k].x+p.x)/2.0;d.y=(a[k].y+p.y)/2.0;r=distance(a[k],p)/2.0;}
}
}

}
void MiniDiscWithPoint(TPoint   pi,int   n)
{
d.x=(pi.x+a[1].x)/2.0;
d.y=(pi.y+a[1].y)/2.0;
r=distance(pi,a[1])/2.0;
int j;
for(j=2;j<=n;j++)
{
if(distance(d,a[j])<=r)continue;
else
{
   MiniDiscWith2Point(pi,a[j],j-1);
}
}

}

int main()
{
int i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
   scanf("%lf %lf",&a[i].x,&a[i].y);
}
if(n==1)
{ printf("0.00\n");return 0;}
r=distance(a[1],a[2])/2.0;
d.x=(a[1].x+a[2].x)/2.0;
d.y=(a[1].y+a[2].y)/2.0;
for(i=3;i<=n;i++)
{
   if(distance(d,a[i])<=r)continue;
   else
    MiniDiscWithPoint(a[i],i-1);
}
printf("%.6lf\n",r);
return 0;
}


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

int main(){
  ll n,i,d=0,mind;
  cin >> n;
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a.at(i);
    d += a.at(i);
  }
  d -= a.at(0)*2;
  mind=abs(d);
  for(i=1;i<n-1;i++){
    d -= a.at(i)*2;
    mind=min(mind,abs(d));
  }
  cout << mind << endl;
}

Measured memory_bytes: 4780
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

// デフォルト変数定義
int n,m,a,b,c,d,x,y,z;
string s,t,u;
//

signed main() {
  RAPID;
  IN3(s,t,u);
  OUT(toStrUp(gCh(s,0) + gCh(t,0) + gCh(u,0)));
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }.toMutableList()

    a.sorted()
    var count = 0
    var k = 1
    loop@ do {
        k *= 2
        for (i in 0..(n - 1)) {
            if (a[i] % 2 == 1) {
                break@loop
            }
            a[i] /= 2
        }
        count++
    } while (k < Int.MAX_VALUE)
    println(count)
}

Measured memory_bytes: 37872
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	String str=sc.next();
    char[] c=str.toCharArray();
    if(c[2]==c[3]&&c[4]==c[5]){
      System.out.print("Yes");
    }else{
      System.out.print("No");
    }
  }
}

Measured memory_bytes: 21844
import sys,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()
print(50)
a = [49 - i + n//50 for i in range(50)]

if n%(50) == 0:
    print(jo(a))
else:
    for i in range(50):
        if n%(50) >= i+1:
            a[i] += 1
        
    print(jo(a))


Measured memory_bytes: 3188
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
for i, a in enumerate(A):
    if a > i:
        break
    if i == 0:
        continue
    if a == A[i-1]+1:
        ans += 1
    elif a <= A[i-1]:
        ans += a
    else:
        break
else:
    print(ans)
    exit()
print(-1)


Measured memory_bytes: 50268