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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

ll m[100][100];

void show_table(ll I, ll J) {
  for (ll i = 0; i <= I; i++) {
    for (ll j = 0; j <= J; j++) {
      cout << m[i][j] << " ";
    }
    cout << "" << endl;
  }
  cout << "" << endl;
}

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll H, W;
  scanf("%lld %lld", &H, &W);

  for (ll y = 0; y < H; y++) {
    for (ll x = 0; x < W; x++) {
      m[y][x] = -1;
    }
  }

  ll spaces = 0;

  for (ll y = 0; y < H; y++) {
    string s;
    cin >> s;

    for (ll x = 0; x < W; x++) {
      if (s[x] == '.') {
        m[y][x] = INF;
        spaces++;
      }
    }
  }

  queue<pll> q;
  q.push(make_pair(0, 0));
  m[0][0] = 0;

  for (;;) {
    if (q.empty()) {
      break;
    }
    auto pos = q.front();
    ll y = pos.first;
    ll x = pos.second;

    ll c = m[y][x];

    if (y >= 1 && m[y - 1][x] > c + 1) {
      m[y - 1][x] = c + 1;
      q.push(make_pair(y - 1, x));
    }
    if (y < H - 1 && m[y + 1][x] > c + 1) {
      m[y + 1][x] = c + 1;
      q.push(make_pair(y + 1, x));
    }
    if (x >= 1 && m[y][x - 1] > c + 1) {
      m[y][x - 1] = c + 1;
      q.push(make_pair(y, x - 1));
    }
    if (x < W - 1 && m[y][x + 1] > c + 1) {
      m[y][x + 1] = c + 1;
      q.push(make_pair(y, x + 1));
    }

    q.pop();
  }

  // show_table(3, 3);

  ll a = m[H - 1][W - 1];

  if (a == INF) {
    cout << -1 << endl;
    return 0;
  }
  // cout << "a:" << a << endl;

  ll ans = spaces - a - 1;

  cout << ans << endl;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,M,C;
    cin >> N  >>  M >> C;
    int B[M], A[N][M];
    for(int i = 0; i < M; i++) cin >> B[i];
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            cin >> A[i][j];
        }
    }
    int c = 0;
    for(int i = 0; i < N; i++){
        int sum = 0;
        for(int j = 0; j < M; j++){
            sum += A[i][j] * B[j];
        }
        sum += C;
        if(sum > 0) c++;
    }
    cout << c << endl;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()
a = na()

flag = True
ans = 0
while flag:
    flag = False
    last = 0
    for i in range(n):
        t = a[i]
        if a[i] != 0:
            flag = True
            if last == 0:
                ans += 1
            a[i] -= 1
        last = t

print(ans)


Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    cin >> N;
    int ans = (1000 - (N % 1000)) % 1000;
    cout << ans << endl;
}

