akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int A, B, M, a[101010], b[101010];

int main(){
  cin >> A >> B >> M;
  rep(i, A) cin >> a[i + 1];
  rep(i, B) cin >> b[i + 1];
  int reizo = 1e9, renji = 1e9;
  rep(i, A) reizo = min(reizo, a[i + 1]);
  rep(i, B) renji = min(renji, b[i + 1]);
  int res = reizo + renji;
  rep(i, M){
    int x, y, c;
    cin >> x >> y >> c;
    int kakaku = max(a[x] + b[y] - c, 0);
    res = min(res, kakaku);
  }
  cout << res << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        int sum = 0;
        for (int i = 1; i < N; i++) {
            sum += i;
        }
        for (int i = 1; i < M; i++) {
            sum += i;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 23764
#include<cstdio>
int main(){
	int a,b,c,d,i,j,k,l;
	while(~scanf("%d%d%d%d",&a,&b,&c,&d))
	{
		if(a==1)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==2)
		{
			if(b==28)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==3)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==4)
		{
			if(b==30)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==5)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==6)
		{
			if(b==30)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==7)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==8)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==9)
		{
			if(b==30)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==10)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==11)
		{
			if(b==30)
			printf("1\n");
			else
			printf("0\n");
		}
		if(a==12)
		{
			if(b==31)
			printf("1\n");
			else
			printf("0\n");
		}
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int,int> ps;
typedef pair<int,ps> P;
main(){
  int n,m,l; 
  priority_queue<P,vector<P>,greater<P> > que,sque;
  long long jobs[10005]={0};
  cin>>n>>m;
  int a,b,c;
  while(1){
    cin>>a>>b>>c;
    if(a==0&&b==0&&c==0) break;
    P p;
    p.F=b;
    p.S.F=a;
    p.S.S=c;
    que.push(p);
  }
  cin>>l;
  for(int i=0;i<l;i++){
    memset(jobs,0,sizeof(jobs));
    int money;
    for(int j=1;j<=m;j++){
      cin>>money;
      while(!que.empty()&&que.top().F==j){
	jobs[que.top().S.F]+=money*que.top().S.S;
	sque.push(que.top());
	que.pop();
      }
    }
    for(int j=1;j<n;j++){
      cout<<jobs[j]<<" ";
    }
    cout<<jobs[n]<<endl;
    while(!sque.empty()){
      que.push(sque.top());
      sque.pop();
    }
  }
}

Measured memory_bytes: 2788
h,w= map(int, input().split())
S = []
t = ["."]*(w+2)
S.append(t)
for i in range(h):
    tmp = ["."]+list(input())+["."]
    S.append(tmp)
S.append(t)

for y in range(1,h+1):
    for x in range(1,w+1):
        if S[y][x] == "#":
            if S[y-1][x] == "." and S[y+1][x] == "." and S[y][x+1] == "." and S[y][x-1] == ".":
                print("No")
                exit()
print("Yes")

Measured memory_bytes: 9192
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m;cin>>n>>m;
    ll dp[1100][5000];
    vector<ll>c(m,0);
    for(int i=0;i<1100;i++)
        for(int j=0;j<5000;j++)
            dp[i][j]=INF;
    dp[0][0]=0;
    vector<ll>a(m),b(m);
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        for(int j=0;j<b[i];j++){
            ll t;cin>>t;t--;
            c[i]+=(1<<t);
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<(1<<n);j++){
            chmin(dp[i+1][j],dp[i][j]);
            chmin(dp[i+1][j|c[i]],dp[i][j]+a[i]);
        }
    }
    cout<<(dp[m][(1<<n)-1]<INF?dp[m][(1<<n)-1]:-1)<<endl;
    
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

using namespace std;

struct st{
    int d,x,y;
};

int n,m;
char arr[30][30];

bool vis[30][30];

int vx[] = {1,-1,0,0};
int vy[] = {0,0,1,-1};
//int dis[30][30];