Measured memory_bytes: 3632
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<double> T(N+1),V(N+1);
	for(int i=0;i<N;++i){
		cin >> T[i];
	}
	for(int i=0;i<N;++i){
		cin >> V[i];
	}
	T[N] = 0;
	V[N] = 0;

	for(int i=N-1;i>=0;--i){
		V[i] = min(V[i],V[i+1]+T[i]);
	}
	double ans = 0.0;
	double v = 0.0;
	for(int i=0;i<N;++i){
		if( V[i] <= V[i+1] ){
			double h = V[i]-v;
			if( h <= T[i] ){
				ans += (double)((T[i]*2-h)*h)/2;
				ans += v*T[i];
			}else{
				ans += (double)((v*2+T[i])*T[i])/2;
			}
			v = min((double)V[i],v+T[i]);
		}else{
			if( v+T[i] <= V[i+1] ){
				ans += (double)(T[i]*T[i])/2;
				ans += v*T[i];
				v = v + T[i];
			}else{
				double T1,T2;
				T1 = V[i]-v;
				T2 = T[i] - (V[i]-V[i+1]);
				if( T1 <= T2 ){
					ans += (double)((v*2+T1)*T1)/2;
					ans += (T2-T1)*V[i];
					ans += (double)(V[i]+V[i+1])*(T[i]-T2)/2;
					v = V[i+1];
				}else{
					double Tcen = (V[i+1]-v+T[i])/2;
					ans += (double)(v*2+Tcen)*Tcen/2;
					ans += (double)(v+Tcen+V[i+1])*(T[i]-Tcen)/2;
					v = V[i+1];
				}
			}
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
  int key;
 struct Node *r,*l,*p;
};

struct Node *root,*NIL;

void insert(int);
void inorder(struct Node *);
void preorder(struct Node *);

int main(){
  int n,i,x;
  char com[100];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0] =='i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
}

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z; 

  z=malloc(sizeof(struct Node));
  z->key=k;
  z->l=NIL;
  z->r=NIL;

  while(x!=NIL){
    y=x;
    if( z->key < x->key){
      x=x->l;
    }
    else{
 x=x->r;
    }
  }

  z->p=y;
  if(y==NIL){
    root=z;
  }
  else{
    if( z->key<y->key){
      y->l=z;
    }
    else{
      y->r=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}

void preorder(struct Node *u){
 if(u==NIL) return;
 printf(" %d",u->key);
 preorder(u->l);
 preorder(u->r);
}



Measured memory_bytes: 25128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  int L, R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  if (L > R){
    cout << "Left"  << endl; 
  }
  else if (L == R){
    cout << "Balanced" << endl;
  }
  else {
  cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
n,x=map(int, input().split(" "))
A=list(map(int, input().split(" ")))
A.sort()
#print(A)
result=0
for i in range(len(A)):
    #print(x)
    if i==len(A)-1:
         if A[i]==x:
             result+=1
    elif A[i]<=x:
        x-=A[i]
        result+=1

    else:
        break
print(result)


Measured memory_bytes: 3316
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for (int i = 0; i < 150; i++) {
			try {
				String str = sc.next();
				for (int j = 0; j < 10; j++) {
					String e = str.replace("X", Integer.toString(j));
					String[] tmp = e.split("\\+");
					String a = tmp[0];
					String[] tmp_ = tmp[1].split("=");
					String b = tmp_[0];
					String c = tmp_[1];
					if ((a.charAt(0) != '0' && a.length() > 1 || a.length() == 1)
						&& (b.charAt(0) != '0' && b.length() > 1 || b.length() == 1)
						&& (c.charAt(0) != '0' && c.length() > 1 || c.length() == 1)) {
						BigDecimal A = new BigDecimal(a);
						BigDecimal B = new BigDecimal(b);
						BigDecimal C = new BigDecimal(c);
						if (A.add(B).compareTo(C) == 0) {
							System.out.println(j);
							break;
						}
					}
					if (j == 9) {
						System.out.println("NA");
					}
				}
			} catch (Exception e) {
				break;
			}
		}
	}
}


Measured memory_bytes: 29304
while True:
    n, x = list(map(int,input().split()))
    m=0
    if n==0 and x==0:
        break
    else:
        for i in range(1,n+1):
            for j in range(i+1,n+1):
                for k in range(j+1, n+1):
                    #print(i,j,k)
                    if i+j+k==x:
                        m+=1
    print(m)

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

char F[102][102];


//????????´
void r(int y,int x){
 if(F[y][x]!='@'){
	return ;
 }

F[y][x]='.';

r(y-1,x);
//r(y-1,x+1);
r(y,x+1);
//r(y+1,x+1);
r(y+1,x);
//r(y+1,x-1);
r(y,x-1);
//r(y-1,x-1);

}
//??????
void k(int y,int x){
 if(F[y][x]!='#'){
	return ;
 }

F[y][x]='.';

k(y-1,x);
//k(y-1,x+1);
k(y,x+1);
//k(y+1,x+1);
k(y+1,x);
//k(y+1,x-1);
k(y,x-1);
//k(y-1,x-1);

}
//?????????
void m(int y,int x){
 if(F[y][x]!='*'){
	return ;
 }

F[y][x]='.';

m(y-1,x);
//m(y-1,x+1);
m(y,x+1);
//m(y+1,x+1);
m(y+1,x);
//m(y+1,x-1);
m(y,x-1);
//m(y-1,x-1);

}

int main(){
 int n,p;

while(1){
 cin>>n>>p;

 if(n==0&&p==0)break;

 for(int i=1;i<=n;i++)
	for(int g=1;g<=p;g++)
		cin>>F[i][g];

 int cnt=0;
 for(int i=1;i<=n;i++)
	for(int g=1;g<=p;g++){
		//????????´
		if(F[i][g]=='@'){
			cnt++;
			r(i,g);
		}
		//??????
		if(F[i][g]=='#'){
			cnt++;
			k(i,g);
		}
		//?????????
		if(F[i][g]=='*'){
			cnt++;
			m(i,g);
		}
	}
 cout<<cnt<<endl;
}

return 0;
}

		

Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main(){
	fast;
	ll x,k;
	cin>>k>>x;
	if(k*500<x)
		cout<<"No";
	else
		cout<<"Yes";
	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    const char W = 'W', R = 'R';
    int N; cin >> N;
    string S; cin >> S;
    int r = S.size()-1, l = 0;
    int ans = 0;
    while(r > l) {
        if (S[l] == W && S[r] == R) {
            ans++;
            r--;l++;
        } else {
            if (S[l] == R) l++;
            if (S[r] == W) r--;
        }
    }

    cout << ans << '\n';

    return 0;
}

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

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n),ct(n);
    for (ll i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
        ct[i] = 0;
    }
    ct[0] = 1;
    ll counter = 0;
    ll current = 0;
    for (ll i = 0; i < k; i++){
        current = a[current];
        ct[current]++;
        counter++;
        if (ct[current] == 3){
            break;
        }
    }
    
    if (counter == k){
        cout << current+1 << endl;
        return 0;
    }

    ll count_1 = 0;
    ll count_2 = 0;
    for (ll i = 0; i < n; i++){
        if (ct[i] == 1){
            count_1++;
        }
        if (ct[i] > 1){
            count_2++;
        }
    }
    ll m = k-count_1;
    m %= count_2;
    current = 0;
    for (ll i = 0; i < m+count_1; i++){
        current = a[current];
    }
    cout << setprecision(18) << current+1 << endl;
}

Measured memory_bytes: 6424
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define MAX 200000
#define SENTINEL 2000000000

typedef long long llong;

int L[MAX / 2 + 2];
int R[MAX / 2 + 2];

llong merge(int A[], int n, int left, int mid, int right) {
        int i, j, k;
        llong cnt = 0;
        int n1 = mid - left;
        int n2 = right - mid;

        for (i = 0; i < n1; i++)
                L[i] = A[left + i];

        for (i = 0; i < n2; i++)
                R[i] = A[mid + i];

        L[n1] = R[n2] = SENTINEL;
        i = j = 0;
        for (k = left; k < right; k++) {
                if (L[i] <= R[j]) {
                        A[k] = L[i++];
                } else {
                        A[k] = R[j++];
                        cnt += n1 - i;
                }
        }

        return cnt;
}

llong mergeSort(int A[], int n, int left, int right) {
        int mid;
        llong v1, v2, v3;

        if (left + 1 < right) {
                mid = (left + right) / 2;
                v1 = mergeSort(A, n, left, mid);
                v2 = mergeSort(A, n, mid, right);
                v3 = merge(A, n, left, mid, right);
                return v1 + v2 + v3;
        } else {
                return 0;
        }
}

int main() {
        int *A, n;

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

        llong ans = mergeSort(A, n, 0, n);
        cout << ans << endl;

        return 0;
}

Measured memory_bytes: 4656
#include<iostream>
#include<cstring>
#include<stack>
#include<vector>
using namespace std;

int main() {
	char input[20000];
	cin >> input;

	stack<int> st1;
	stack<int> st2;
	stack<int> st3;
	int lv = 0;
	int total = 0;
	for (unsigned int i = 0; i < strlen(input); i++) {
		char c = input[i];
		if (c == '\\') {
			lv--;
			st1.push(i);
		}
		else if (c == '/') {
			lv++;
			if (!st1.empty()) {
				int newArea = i - st1.top(); st1.pop();
				total += newArea;
				int prevArea = 0;
				while (!st2.empty() && st3.top() < lv) {
					st3.pop();
					prevArea += st2.top(); st2.pop();
				}
				st2.push(newArea + prevArea);
				st3.push(lv);
			}
			else if (!st3.empty()) {
				st3.pop();
				st3.push(lv);
			}
		}
	}

	cout << total << endl;
	int n = st2.size();
	cout << n;
	vector<int> vec;
	while (!st2.empty()) {
		vec.push_back(st2.top());
		st2.pop();
	}
	for (int i = 0; i < n; i++) {
		cout << " " << vec[n-i-1];
	}
	cout << endl;
}