int bfs(int x,int y){
    int ret = 0;
    queue<st> q;
    st s ;
    s.x = x; s.y = y; s.d = 0;
    q.push(s);
    vis[x][y] = 1;
    while(!q.empty()){
        st temp  = q.front();
        ret = max(ret,temp.d);
        q.pop();
        for(int i = 0; i  < 4; i++){
            if(temp.x+vx[i] < n && temp.y + vy[i] < m && temp.x+vx[i] >=0 && temp.y + vy[i] >=0 && !vis[temp.x+vx[i]][temp.y+vy[i]] && arr[temp.x+vx[i]][temp.y+vy[i]] != '#'){
                st pu = temp;
                pu.x += vx[i]; pu.y += vy[i]; pu.d++;
                q.push(pu);
                vis[pu.x][pu.y] = 1;
            }
        }
    }
    return ret;
}


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

    for(int i = 0; i < n; i++){
        string bla;
        cin >> bla;
        for(int j = 0; j < m; j++){
            arr[i][j] = bla[j];
        }
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(arr[i][j] == '.'){
                memset(vis,0,sizeof vis);
                ans = max(ans,bfs(i,j));
            }
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

int n, x[111][3], h, y=-1;

main(){
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d%d%d", &x[i][0], &x[i][1], &x[i][2]);
        if(y<0 && x[i][2]>0)y = i;
    }
    for(int cx = 0; cx<101; cx++){
        for(int cy = 0; cy<101; cy++){
            bool flag = true;
            h = x[y][2] + abs(cx-x[y][0]) + abs(cy-x[y][1]);
            for(int i=0; i<n; i++){
                if(x[i][2] != max(0, h - abs(x[i][0]-cx) - abs(x[i][1]-cy))){
                    flag = false;
                    break;
                }
            }
            if(flag){
                printf("%d %d %d\n", cx, cy, h);
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/python3

M = 998244353

n = int(input())
r = []
for i in range(n):
    (x, d) = map(int, input().split())
    r.append((x, x + d))

r.sort()
cls = []
dp = [0 for i in range(n + 1)]
dp[n] = 1
for i in range(n - 1, -1, -1):
    ne = i + 1
    #merge cluster
    while cls:
        (ci, cne) = cls[-1]
        if r[ci][0] < r[i][1]:
            cls.pop()
            ne = cne
        else:
            break;
    cls.append((i, ne))
        
    dp[i] = (dp[i + 1] + dp[ne]) % M

print(dp[0])


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

using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
#define PI 3 .14159265

//typedef tuple <int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

#define siz(x) (int)(x).size()
#define Y second
#define X first
#define IN insert
#define PB push_back
#define P pop_back
#define PU push
#define PO pop
//#define F find
#define ED end()
#define MP(a,b) make_pair( a, b )

#define MOD 1000000007LL
#define INF 1000000000
#define rep(a,i,b) for (ll i = (a); i < (b); ++i)
#define reps(a,i,b) for (ll i = (a); i <= (b); ++i)
#define repd( num, i, ed ) for(ll (i)= (num)-1; (i) >= e38d; --(i))
#define repkt( bg, i, num, kt ) for(ll (i)= (bg); (i) < (num) && (kt); ++(i))
#define repchar( i ) for(char (i)= 48; (i) <= 122; (i)++)   
#define in(n) scanf("%lld", &n)
#define out(n) printf("%lld\n", n)
#define outS(s) printf("%s\n", s)
#define setA(a,n) for(ll i= 0, j= sizeof(a)/sizeof(a[0]); i < j; ++i) a[i]= n;
#define repe(num,i,ed) for(ll (i)= (num); (i) >= ed; --(i))
#define endl "\n"
const int mod =1e9+7;
int h[100005];
int n;
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    cin>>n;
    for(int i=0;i<n;++i) cin>>h[i];
    vector<int> dp(n,1000000005);
    dp[0]=0;
    for(int i=0;i<n;++i)
    {
        for(int j:{i+1,i+2})
        {
            if(j<n) dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int gcd(int, int);

int main(void)
{
    int x, y, a;
    scanf("%d %d", &x, &y);
    a=gcd(x,y);
    printf("%d\n", a);
    return 0;
}

gcd(int x, int y)
{
    int z;
    while((z=x%y)!=0)
    {
        x=y;
        y=z;
    }
    return y;
}


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

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    --n;
    vector<vector<int>> vecs(n, vector<int>(3));
    rep(i, n)
    {
        cin >> vecs[i][0] >> vecs[i][1] >> vecs[i][2];
    }
    for (int i = 0; i < n; i++)
    {
        int now = vecs[i][1] + vecs[i][0];
        for (int j = i + 1; j < n; j++)
        {
            int c = vecs[j][0], s = vecs[j][1], f = vecs[j][2];
            now = max(s, ((now + f - 1) / f) * f); // 発車時間
            now += c;
        }
        cout << now << endl;
    }
    cout << 0 << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    ret = [0,0,0,0]
    N = int(input())
    for i in range(N):
        s = input()
        if s == 'AC': ret[0]+=1
        elif s == 'WA': ret[1]+=1
        elif s == 'TLE': ret[2]+=1
        else: ret[3]+=1
    print(f'AC x {ret[0]}')
    print(f'WA x {ret[1]}')
    print(f'TLE x {ret[2]}')
    print(f'RE x {ret[3]}')
if __name__ == "__main__":
    run()

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[101010],B[101010];
pair<int,int> P[202020];
int ok[101010][2];
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i]>>B[i];
		P[i]={A[i],i};
		P[i+N]={B[i],i+N};
	}
	sort(P,P+2*N);
	FOR(i,N) {
		if(P[i].second<N) ok[P[i].second][0]=1;
		else ok[P[i].second-N][1]=1;
	}
	
	int sok[2]={};
	ll sum=0;
	int both=0;
	FOR(i,N) {
		if(ok[i][0]) sum+=A[i],sok[0]++;
		if(ok[i][1]) sum+=B[i],sok[1]++;
		if(ok[i][0]&&ok[i][1]) both=1;
	}
	
	if(both==0 && sok[0] && sok[1]) {
		vector<pair<int,int>> C[2];
		multiset<int> D[2];
		int best=1<<30;
		FOR(i,N) {
			if(ok[i][0]) {
				C[0].push_back({A[i],B[i]});
				D[0].insert(B[i]);
			}
			else {
				C[1].push_back({B[i],A[i]});
				D[1].insert(A[i]);
			}
		}
		FOR(i,2) {
			if(C[i].size()>1) {
				FORR(c,C[i]) {
					x=c.second;
					D[i].erase(D[i].find(x));
					c.second=*D[i].begin();
					D[i].insert(x);
				}
			}
			sort(ALL(C[i]));
		}
		
		FOR(i,2) {
			int L,R=0;
			int SM=1<<30;
			FOR(L,C[0].size()) {
				while(R<C[1].size() && C[1][R].first<=C[0][L].first) {
					SM=min(SM,C[1][R].second);
					R++;
				}
				best=min(best,min(SM,C[0][L].second)-C[0][L].first);
			}
			swap(C[0],C[1]);
		}
		
		sum+=best;
	}
	
	
	cout<<sum<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

template<int MAXN>
struct segtree_lazy {

	struct updater {
		/* DATA MEMBERS */
		ll x;

		updater(ll x = 1e18) : x(x) {}

		updater& operator+= (const updater& other) {
			/* ADDITION */
			x = min(x, other.x);
			return *this;
		}

		operator bool () const {
			/* BOOL CAST */
			return x != 1e18;
		}
	};
	
	struct node_t {
		/* DATA MEMBERS */
		ll x;

		/* CONSTRUCTOR */
		node_t(ll x = 1e18) : x(x) {}

		node_t& operator+= (const node_t& other) {
			/* ADDITION */
			x = min(x, other.x);
			return *this;
		}

		node_t& operator+= (const updater& other) {
			/* UPDATE ADDITION */
			x = min(x, other.x);
			return *this;
		}

		node_t operator+ (const node_t& other) const {
			node_t tmp = *this;
			tmp += other;
			return tmp;
		}
	};

	node_t a[2*MAXN];
	updater b[2*MAXN];

	void init() {
		for (int i=1; i<=MAXN; i++) {
			/* KOPIRAJ NEKI EKSTERNI NIZ OVDE */
			a[i + MAXN - 1] = node_t();
		}
		for (int i=MAXN-1; i>0; i--) {
			a[i] = a[2*i] + a[2*i+1];
		}
	}

	void push(int i) {
		if (b[i]) {
			a[i] += b[i];
			if (i < MAXN) {
				b[2*i] += b[i];
				b[2*i+1] += b[i];
			}
			b[i] = updater();
		}
	}

	node_t get(int l, int r, int node=1, int nl=1, int nr=MAXN) {
		push(node);

		if (r < nl || nr < l) {
			return node_t();
		}
		if (l <= nl && nr <= r) {
			return a[node];
		}

		int nm = (nl + nr) >> 1;
		return get(l, r, 2*node, nl, nm) + get(l, r, 2*node+1, nm+1, nr);
	}

	void update(int l, int r, updater val, int node=1, int nl=1, int nr=MAXN) {
		push(node);

		if (r < nl || nr < l) {
			return;
		}
		if (l <= nl && nr <= r) {
			b[node] += val;
			push(node);
			return;
		}

		int nm = (nl + nr) >> 1;
		update(l, r, val, 2*node, nl, nm);
		update(l, r, val, 2*node+1, nm+1, nr);
		a[node] = a[2*node] + a[2*node+1];
	}
};

segtree_lazy<131072> drvo;

int n, m;
vector<pair<int, int>> r[100005];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

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

	drvo.update(1, 1, 0);
	for (int i=1; i<n; i++) {
		ll v = drvo.get(i, i).x;
		for (auto p : r[i]) {
			auto b = p.first;
			auto x = p.second;
			drvo.update(i+1, b, v+x);
		}
	}

	ll z = drvo.get(n, n).x;
	if (z > 1e17)
		z = -1;
	cout << z << '\n';
}

Measured memory_bytes: 9728
#include <stdio.h>

int distribute(int board[8][8], int *v, int *h, int *s, int *d, int n);

int main(int argc, char *argv[])
{
  int board[8][8];
  int k, r, c, i, j;
  int vertical[8];
  int horizontal[8];
  int sum[15];
  int diff[15];

  scanf("%d", &k);

  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) board[i][j] = 0;
    vertical[i] = 0;
    horizontal[i] = 0;
  }

  for (i = 0; i < 15; i++) {
    sum[i] = 0;
    diff[i] = 0;
  }
  
  for (i = 0; i < k; i++) {
    scanf("%d", &r);
    scanf("%d", &c);

    board[r][c] = 1;
    horizontal[r] = 1;
    vertical[c] = 1;
    sum[r+c] = 1;
    diff[r-c+7] = 1;
  }

  distribute(board, vertical, horizontal, sum, diff, 8 - k);

  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (board[i][j] == 0) printf(".");
      else printf("Q");
    }
    printf("\n");
  }

  return 0;
}