Measured memory_bytes: 3284
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {return(b?gcd(b,a%b):a);}
ll lcm(ll a, ll b) {return(a/gcd(a,b)*b);}

int main() {
    int x; cin >> x;
    ll lm = lcm(x,360);
    int ans = lm / x;
    cout << ans << endl;
}

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

int main() {
  int N; cin >> N;
  vector<int> V(N), C(N);
  rep(i, 0, N) cin >> V[i];
  rep(i, 0, N) cin >> C[i];
  vector<int> P(N);
  rep(i, 0, N) {
    P[i] = V[i] - C[i];
    if(P[i] < 0) P[i] = 0;
  }
  int ans = accumulate(P.begin(), P.end(), 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  ll K,N;in(K,N);
  vector<ll>A(N);ins(A);
  ll id=0,len=A[1]-A[0];
  up(i,1,N-2){
    if(A[i+1]-A[i]>len){
      len=A[i+1]-A[i];
      id=i;
    }
  }
  if(K-A[N-1]+A[0]>len){
    id=N-1;
    len=K-A[N-1]+A[0];
  }
  out(K-len);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<long> l(n+1);
    l[0] = 2;
    l[1] = 1;
    long s;
    for(int i = 2; i <= n; i++){
        l[i] = l[i-1]+l[i-2];
    }
    cout << l[n];
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        var input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var N = input[0];
        var M = input[1];
        
        var A = new long[N];
        var B = new long[N];
        var C = new long[M];
        var D = new long[M];
        
        for(var i = 0;i < N;i++){
            var a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            A[i] = a[0];
            B[i] = a[1];
        }
        for(var j = 0;j < M;j++){
            var b = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            C[j] = b[0];
            D[j] = b[1];
        }
        
        for(var n = 0;n < N;n++){
            var cp = 1;
            var minDist = Math.Abs(A[n] - C[0]) + Math.Abs(B[n] - D[0]);
            for(var m = 1;m < M;m++){
                var curdist = Math.Abs(A[n] - C[m]) + Math.Abs(B[n] - D[m]);
                if(curdist < minDist){
                    minDist = curdist;
                    cp = m + 1;
                }
            }
            Console.WriteLine(cp);
        }
        
    }
}


Measured memory_bytes: 13268
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
const int maxn=100005;
int n,x[maxn];
ll ans;
int main() {
	read(n);
	for(int i=1;i<=n;i++)
		read(x[i]),ans+=abs(x[i]-x[i-1]);
	ans+=abs(x[n]);
	for(int i=1;i<=n;i++)
		printf("%lld\n",ans-abs(x[i]-x[i-1])-abs(x[i+1]-x[i])+abs(x[i+1]-x[i-1]));
}

Measured memory_bytes: 1664
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	long MODULO = 1_000_000_000 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] f = new long[N + 1];
		long[] cum = new long[N + 1];
		Arrays.fill(f, -Integer.MAX_VALUE / 16);
		Arrays.fill(cum, -Integer.MAX_VALUE / 16);
		f[1] = N;
		cum[1] = N;
		for (int i = 2; i <= N; ++i) {
			f[i] = f[i - 1];
			f[i] = (f[i] + 1L * (N - 1) * (N - 1) % MODULO) % MODULO;
			if (i > 3) {
				f[i] = (f[i] + cum[i - 3]) % MODULO;
			}
			f[i] = (f[i] + Math.min(0, i - 3) - (i - N - 1) + 1) % MODULO;
			cum[i] = (cum[i - 1] + f[i]) % MODULO;
		}
		System.out.println(f[N]);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 38228
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

int W,H,N;
int x[100];
int y[100];
int a[100];
int G[100][100];

int main(){
    cin>>W>>H>>N;
    rep(i,N) cin>>x[i]>>y[i]>>a[i];

    rep(i,W) fill(G[i],G[i]+H,1);
    rep(n,N){
        rep(i,W){
            rep(j,H){
                switch (a[n]){
                    case 1:
                        if(i<x[n]) G[i][j]=0;
                        break;
                    case 2:
                        if(i>=x[n]) G[i][j]=0;
                        break;
                    case 3:
                        if(j<y[n]) G[i][j]=0;
                        break;
                    case 4:
                        if(j>=y[n]) G[i][j]=0;
                        break;
                    default:
                        break;
                }
            }
        }
        //rep(i,W){rep(j,H){cout<<G[i][j];}cout<<endl;}cout<<endl;
    }

    int ans=0;
    rep(i,W) rep(j,H) ans+=G[i][j];
    
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    S = input()
    res = 0
    cnt = 0
    for s in S:
        if s == "R":
            cnt += 1
            res = max(res, cnt)
        else:
            cnt = 0
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 8904
// I can't tell you what it really is,
// I can only tell you what it feels like.
#include "bits/stdc++.h"
using namespace std;
 
#define int long long
#define F first
#define S second
#define sz(x) ((int)x.size())
#define rep(i,a,n) for (int i = a; i <= n; ++i)
#define all(v)  v.begin(), v.end()
#define pb push_back
#define P pair < int, int >
#define E cout << '\n'

#ifdef LOCAL
#define cerr cout
#else
#endif
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif

const int mod = 1e9 + 7;
const int N = 4e5 + 5;

inline int add(int x, int y, int mod = mod) {
   if (x >= mod) x %= mod;
   if (y >= mod) y %= mod;
   x  += y;
   return (x >= mod ? x - mod : x);
} 
inline int mul(int x, int y, int mod = mod) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  return (x*y) % mod;
}
inline int sub(int x, int y, int mod = mod) {
  x -= y;
  if (x + mod <= 0) {
    x %= mod;
  }
  return (x < 0 ? x+mod : x);
}
int po(int x, int n, int mod = mod) {
  int res = 1;
  for (;n > 0;) {
    if (n & 1) {
      res = mul(res, x, mod);
    }
    x = mul(x, x, mod);
    n /= 2;
  }
  return res;
}

int get(vector<int> &v, int val) {
  int n = v.size()-1, ok = val;
  int x = 0, y = 0, ans = 0;
  for (int &i: v)x += (i==1), y += (i==0);
  for (int &i: v) {
    x -= i==1;
    y -= i==0;
    if (i == 0)
      ans = add(ans, mul(x, ok));
    else 
      ans = add(ans, mul(y, ok));
  }
  return ans;
}
 