int distribute(int board[8][8], int *v, int *h, int *s, int *d, int n)
{
  int r, c;
  int res;

  if (n == 0) return 1;

  for (r = 0; r < 8; r++) {
    if (h[r] == 0) {
      for (c = 0; c < 8; c++) {
	if (v[c] == 0) {
	  if (s[r+c] == 0 && d[r-c+7] == 0) {
	    board[r][c] = 1;
	    h[r] = 1;
	    v[c] = 1;
	    s[r+c] = 1;
	    d[r-c+7] = 1;
	    res = distribute(board, v, h, s, d, n - 1);
	    if (res == 1) return 1;
	    else {
	      board[r][c] = 0;
	      h[r] = 0;
	      v[c] = 0;
	      s[r+c] = 0;
	      d[r-c+7] = 0;
	    }
	  }
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

ll MOD=1000000007;

// a^n mod を計算する
//ただしmとaが互いにその時のみ
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    string S;
    cin >> S;
    ll N=S.size();
    ll def=0;
    deque<ll> list;
    for(ll i=0;i<N;i++){
        if(S[i]!='?'){
            ll c=S[i]-'0';
            def+=modpow(10,N-i-1,13)*c;
            def%=13;
        }
        else {
            list.emplace_back(modpow(10,N-i-1,13));
        }
    ;}
    ll siz=list.size();
    vector<vector<ll>> dp(siz+1, vector<ll>(13, 0));
    dp[0][def]=1;
    for(ll i=1;i<=siz;i++){
        for(ll j=0;j<10;j++){
            for(ll k=0;k<13;k++){
                dp[i][(k+(j*list[i-1]))%13]+=dp[i-1][k];
                dp[i][(k+(j*list[i-1]))%13]%=MOD;
            }
        ;}
    ;}
    cout<<dp[siz][5]<<endl;
return 0;
}


Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,ma=-1,mi=1001;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    ma=max(a,ma);
    mi=min(a,mi);
  }
  cout<<ma-mi;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

int main(){
  int N, Q;
  std::string S;
  scanf("%d",&N);
  scanf("%d",&Q);
  std::cin >> S;
  std::vector<int > l(N), r(N);
  for (int i=0; i<Q; i++){
    scanf("%d",&l[i]);
    scanf("%d",&r[i]);
    l[i]--;
    r[i]--;
  }
  std::vector<int > cumsum(N);
  cumsum[0]=0;
  for (int i=1; i<N; i++){
    cumsum[i]=cumsum[i-1] + (((S[i]=='C') && (S[i-1]=='A'))?1:0);
  }
  for (int i=0; i<Q; i++){
    printf("%d\n",cumsum[r[i]]-cumsum[l[i]]);
  }
  return 0;
}


Measured memory_bytes: 2240
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)  cin>>a[i];
    for(int i=n-1; i>0; i--)   cout<<a[i]<<" ";
    cout<<a[0]<<endl;
    return 0;
}


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

int main(void)
{
  long long result = 1;
  int n;
  cin >> n;
  int* warriors = new int[n];
  for (int i = 0; i < n; ++i)
  {
    cin >> warriors[i];
  }
  sort(warriors, warriors + n, greater<int>());
  for (int i = 0; i < n; ++i)
  {
    result += warriors[i] - i/4 > 0 ? warriors[i] - i/4 : 0;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1200
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
vector<int> a[N];

int64 F[N], G[N], A[N];

int64 comb(int n, int m) {
  if (n < m) return 0;
  return (int64)F[n] * G[m] % MOD * G[n - m] % MOD;
}

void init(int n) {
  A[1] = 1;
  for (int i = 2; i < n; ++i) {
    A[i] = (MOD - MOD / i) * (int64)A[MOD % i] % MOD;
  }
  F[0] = G[0] = 1;
  for (int i = 1; i < n; ++i) {
    F[i] = (int64)F[i - 1] * i % MOD;
    G[i] = (int64)G[i - 1] * A[i] % MOD;
  }
}

int m;
int64 DFS(int u, int parent) {
  int64 ret = 1;
  int cnt = 0;
  for (auto& v : a[u]) {
    if (v == parent) continue;
    ret = ret * DFS(v, u) % MOD;
    ++cnt;
  }
  int all = (u == 0 ? m - 1 : m - 2);
  ret = ret * comb(all, cnt) % MOD;
  ret = ret * F[cnt] % MOD;
  return ret;
}

int main() {
  init(N);
  int n;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  int64 ret = DFS(0, -1);
  ret = ret * m % MOD;
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 12808
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

long double A, B;
long long res;

void load(void);
void calc(void);
void output(void);

int main(){
	load();
	calc();
	output();
	return 0;
}

void load(void){
	cin >> A >> B;
}

void calc(void){
	res = (long long)(A * B);
}

void output(void){
	cout << res;
}

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

int main() {
  int A, B;
  char op;
  
 cin >> A >> op >> B ;
 
   if (op == '+'){
     cout << A + B <<endl;
   }
  else if(op == '-'){
    
  cout << A - B << endl;
  }      
}

  
  
  
  


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String[] item = {s.substring(0, 1), s.substring(0, 1), s.substring(1)};
    ArrayList<String[]> q = new ArrayList<String[]>();
    q.add(item);
    while (true) {
      String[] t = q.remove(q.size() - 1);
      int sum = Integer.parseInt(t[0]);
      String f = t[1];
      String ss = t[2];
      if (ss.length() > 0) {
        int l = Integer.parseInt(ss.substring(0, 1) + "");
        String[] i = {String.valueOf(sum + l), String.format("%s+%s", f, l), ss.substring(1)};
        String[] ii = {String.valueOf(sum - l), String.format("%s-%s", f, l), ss.substring(1)};
        q.add(i);
        q.add(ii);
      } else {
        if (sum == 7) {
          System.out.println(String.format("%s=7", f));
          break;
        }
      }
    }
  }
}


Measured memory_bytes: 21844
#include"bits/stdc++.h"
using namespace std;
int main(){
	string s; cin >> s;
    string copy = s;
  	reverse(copy.begin(),copy.end());
	int res = 0;
  	for (int i = 0 ; i < s.size() ; i++) {
    	res += (s[i] != copy[i]);
    }
  	cout << res/2 << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	char x, y;
	cin >> x >> y;
	if (x > y)
		cout << ">" << "\n";
	else if (x < y)
		cout << "<" << "\n";
	else
		cout << "=" << "\n";
}

Measured memory_bytes: 3640
N,C = map(int, input().split())
Dij = []
for i in range(C):
    Dij.append(list(map(int, input().split())))
cij = []
for i in range(N):
    cij.append(list(map(int, input().split())))
# 同じ色にしたいグリッドのまとめ
C1 = []
C2 = []
C3 = []
for i in range(N):
    for j in range(N):
        if (i+j)%3 == 0:
            C1.append(cij[i][j])
        if (i+j)%3 == 1:
            C2.append(cij[i][j])
        if (i+j)%3 == 2:
            C3.append(cij[i][j])

"""
3色で塗る
"""
cost_c1 = []
cost_c2 = []
cost_c3 = []
for Y in range(C):
    #1
    cost = 0
    for X in C1:
        cost += Dij[X-1][Y]
        # print(X-1,"->",Y,":",Dij[X-1][Y])
    cost_c1.append(cost)
    #2
    cost = 0
    for X in C2:
        cost += Dij[X-1][Y]
        # print(X-1,"->",Y,":",Dij[X-1][Y])
    cost_c2.append(cost)
    #3
    cost = 0
    for X in C3:
        cost += Dij[X-1][Y]
        # print(X-1,"->",Y,":",Dij[X-1][Y])    
    cost_c3.append(cost)

#1->2->3

minA = 0

ans = float("inf")
for i,c1 in enumerate(cost_c1):
    for j,c2 in enumerate(cost_c2):
        for k,c3 in enumerate(cost_c3):
            if i!=j and j!=k and k!=i:
                ans = min(ans,c1+c2+c3) 
print(ans)

Measured memory_bytes: 7696
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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 complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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 long long

int n, t;
int a[3030], b[3030];
pair<int, int> x[3030];
int dp[3030][7060][2];

void solve() {
	cin >> n >> t;
    rep(i, n) {
        cin >> a[i] >> b[i];
        x[i] = make_pair(a[i], b[i]);
    }
    sort(x, x + n);
    //reverse(x, x + n);
    rep(i, n + 1) {
        rep(j, 7060) {
            dp[i][j][0] = 0;
            dp[i][j][1] = 0;
        }
    }
    rep(i, n) {
        //dp[i + 1][0][1] = max(dp[i][0][1], dp[i][0][0] + x[i].sc);
        for(int j = 0; j <=t + 3010; j ++) {
            //dp[i + 1][j][1] = max(dp[i][j][1], dp[i][j][0] + x[i].sc);
            if(j < x[i].fr) {
                dp[i + 1][j][1] = dp[i][j][1];
              dp[i + 1][j][0] = dp[i][j][0];
            } else {
                dp[i + 1][j][1] = max(dp[i][j][1], dp[i][j - x[i].fr][1] + x[i].sc);
              dp[i + 1][j][0] = max(dp[i][j][0], dp[i][j - x[i].fr][0] + x[i].sc);
            }
          dp[i + 1][j][1] = max(dp[i][j][1], dp[i][j][0] + x[i].sc);
        }
    }
    int res = dp[n][t - 1][1];
    for(int j = 0; j <= t - 1; ++j) {
        res = max(res, dp[n][j][1]);
    }
  for(int j = 0; j <= t; ++j) {
    res = max(res, dp[n][j][0]);
  }
    cout << res << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


Measured memory_bytes: 332160
N = int(input())
flag = 0
state = 0
dic = {}
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        state += 1
    else:
        state = 0
    if state >= 3:
        flag = 1

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9044
N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for _ in range(N+1)]
for i in range(N):
    B[i+1] = (B[i]+A[i])%M
C = {}
for i in range(N+1):
    b = B[i]
    if b not in C:
        C[b] = 0
    C[b] += 1
cnt = 0
for b in C:
    k = C[b]
    cnt += (k*(k-1))//2
print(cnt)

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

int main() {
    long long n, m;
    cin >> n >> m;
    if (n > m)
        swap(n, m);
    long long ans = 0;
    if (n == 1) {
        if (m == 1) {
            ans = 1;
        } else {
            ans = m - 2;
        }
    } else if (n == 2) {
        ans = 0;
    } else {
        ans = (n - 2) * (m - 2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
const string tr="abcdefghijklmnopqrstuvwxyz";
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}
bool ip/*is_prime*/(long long N) {if (N == 1) return false;for (long long i = 2; i * i <= N; ++i) {if (N % i == 0) return false;}return true;}
int digit(ll N) {int ans = 0;while (N) {++ans;N /= 10;}return ans;}
vector<pair<ll,ll>> pf/*prime_factorize*/(ll n){vector<pair<ll,ll>> res;for(ll a=2;a*a<=n;a++){if(n%a!=0) continue;ll ex=0;while(n%a==0){ex++;n/=a;}res.pb({a,ex});}if(n!=1) res.pb({n,1});return res;}
vector<ll> div/*divisor*/(ll n){  vector<ll> res={1};for(ll a=2;a*a<=n;a++){if(n%a!=0) continue;ll b=n/a;res.pb(b);if(b!=a) res.pb(a);}sort(all(res));return res;}

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  while(b<=a){
    b*=2;
    k--;
  }
  while(c<=b){
    c*=2;
    k--;
  }
  if(k>=0) yn;
}


Measured memory_bytes: 3620
n = int(input())
x = list(map(int,input().split()))
x_sort = sorted(x)
mid = int((x_sort[n//2-1]+x_sort[n//2])/2)
for i in x:
  if i > mid:
    print(x_sort[(n-1)//2])
  else:
    print(x_sort[(n-1)//2+1])

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

int f(int i, int k) {
  int ans = 0;
  while (k > i) {
    i *= 2;
    ++ans;
  }
  return ans;
}

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

  double N, K;
  cin >> N >> K;
  double p1 = 1 / N;
  double ans = 0.0;
  REPI(i, 1, N + 1) { ans += p1 * pow(0.5, f(i, K)); }

  cout << setprecision(9) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import deque
n,m=map(int,input().split())
neighbor=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  neighbor[a].append(b)
  neighbor[b].append(a)
def bfs(start,arrcnt):
  queue=deque([start])
  d=[None]*arrcnt
  d[start]=0
  while queue:
    l=queue.popleft()
    for i in neighbor[l]:
      if d[i]==None:
        d[i]=l+1
        queue.append(i)
  return d
d=bfs(0,n)
if None in d:
  print("No")
else:
  print("Yes")
  for i in range(1,n):
    print(d[i])

Measured memory_bytes: 36900
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#define ll long long
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int l=a,r=b;
	if(b<=c){
		cout<<0<<endl;
	}else if(d<=a){
		cout<<0<<endl;
	}else{
		if(a<=c){
			l=c;
		}
		if(d<=b){
			r=d;
		}
		cout<<r-l<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod=MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}


int n, m, arr[302][302], cnt[302];
queue<int> qq[302];
bool is_active[302], bad[302];


bool possible(int mid){

    memset(cnt, 0, sizeof(cnt));
    memset(is_active, 0, sizeof(is_active));
    memset(bad, 0, sizeof(bad));

    for(int i=1;i<=n;i++)
        while(!qq[i].empty())   qq[i].pop();

    for(int j=1;j<=m;j++){

        for(int i=1;i<=n;i++){
            int val = arr[i][j];
            if(bad[val])    continue;
            qq[i].push(val);
            if(qq[i].front() == val)    cnt[val]++;
            if(!bad[val] && cnt[val] > mid) bad[val] = true;
        }

        bool another_iteration = true;
        while(another_iteration){
            another_iteration = false;
            for(int i=1;i<=n;i++){
                bool atleast_one = false;
                while(!qq[i].empty() && bad[qq[i].front()]){
                    atleast_one = true;
                    qq[i].pop();
                }
                if(atleast_one && !qq[i].empty()){
                    cnt[qq[i].front()]++;
                    if(!bad[qq[i].front()] && cnt[qq[i].front()] > mid){
                        bad[qq[i].front()] = true;
                        another_iteration = true;
                    }
                }
            }
        }

// cout<<"after j = "<<j<<endl;
// cout<<"bad: ";for(int k=1;k<=m;k++) cout<<bad[k]<<" ";cout<<endl;
// cout<<"qq: ";for(int k=1;k<=n;k++) cout<<(qq[k].empty()?-1:qq[k].front())<<" ";cout<<endl;

    }

    for(int i=1;i<=n;i++)
        if(qq[i].empty())
            return false;
    return true;
}



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

    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>arr[i][j];

// cout<<possible(1)<<endl;

    int ans = n, lo = 1, hi = n-1;
    while(lo <= hi){
        int mid = (lo+hi)/2;
        if(possible(mid)){
            ans = min(ans, mid);
            hi = mid-1;
        }
        else{
            lo = mid+1;
        }
    }

    cout<<ans;
    return 0;
}





Measured memory_bytes: 1332
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){
  int n;
  int c[3];
  cin >> c[0] >> c[1] >> c[2] >> n;

  long long ans = 0;

  for(int i = 0; i*c[0] <= n ; i++){
    for(int j = 0; j*c[1] <= n && i*c[0] + j*c[1] <= n ; j++){
      if((n - i*c[0] - j*c[1]) %c[2] == 0) ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define N 5

using namespace std;
void output_array_int(int*,int,char);
void input_array_int(int*,int);

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

int main(){
  int x,i;
  i=0;

  while(1){
    i++;
    cin>>x;
    if(x==0){
      break;
    }
    cout<<"Case "<<i<<": "<<x<<endl;
  }

  return 0;
}

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

void output_array_int(int * a,int n,char ch){
  int i;

  for(i=0;i<n;i++){
    cout<<*(a+i);
    if(i<(n-1)){
      cout<<ch;
    }
  }

  cout<<endl;

  return;
}

void input_array_int(int *a,int n){
  int i;

  for(i=0;i<n;i++){
    cin>>*(a+i);
  }
}

Measured memory_bytes: 3104
import sys
n = int(input())
an = list(map(int,input().split()))
l = 1
r = 1
ans = 1
tmpsum=an[0]
while r<n:
  while r<n and tmpsum^an[r]==tmpsum+an[r]:
    tmpsum+=an[r]
    r += 1
    ans += r-l+1
  tmpsum -= an[l-1]
  l +=1
  if l>r:
    r=l
    tmpsum=an[l-1]
    ans += 1
print(ans)

Measured memory_bytes: 24424
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	int people;
	int total=0;

	for (int i = 0; i < N; i++) {

		int l, r;
		cin >> l >> r;
		people = r - l + 1;
		total += people;

	}

	cout << total << endl;

	
}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  int N;
  cin >> N;
  ll A[N];
  ll absmin = 1e9+1;
  int mnsN = 0; 
  ll ans = 0;
  for(int i=0; i<N; i++) {
    cin >> A[i];
    if(A[i] < 0) mnsN++;
    absmin = min(absmin, abs(A[i]));
    ans += abs(A[i]);                
  }
  if(mnsN%2 == 0){
    cout << ans << endl;
  }else{
    cout << ans - 2*absmin << endl;
  }
  return 0;  
}


Measured memory_bytes: 1024
const val MOD = 1000000007L
fun main(args: Array<String>) {
    val (n, a, b) = getLongs()

    val coma = comb(n, a)
    val comb = comb(n, b)
    val out = (pow(2L, n) - 1 - coma - comb) % MOD
    println((out + MOD) % MOD)
}
fun pow(base: Long, exp: Long): Long {
    return when {
        exp == 0L -> 1L
        exp == 1L -> base
        exp % 2 == 1L -> base * pow(base, exp - 1) % MOD
        else -> pow(base, exp / 2).let { it * it } % MOD
    }
}
fun comb(n: Long, k: Long): Long {
    var i = n - k + 1
    var fn = 1L
    while (i <= n) {
        fn = fn * i % MOD
        i++
    }
    i = 1
    var fk = 1L
    while (i <= k) {
        fk = fk * i % MOD
        i++
    }
    return fn * inv(fk) % MOD
}

fun inv(n: Long): Long {
    return pow(n, MOD - 2)
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }



Measured memory_bytes: 36020
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long p = 0;
		long ss = 0;
		for (int i = 0; i < n; i++) {
			long c = sc.nextLong();
			if (c < p) {
				ss += p - c;
				continue;
			}
			p = c;
		}
		System.out.println(ss);
	}
}


Measured memory_bytes: 60476
s = input().rstrip();
ans = 1;
for i in range(len(s)) :
	if i % 2 == 0 and s[i] == 'L' :
		ans = 0;
	if i % 2 == 1 and s[i] == 'R' :
		ans = 0;

if ans :
	print('Yes');
else :
	print('No')

Measured memory_bytes: 2940
N, M = map(int, input().split())
A = list(map(int, input().split()))
hyou = [0] * N
sou = 1/(4*M)
total = sum(A)
for i, a in enumerate(A):
    if a >= total*sou:
        hyou[i] = 1
if sum(hyou) >= M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
import qualified Data.ByteString.Char8 as B

main = getLine >> B.getLine >>= B.putStrLn . solve

solve :: B.ByteString -> B.ByteString
solve xs = B.replicate l '(' `B.append` xs `B.append` B.replicate r ')'
    where
        (l, r) = B.foldl' ff (0, 0) xs
        ff (lacc, racc) x
            | x == '(' = (lacc, racc + 1)
            | racc > 0 = (lacc, racc - 1)
            | otherwise = (lacc + 1, racc)


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/11  Problem: ABC 089 A / Link: http://abc089.contest.atcoder.jp/tasks/abc089_a  ----- */


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

	LL N; 
	cin >> N;
	LL ans = N/3;
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC063_A_Restricted
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			
			if(a + b >= 10) Console.WriteLine("error");
			else Console.WriteLine(a + b);
		}
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <ostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <math.h>
#include <set>
#define maxn 20
using namespace std;
struct Node
{
    int x,y;
} node[maxn];

bool vis[maxn];
vector<pair<int,int> >vec;
int ans = 0,n;
void solve()
{
    int num = 0;
    int all = vec.size();
    for(int i=0; i<all; ++i)
    {
        int xx1 = node[vec[i].first].x-node[vec[i].second].x;
        int yy1 = node[vec[i].first].y-node[vec[i].second].y;
        for(int j=0; j<all; ++j)
        {
            if(i == j)continue;
            int xx2 = node[vec[j].first].x-node[vec[j].second].x;
            int yy2 = node[vec[j].first].y-node[vec[j].second].y;
            if(xx1*yy2 == xx2*yy1)
                ++num;
        }
    }
    ans = max(ans,num);
}
void IDA(int a)
{
    if(a == n)
    {
        solve();
        return;
    }
    if(vis[a] == 1)IDA(a+1);
    else
    {
        for(int i=0; i<n; i++)
        {
            if(vis[i] || i == a) continue;
            vec.push_back(make_pair(a,i));
            vis[a] = vis[i] = 1;
            IDA(a+1);
            vec.pop_back();
            vis[a] = vis[i] = 0;
        }
    }
}

int main()
{
    //freopen("in.txt","r",stdin);
    vec.clear();
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>node[i].x>>node[i].y;
    memset(vis,0,sizeof(vis));
    ans = 0;
    IDA(0);
    cout<<ans/2<<endl;
    return 0;
}



Measured memory_bytes: 3100
def main():
    n, a, b, *x = map(int, open(0).read().split())
    ans = 0
    it = iter(x)
    nw = it.__next__()
    for nx in it:
        c = (nx - nw) * a
        if c > b:
            ans += b
        else:
            ans += c
        nw = nx

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14052
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 1050
#define INF 1000000005LL
#define pi 3.14159265358979323846

using namespace std;
typedef long long int ll;
typedef long double ld;


int main()
{
	ll N,K;
	scanf("%lld%lld",&N,&K);
	ll ans=0;
	if(K%2 == 1){//odd
		ll a = N/K;
		ans += a*a*a;
		if(a<=0)ans=0;
	}else{ //even
		ll a = N/K;
		if(a<=0)a=0;
		ans += a*a*a;
		ll b = N+K/2;
		ll c = b/K;
		if(c<=0)c=0;
		ans += c*c*c;
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 100000+10;
int color[maxn][15];
int v[maxn],d[maxn],c[maxn];
vector <int> node[maxn];
void paint(int v1, int d1, int c1)
{    
    if(d1==-1)  return;    
	if(color[v1][d1] ) return;    
	color[v1][d1] = c1;    
	for(int i =0;i<node[v1].size();i++)        
	paint(node[v1][i], d1-1, c1);
}int main()
{    
    ios::sync_with_stdio(0);    
	memset(color, 0, sizeof color);    
	int N, M;    
	cin >> N >>M;    
	for(int i=1;i<=M;i++){        
	int a, b;        
	cin >> a >> b;        
	node[a].push_back(b);        
	node[b].push_back(a);    
	}    ///自己指向自己， 才能够自己跑到color[i][0]    
	for(int i=1;i<=N;i++)        
	node[i].push_back(i);    
	int q;    
	cin >> q;    
	for(int i=1;i<=q;i++)        
	cin >> v[i] >> d[i] >> c[i];    
	for(int i=q;i>=1;i--)        
	paint(v[i], d[i], c[i]);    
	for(int i=1;i<=N;i++)        
	cout<<color[i][0]<<endl;    
	return 0;
}


Measured memory_bytes: 13560
s = input()

ans=0
past=''
for i in range(len(s)):
    # print(s[i], past, ans)
    if i == 0:
        past=s[i]
    elif s[i] == past:
        if s[i]=='0':
            past='1'
            ans+=1
        else:
            past='0'
            ans+=1
    else:
        past=s[i]
print(ans)

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

using namespace std;

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

	int n;
	cin >> n;

	cerr << "n = " << n << '\n';

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

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

	int cnt = 0;

	set<pair<int, int> > s = { { 0, -1 } };
	for(int i = 0; i < n; ++i) {
		s.emplace(b[i], i);
	}

	long long ans = 0;

	while(s.size() > 1) {
		auto o = *s.rbegin();
		s.erase(o);
		int p = o.second;
		int nxt = s.rbegin() -> first;
		int m = b[(p - 1 + n) % n] + b[(p + 1) % n];
		int delta = (o.first - a[p]) / m;
		if(o.first == a[p]) {
			continue;
		}
		if(delta == 0 || o.first < a[p]) {
			cout << -1 << '\n';
			exit(0);
		}
		ans += delta;
		o.first -= m * delta;
		b[p] = o.first;
		s.insert(o);
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 11264
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val K = sc.next().toInt()
        val A = LongArray(N) { sc.next().toLong() }
        for (i in K until N) {
            if (A[i - K] < A[i]) {
                pw.println("Yes")
            } else {
                pw.println("No")
            }
        }
    }
}


Measured memory_bytes: 62128