inline void solve() {
   int n, x, ans(0);
   cin >> n;
   vector<int>v(n);
   for (int &x: v) cin >> x;
    int ok = 1;
   for (int i = 0; i < 60; ++i) {
    vector<int> tmp;
    for (int &x: v)
      tmp.push_back(((1LL<<i)&x)>0);
    ans = add(ans, get(tmp, ok));
    ok = add(ok, ok);
   }
   cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL); 
  //int t = 1;cin >> t; while(t--)
  solve();
  E;
  return 0;
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  int t[n];
  int sum = 0;
  rep(i, n) cin >> t[i], sum += t[i];
  int m;
  cin >> m;
  rep(i, m) {
    int p, x;
    cin >> p >> x;
    --p;
    cout << sum - t[p] + x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
s=input()
t=input()
n=len(s)
m=len(t)
s_list=[]
for i in range(n):
    temp=''
    if n-i>=m:
        for j in range(n):
            if i<=j<=i+m-1:
                if s[j]=='?':
                    temp=temp+t[j-i]
                else:
                    if s[j]==t[j-i]:
                      temp=temp+t[j-i]
                    else:
                        break
            else:
                if s[j]=='?':
                    temp=temp+'a'
                else:
                    temp=temp+s[j]
        else:
            s_list.append(temp)
s_list.sort()
if s_list==[]:
    print('UNRESTORABLE')
else:
    print(s_list[0])


Measured memory_bytes: 39024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,sum=0;
    int a;
    cin>>n>>k;
    vector<int> v;
    for(i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    for(i=0;i<k;i++){
        sum=sum+v[i];
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
//#define int long long
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
using namespace std;

vector<vector<int>> adj;

vector<bool> visited;
vector<int> dist;

void dfs(int i)
{
    visited[i] = true;
    for (int v : adj[i])
    {
        if (!visited[v])
        {
            dfs(v);
        }
        dist[i] = max(dist[i], 1 + dist[v]);
    }
}
void init(int n)
{
    adj.resize(n, vector<int>());
    visited.resize(n);
    dist.resize(n);
}

signed main()
{
    FAST_IO;

    int N, M;
    cin >> N >> M;
    init(N + 1);
    while (M--)
    {
        int x, y;
        cin >> x >> y;
        adj[x].push_back(y);
    }
    for (int i = 1; i < N + 1; i++)
    {
        if (!visited[i])
        {
            dfs(i);
        }
    }

    cout << *max_element(dist.begin(), dist.end());
    return 0;
}

Measured memory_bytes: 11728
require "prime"

N_MAX = 10 ** 5

s = 0
f = [0] * (N_MAX+1)
N_MAX.times do |i|
  s += 1 if i.prime? && ((i+1)/2).prime?
  f[i] += s 
end

q = gets.to_s.to_i
q.times do |i|
  l, r = gets.to_s.split.map{|t| t.to_i }
  puts f[r] - f[l-1]
end

Measured memory_bytes: 5244
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
long long omote[1000002];
long long gyaku[1000002];
long long inv(long long now) {
	long long hoge = MAX_MOD - 2LL;
	long long ans = 1;
	while (hoge != 0) {
		if (hoge % 2 == 1) {
			ans *= now;
			ans %= MAX_MOD;
		}
		now *= now;
		now %= MAX_MOD;
		hoge /= 2;
	}
	return ans;
}
long long combination(long long a, long long b) {
	long long ans = omote[a];
	ans *= gyaku[b];
	ans %= MAX_MOD;
	ans *= gyaku[a - b];
	ans %= MAX_MOD;
	return ans;
}
long long functions(long long k,long long n) {
	long long a = 2 * k - n;
	long long b = n - k - 1;
	long long hoge = omote[a+b];
	hoge *= gyaku[a];
	hoge %= MAX_MOD;
	hoge *= gyaku[b];
	hoge %= MAX_MOD;
	hoge *= omote[k];
	hoge %= MAX_MOD;
	hoge *= omote[b];
	hoge %= MAX_MOD;
	return hoge;
}
int main(){
	omote[0] = 1;
	gyaku[0] = 1;
	for (long long i = 1; i < 1000002; ++i) {
		omote[i] = omote[i - 1] * i;
		omote[i] %= MAX_MOD;
		gyaku[i] = inv(omote[i]);
	}
	long long n;
	cin >> n;
	long long ans = 0;
	long long geko = 0;
	for (long long k = (n+1)/2; k < n; ++k) {
		if(k == (n+1)/2){
			ans += k * functions(k, n);
			ans %= MAX_MOD;
		}
		else {
			ans += k * (functions(k, n) + (MAX_MOD - functions(k - 1, n)));
			ans %= MAX_MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size();i+=2)
        if(s[i]=='h' && s[i+1]=='i') cnt++;
    if(cnt*2==s.size()) puts("Yes");
    else puts("No");
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, m;
	cin >> n >> m;
	if(n % 3 == 0 || m % 3 == 0){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 1e18;
	for(ll i = max(1LL, n / 2); i <= min(n - 1, ((n + 1) / 2)); i++){
		for(ll j = 1; j < m; j++){
			ll a = 1LL * i * j;
			ll b = 1LL * (n - i) * j;
			ll c = 1LL * (m - j) * n;
			ans = min(ans, max({abs(a - b), abs(a - c), abs(b - c)}));
		}
	}
	swap(n, m);
	for(ll i = max(1LL, n / 2); i <= min(n - 1, ((n + 1) / 2)); i++){
		for(ll j = 1; j < m; j++){
			ll a = 1LL * i * j;
			ll b = 1LL * (n - i) * j;
			ll c = 1LL * (m - j) * n;
			ans = min(ans, max({(ll)abs(a - b), (ll)abs(a - c), (ll)abs(b - c)}));
		}
	}
	ans = min(ans, min(m, n));
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>//solved by *ALIKHAN*
#define ll long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define F first
#define S second
#define ppb pop_back
#define mp make_pair
#define all(n) n.begin(), n.end()
#define timefaster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const int INF = (ll)1e18 + 1ll;

int main(){
	double a,sum = 0.0000;
	char q,w,e;
	int n;
	cin >> n;
	for(ll i = 0;i < n;i ++){
		cin >> a;
		cin >> q >> w >> e;
		if(q == 'J'){
			sum += a;
		}
		else {
			sum += a * 380000;
		}
	}
	cout << sum;
}
// Aksay sila


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int n, m;
int a[300][300];
bool s[300];

int solve(void){
    int cnt[300];
    fill(cnt, cnt + m, 0);

    int res = -1, id = -1;
    rep(i, n){
        for(auto j : a[i]){
            if(s[j]){
                ++cnt[j];
                if(chmax(res, cnt[j])){
                    id = j;
                }
                break;
            }
        }
    }

    if(id == -1){
        return n;
    }

    s[id] = false;

    return min(res, solve());
}

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

    cin >> n >> m;

    rep(i, n){
        rep(j, m){
            cin >> a[i][j];
            --a[i][j];
        }
    }

    fill(s, s + m, true);

    int ans = solve();
    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 1024
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

vector<int> a[110000];
int d[110000];

int main()
{
  int i,j,n,x,y,cnt1,cnt2;
  vector<int> q;
  scanf("%d",&n);
  for (i=0;i<n;i++)
    a[i].clear();
  for (i=0;i+1<n;i++)
  {
    scanf("%d%d",&x,&y);
    x--;y--;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  memset(d,-1,sizeof(d));
  d[0]=0;
  d[n-1]=1;
  q.clear();
  q.push_back(0);
  q.push_back(n-1);
  for (i=0;i<q.size();i++)
  {
    x=q[i];
    for (j=0;j<a[x].size();j++)
    {
      y=a[x][j];
      if (d[y]==-1)
      {
        d[y]=d[x];
        q.push_back(y);
      }
    }
  }
  cnt1=0;cnt2=0;
  for (i=0;i<n;i++)
    if (d[i]==0) cnt1++;
    else cnt2++;
  if (cnt1>cnt2) printf("Fennec\n");
  else printf("Snuke\n");
  return 0;
}

Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    cin >> A;
    vector<pii> CB(M);
    rep(i, 0, M) {
        int b, c;
        cin >> b >> c;
        CB[i] = {c, b};
    }
    sort(rall(CB));
    sort(all(A));
    int idx = 0;
    rep(i, 0, N) {
        if (A[i] < CB[idx].first) {
            A[i] = CB[idx].first;
            CB[idx].second--;
            if (CB[idx].second == 0) {
                idx++;
            }
        }
        if (idx == M) {
            break;
        }
    }
    int ans = accumulate(all(A), 0LL);
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 2688
#include "bits/stdc++.h"

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) for(int i = 0; i < (a); ++i)

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;

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

    int n;
    cin >> n;

    cout << "ABC" << n << endl;

    return 0;
}

Measured memory_bytes: 256
#define REP(i, a, b) for(int i = a; i < b; i++)

int main(void){
    int n;
    scanf("%d",&n);
    int a[n + 1];
    REP(i, 0, n) {
        scanf("%d",&a[i]);
    }
    int j = 0;
    REP(i, 0, n) {
        if (a[j] == 2) {
            printf("%d\n",i + 1);
            return 0;
        }
        j = a[j] - 1;
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>

using namespace std;

int main(void)
{
	int t, n;
	int array[128];
	
	cin >> t;
	for (int c = 0; c < t; c++){
		cin >> n;
		
		int up_max = 0, dn_max = 0;
		for (int i = 0; i < n; i++){
			cin >> array[i];
			
			if (i > 0){
				if (up_max < array[i] - array[i-1]){
					up_max = array[i] - array[i-1];
				}
				if (dn_max < array[i-1] - array[i]){
					dn_max = array[i-1] - array[i];
				}
			}
		}
		
		cout << up_max << " " << dn_max << endl;
	}
	
	return (0);
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    int f;
    if(n % x == 0){
        f = n/x;
    }
    else {
        f = n/x+1;
    }
    cout << f * t << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n)
    cin>>a.at(i);
  in x=1000;
  in y=0;
  
  rep(i,n-1){
    x+=y*a.at(i);
    y=0;
    if(a.at(i)<a.at(i+1)){
      y+=x/a.at(i);
      x-=y*a.at(i);
    }
    
    
  }
  x+=a.at(n-1)*y;
  cout<<x<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int INF = 123456789;

class SuffixArray {
public:
  const string &s;
  vector<int> sa, rank;
  int n;
  void construct_sa(){
    sa.resize(n+1);
    rank.resize(n+1);
    rep(i,n+1){
      sa[i]=i;
      rank[i] = (i<n)?s[i]:(-1);
    }
    vector<int> tmp(n+1,0);
    for(int k=1; k<=n; k*=2){
      auto comp = [&](const int i, const int j){
        if(rank[i]!=rank[j]) return rank[i]<rank[j];
        int ri = (i+k<=n)?(rank[i+k]):-1;
        int rj = (j+k<=n)?(rank[j+k]):-1;
        return ri < rj;
      };
      sort(all(sa), comp);
      tmp[sa[0]]=0;
      rep(i,1,n+1){
        tmp[sa[i]] = tmp[sa[i-1]];
        if(comp(sa[i-1], sa[i])) tmp[sa[i]]++;
      }
      swap(tmp, rank);
    }
  }
  SuffixArray(const string &str) : s(str){
    n = s.size();
    construct_sa();
  }
  int getRank(const string &t) const {
    int m = t.size();
    int l = 0, r = n+1;
    while(r-l>1){
      int mid = (r+l)/2;
      if(s.compare(sa[mid], m, t) < 0) l = mid;
      else r = mid;
    }
    return r;
  }
};

class SegTree {
public:
  int n;
  vector<int> data;
  SegTree(int m){
    n=1;
    while(n<m) n*=2;
    data.resize(2*n, INF);
  }
  void update(int l, int r, int v){
    for(l+=n, r+=n; l<r; l/=2, r/=2){
      if(l&1){
        data[l] = min(data[l], v);
        l++;
      }
      if(r&1){
        r--;
        data[r] = min(data[r], v);
      }
    }
  }
  int get(int k){
    k += n;
    int ret = data[k];
    while(k>0){
      k = k/2;
      ret = min(ret, data[k]);
    }
    return ret;
  }
};


int main(){
  string s;
  cin>>s;
  int n;
  cin>>n;
  vector<string> v(n);
  rep(i,n) cin>>v[i];

  SuffixArray sa(s);

  SegTree st(s.size()+1);
  rep(i,n){
    int lb = sa.getRank(v[i]);
    int ub = sa.getRank(v[i] + (char)('z'+1));
    st.update(lb, ub, v[i].size());
  }

  int ans = 0;
  int nxt = INF;
  rep(i,s.size()){
    nxt = min(nxt, i + st.get(sa.rank[i])-1);
    // dbg(i, nxt, sa.rank[i]);
    if(i == nxt){
      ans++;
      nxt = INF;
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 5688
#include <stdio.h>
#include <string.h>

int blood[4];

int main(void)
{
	char type[4];
	int i;
	
	while (scanf("%*d,%s", type) != EOF){
		if (strcmp(type, "A") == 0){
			blood[0]++;
		}
		else if (strcmp(type, "B") == 0){
			blood[1]++;
		}
		else if (strcmp(type, "AB") == 0){
			blood[2]++;
		}
		else if (strcmp(type, "O") == 0){
			blood[3]++;
		}
	}
	
	for (i = 0; i < 4; i++){
		printf("%d\n", blood[i]);
	}
	
	return 0;
}

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

int main()
 {
  int a,b,c,d;

   cin >> a >> b;

   c =(a + b)/2;

   if (a%2 ==0 && b%2 !=0)
   //if (c%2 !=0)
   {
    cout << c+1 << endl;
   }
   else if (a%2 !=0 && b%2 ==0)
   //if (c%2 !=0)
   {
    cout << c+1 << endl;
   }
   else
   {
   cout <<c << endl;
   }
}



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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
ll INF = LLONG_MAX;
 
using vc = vector<char>;
using vi = vector<int>;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N, K; cin >> N >> K;

    ll ans = 0;
    FOR(a, 1, N+1) {
        int off = K - (a % K);
        if (2 * off % K != 0) continue;
        ll res = (N - off) / K + 1;
        ans += res * res;    
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}

void solve(){
    ll n,m;cin>>n>>m;
    vl s(m),c(m);
    rep(i,m){
        cin>>s[i]>>c[i];
        s[i]--;
    }

    vl a(n,-1);
    rep(i,m){
        if(a[s[i]]!=-1&&a[s[i]]!=c[i]){
            cout<<-1<<endl;
            return;
        }
        a[s[i]]=c[i];
    }

    if(n==1&&(a[0]==-1||a[0]==0)){
        cout<<0<<endl;
        return;
    }

    if(a[0]==0){
        cout<<-1<<endl;
        return;
    }

    if(a[0]==-1)a[0]=1;

    rep(i,n){
        cout<<(a[i]==-1?0:a[i]);
    }
    cout<<endl;
}

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


Measured memory_bytes: 256