akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, a, b) for (int i = a; i < b; i++)
#define loopr(i, a, b) for (int i = a; i >= b; i--)
#define loops(i, a, b, step) for (int i = a; i < b; i += step)
#define looprs(i, a, b, step) for (int i = a; i >= b; i -= step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie();                        \
    cout.tie();
#define FILE_READ_IN freopen("input.txt", "r", stdin);
#define FILE_READ_OUT freopen("output.txt", "w", stdout);
#define all(a) a.begin(), a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

int main()
{
    string s, t;
    cin >> s;
    cin >> t;
    int sizeS = s.length();
    int sizeT = t.length();
    int flag = 1;

    for (int i = 0; i < sizeS; i++)
    {
        if (s[i] != t[i])
            flag = 0;
    }

    if (flag == 0)
    {
        cout << "No\n";
    }
    else if (sizeS + 1 == sizeT)
    {
        cout << "Yes\n";
    }
    return 0;
}

Measured memory_bytes: 3596
def main():
    S = input()
    T = input()
    answer = solve(S, T)
    print(answer)


def solve(S, T):
    count = 0
    for i in range(len(S)):
        if S[i] != T[i]:
            count += 1
    return count


if __name__ == "__main__":
    main()


Measured memory_bytes: 9364
#include<iostream>
#include<vector>

using namespace std;

int main(void){
  long long X, A, B;
  cin >> X >> A >> B;
  B -= A;
  if(B <= 0) cout << "delicious" << endl;
  else if(B <= X) cout << "safe" << endl;
  else cout << "dangerous" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int max(int a, int b) {
  if (a >= b) return a;
  else return b;
}
int main() {
  int N[101];
  int i, n, a;
  n = 0;
  for (i = 0; i < 101; i ++) N[i] = 0;
  while (scanf("%d", &a) != EOF) N[a] ++;
  for (i = 0; i < 101; i ++) n = max(n, N[i]);
  for (i = 0; i < 101; i ++) if (N[i] == n) printf("%d\n", i);
  return 0;
}

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

#define rep(i,n) for(ll i = 0; i < (n); ++i)

#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF 0x3fffFFFF
#define INF_NEG (INF * -1)
#define INF_LONG 0x3fffFFFFffffFFFFL
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef pair<ll, ll> lpair;
typedef char str255[256];
// char *用、strlen の ll 版
ll StrLen(char *s) { for(ll ptr = 0L;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
ll StrDel(char *s, int n) { ll l = StrLen(s); s[l - n + 1L] = '\0'; return l - n; }
// 正の整数の桁数
ll NumDigits(ll l){ char s[30]; sprintf(s, "%lld", l); return StrLen(s); }

int isFirst = 1;
template <class T> 
void print(T t) { if (isFirst) cout << t, isFirst = 0; else cout << " " << t; }

void chmin(ll& a, ll b) { if (a > b) a = b; }
void chmax(ll& a, ll b) { if (a < b) a = b; }

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

signed main()
{
    int N; cin >> N;
    vector<int> W(N); rep(i, N) cin >> W[i];

    int ans = INF;
    rep(T, N){
        int S1 = 0, S2 = 0;
        rep(i, N){
            if (i <= T) S1 += W[i];
            else S2 += W[i];
        }
        ans = min(ans, abs(S2 - S1));
    }

    cout << ans << endl;

    return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


signed main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    char c = S[0];
    int cnt = 0;
    REP(i, N){
        if(S[i] == c) continue;
        cnt++;
        c = S[i];
    }
    cnt++;
    PRINT(cnt);
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int i,x[4+1],y,z,wa;
	wa=0;
	for(i=1;i<=4;i++) {
		scanf("%d",&x[i]);
		wa+=x[i];
	}
	y=wa/60;
	z=wa%60;
	printf("%d\n%d\n",y,z);
	return 0;
}

Measured memory_bytes: 596
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

As = list(map(int, input().split()))
for i in range(5):
    if As[i] == 0:
        print(i + 1)



Measured memory_bytes: 10752
S = list(input())
pattern_1 = []
pattern_2 = []
cnt_1 = 0
cnt_2 = 0

for i in range(len(S)):
    if i % 2 == 0:
        pattern_1.append('1')
        pattern_2.append('0')
    else:
        pattern_1.append('0')
        pattern_2.append('1')

for (s, a, b) in zip(S, pattern_1, pattern_2):
    if s != a:
        cnt_1 += 1
    if s != b:
        cnt_2 += 1

print(min(cnt_1, cnt_2))
    

Measured memory_bytes: 5512
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_N 100

using namespace std;
typedef list<int>::iterator listit;

int n;
list<int> b;

bool check(listit begin) {
    ++begin;
    for(listit it = begin; it != b.end(); it++) {
        int i = distance(b.begin(), it);
        if(*it > i)
            return false;
    }
    return true;
}

int main(int argc, char **argv) {
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        int bi;
        scanf("%d", &bi);
        b.push_back(bi);
    }
    stack<int> st;
    
    while(!b.empty()) {
        bool erased = false;
        for(listit it = b.begin(); it != b.end(); it++) {
            int i = distance(b.begin(), it);
            if(*it == i + 1 && check(it)) {
                erased = true;
                st.push(*it);
                b.erase(it);
                break;
            }
        }

        if(!erased) {
            printf("-1\n");
            return 0;
        }
    }

    while(!st.empty()) {
        printf("%d\n", st.top());
        st.pop();
    }
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

bool solve(){
	int n;
	scanf("%d", &n);
	int c1 = 0, c2 = 0, c4 = 0;
	for(int i = 0; i < n; ++i){
		int a;
		scanf("%d", &a);
		if(a % 4 == 0){ ++c4; }
		else if(a % 2 == 0){ ++c2; }
		else{ ++c1; }
	}
	
	if(c1 == 0){ return true; }
	if(c2 == 0){ return c4 >= c1 - 1; }
	return c4 >= c1;
}

void mainmain(){
	puts(solve() ? "Yes" : "No");
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i = 0 ; i < n ; i++){
		cin>>a[i];
	}
	vector<int> res(n);
	res[0] = 0;
	res[1] = abs(a[1]-a[0]);
	for(int i = 2 ; i < n ; i++){
		res[i] = min(res[i-2] + abs(a[i]-a[i-2]) , res[i-1]+abs(a[i]-a[i-1]));
	}
	cout<<res[n-1];
}

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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

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

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)

struct UnionFind {
    vector< int > data;

    UnionFind(int sz) {
        data.assign(sz, -1);
    }

    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return (false);
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return (true);
    }

    int find(int k) {
        if (data[k] < 0) return (k);
        return (data[k] = find(data[k]));
    }
  
    bool same(int a, int b){
      if(find(a)==find(b)) return true;
      else return false;
    }

    int size(int k) {
        return (-data[find(k)]);
    }
};

void solve(){
    int N, M;
    cin >> N >> M;
    UnionFind uf(N);
    while(M--){
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
    }
    map<int,int> m;
    rep(i,N){
        m[uf.find(i)]++;
    }
    int ans = 0;
    for(auto i=m.begin(); i!=m.end();i++){
        chmax(ans, i->second);
    }
    cout << ans << endl;
}


signed main(){
    cout << fixed << setprecision(18);
//    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 17148
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion

//ABC 135 -C City Saver
#define MAX 100001
//#define MAX 101
int cnt_m(int* a, int* b, ll* ans);
int cnt_m(int* a, int* b, ll* ans) {
	if (*a >= *b) {
		*ans += *b;
		*a -= *b;
		return 0;
	}
	
	*ans += *a;
	*b -= *a;
	*a = 0;
	return 1;
}


int main(void) {
	int n, i;
	ll  ans = 0;
	int a[MAX], b[MAX];

	scanf("%d", &n);

	for (i = 0; i < n+1; i++) 
		scanf("%d", &a[i]);

	for (i = 0; i < n; i++)
		scanf("%d", &b[i]);

	int rc = 0;
	for (i = 0; i < n; i++) {
		rc = cnt_m(&a[i], &b[i], &ans);
		if (rc == 0) continue;
		rc = cnt_m(&a[i + 1], &b[i], &ans);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;


int main() {
    int N;
    int a[110] = {0};

    cin >> N;

    for(int i = 0; i < N; i++) cin >> a[i];

    sort(a, a+N, greater<int>());

    int score_A = 0;
    int score_B = 0;

    for(int i = 0; i < N; i++) {
        if(i % 2 == 0) score_A += a[i];
        else score_B += a[i];
    }

    cout << score_A - score_B << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
//素数判定
bool is_prime(long long n){
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
const int MOD = 1000000007;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    }
    int l = 0,r = 1e9;
    while(r-l>1){
        int x = (l + r) / 2;
        auto f = [&](int x) {
        ll now = 0;
        rep(i,n)
        {
            now += (a[i] - 1) / x;
        }
        return now <= k;
        };
        if(f(x)){
            r = x;
        }else{
            l = x;
        }
    }
    cout << r << endl;
    return 0;
}

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

int sn[24];
double st[24];

void top(int s,int e){
	int i,j;
	double m=99999;
	for (i=s;i<e;i++) if (m>st[i]) { m=st[i]; j=i; }
	cout << sn[j] << ' ' << m << endl;
	st[j]=99999;
}

int main() {
	int i,j;
	for (i=0;i<24;i++) cin >> sn[i] >> st[i];
    for (i=0;i<3;i++) for (j=0;j<2;j++) top(i*8,i*8+7);
	top(0,23); top(0,23);
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

struct Edge{
  int to;
  long long cost;
};

struct NODE{
  int pos;
  long long cost;
};
bool operator < (const NODE &a,const NODE &b){
  return a.cost > b.cost;
}
vector<Edge> g[100000],rg[100000];

int N;
const ll INF = 1e15;
vector<ll> dijkstra(vector<Edge> g[100000], int s){
  priority_queue<NODE> Q;
  Q.push({s,0});
  vector<ll> res(N,INF);
  while(Q.size()){
    NODE q= Q.top();Q.pop();
    if(res[q.pos] == INF){
      res[q.pos] = q.cost;
    }
    else{
      continue;
    }
    for(auto n : g[q.pos]){
      Q.push({n.to,q.cost+n.cost});
    }
  }
  return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a,b,c;
  while(cin>>n&&n){
    N = 0;
    rep(i,15){
      g[i].clear();
    }
    rep(i,n){
      cin >> a >> b >> c;
      g[a].push_back({b,c});
      g[b].push_back({a,c});
      N = max(N,a);
      N = max(N,b);
    }
    ++N;
    int ans = inf;
    int town = inf;
    rep(i,N){
      int sum = 0;
      auto d = dijkstra(g,i);
      rep(j,N){
        sum += d[j];
      }
      if(ans > sum){
        ans = sum;
        town = i;
      }
//       debug(sum);
    }
    cout << town << " " << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 7800
from heapq import heappop, heappush
Q = int(input())
n, a, b = map(int, input().split())
mi = b
L = [-a]
R = [a]
num = 1
for i in range(Q - 1):
    q = list(map(int, input().split()))
    if len(q) == 3:
        if num % 2 != 0:
            l = -heappop(L)
            r = heappop(R)
            l1 = min(l, q[1])
            r1 = max(r, q[1])
            heappush(L, -l1)
            heappush(R, r1)
            mi += abs(l - q[1])
        else:
            if q[1] < -L[0]:
                heappush(L, -q[1])
                heappush(R, -L[0])
                mi -= q[1] + L[0]
            elif q[1] > R[0]:
                heappush(L, -R[0])
                heappush(R, q[1])
                mi += q[1] - R[0]
            else:
                heappush(L, -q[1])
                heappush(R, q[1])

        mi += q[2]
        num += 1
    else:
        print(-L[0], mi)


Measured memory_bytes: 11144
#include <cstdio>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int H, W;
char S[3000][3000];
std::vector<int> row[3000], col[3000];

int main()
{
  scanf( "%d%d", &H, &W );
  rep( i, H )
    scanf( "%s", S[i] );

  rep( i, H )
  {
    row[i].push_back( -1 );

    rep( j, W ) if( S[i][j] == '#' )
      row[i].push_back( j );

    row[i].push_back( W );
  }

  rep( j, W )
  {
    col[j].push_back( -1 );

    rep( i, H ) if( S[i][j] == '#' )
      col[j].push_back( i );

    col[j].push_back( H );
  }

  int ans = 0;

  rep( i, H ) rep( j, W )
  {
    int lbR = std::lower_bound( row[i].begin(), row[i].end(), j )-row[i].begin();
    int lbC = std::lower_bound( col[j].begin(), col[j].end(), i )-col[j].begin();

    //printf( "(%d,%d) (%d,%d) [%d]\n", i, j, lbR, lbC, row[i][lbR]-row[i][lbR-1]-1+col[j][lbC]-col[j][lbC-1]-1-1 );

    ans = std::max( ans, row[i][lbR]-row[i][lbR-1]-1+col[j][lbC]-col[j][lbC-1]-1-1 );
  }

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

  return 0;
}

Measured memory_bytes: 38400
#!/usr/bin/env python3

from collections import deque
SA = input()
SB = input()
SC = input()

que = {'a': deque(SA), 'b':deque(SB), 'c': deque(SC)}

index = 'a'

while True:
    if len(que[index]) == 0:
        print(index.upper())
        exit()
    index = que[index].popleft()



Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
const int MAX=1e5+10;

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

string S; int n,nxt,ans;
int dp[MAX][9][9][2];

int ok(int l,int r){
    if (l==4||r==4) return 1;
    return l%3<=r%3;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    while(cin >> S,S!="#"){
        int n=S.size();
        for (int i=0;i<=n;++i)
            for (int j=0;j<9;++j)
                for (int k=0;k<9;++k)
                    for (int l=0;l<2;++l)
                        dp[i][j][k][l]=MAX;
        dp[0][4][4][0]=dp[0][4][4][1]=0;
        for (int i=0;i<n;++i){
            nxt=S[i]-'1';
            for (int j=0;j<9;++j){
                for (int k=0;k<9;++k){
                    chmin(dp[i+1][nxt][k][0],dp[i][j][k][0]+1);
                    chmin(dp[i+1][j][nxt][1],dp[i][j][k][1]+1);
                    if (ok(nxt,k)) chmin(dp[i+1][nxt][k][1],dp[i][j][k][0]);
                    if (ok(j,nxt)) chmin(dp[i+1][j][nxt][0],dp[i][j][k][1]);
                }
            }
        }
        ans=MAX;
        for (int j=0;j<9;++j)
            for (int k=0;k<9;++k)
                for (int l=0;l<2;++l)
                    chmin(ans,dp[n][j][k][l]);
        cout << ans << '\n';
    }
}


Measured memory_bytes: 66568
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
print(s.count('1'))

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

// #define int long long
#define rep(i, n) for (ll i = (ll)(0); i < (ll)(n); ++i)
#define reps(i, n) for (ll i = (ll)(1); i <= (ll)(n); ++i)
#define rrep(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define rreps(i, n) for (ll i = ((ll)(n)); i > 0; i--)
#define irep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); ++i)
#define ireps(i, m, n) for (ll i = (ll)(m); i <= (ll)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) ll(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m,l; cin>>n>>m>>l;
  ll G[n][n];
  rep(i,n){
    rep(j,n) G[i][j]=INF;
    G[i][i]=0;
  }
  
  rep(i,m){
    ll a,b,c; cin>>a>>b>>c;
    a--,b--;
    G[a][b]=G[b][a]=c;
  }
  
  ll q; cin>>q;
  vector<pll> Q;
  rep(i,q){
    ll s,t; cin>>s>>t;
    s--,t--;
    Q.emplace_back(s,t);
  } 
  
  vector<vector<pll>> dist(n,vector<pll>(n,{INF,INF}));
  rep(i,n){
    dist[i][i]={0,0};
    priority_queue<pair<pll,ll>, vector<pair<pll,ll>>, greater<pair<pll,ll>>> q;
    q.push({{0,0},i});
    while(!q.empty()){
      auto p=q.top(); q.pop();
      ll v=p.second;
      ll cnt=p.first.first;
      ll used=p.first.second;
      if(dist[i][v]<p.first) continue;
      for(ll nv=0; nv<n; nv++){
        if(nv==v) continue;
        if(G[v][nv]>l) continue;
        ll nused=used+G[v][nv];
        pll np;
        if(nused>l){
          np={cnt+1,G[v][nv]};
        }else{
          np={cnt,nused};
        }
        if(chmin(dist[i][nv],np)){
          q.emplace(np,nv);
        }
      }
    }
  }
  
  rep(i,q){
    ll s=Q[i].first, t=Q[i].second;
    if(dist[s][t].first>=INF) cout<<-1<<endl;
    else cout<<dist[s][t].first<<endl;
  }
  
}

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

int main(){
   int n;
   cin >> n;
   int k = 0;
   int a[n];
   for(int i=0; i<n; i++){
     cin >> a[i];
     if(a[i]%2==0){
       if(a[i]%3==0 || a[i]%5==0){}
       else {k++;}
     }
   }
   if(k>0){cout << "DENIED" << endl;}
   else{cout << "APPROVED" << endl;}
}


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

int main(){
    int x;
    cin >> x;
    if(x>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

int main(){
	int n;
	cin>>n;
    vector <int>a(n);
    for(int i=0 ; i<n ; i++){
        cin>>a[i] ;
    }
	
	vector <int>b;
	if(n%2==0){
		for(int i=n-1 ; i>=0 ; i-=2){
			b.push_back(a[i]);
		}
		for(int i=0 ; i<n ; i+=2){
			b.push_back(a[i]);
		}
	}
	else if(n%2==1){
		for(int i=n-1 ; i>=0 ; i-=2){
			b.push_back(a[i]);
		}
		for(int i=1 ; i<n ; i+=2){
			b.push_back(a[i]);
		}
	}

	for(int i=0 ; i<n ; i++){
		cout<<b[i];
		if(i!=n-1)cout<<" ";
	}
	cout<<"\n";
	
	return 0;
}


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

using ll = long long;
using Field = vector<vector<ll>>;
using Graph = vector<vector<ll>>;
using VI = vector<int>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VC = vector<char>;
using PI = pair<int, int>;

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

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int n;
vector<int> s, l, p;
int m;
vector<int> w;

vector<int> dp(400, 0);

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

    cin >> n;
    s.resize(n + 1);
    l.resize(n + 1);
    p.resize(n + 1);
    REP(i, n) {
        cin >> s[i] >> l[i] >> p[i];
    }
    cin >> m;
    w.resize(m + 1);
    REP(i, m) {
        cin >> w[i];
    }

    dp[0] = 0;

    for (int i = 1; i < 400; i++) {
        for (int j = 0; j < n; j++) {
            chmax(dp[i], dp[i - 1]);
            if (i >= s[j]) {
                chmax(dp[i], dp[i - s[j]] + p[j]);
            }
        }
    }

    bool err = false;

    vector<int> ans(m + 1, 0);

    for (int i = 0; i < m; i++) {
        if (dp[w[i]] == 0) {
            err = true;
            break;
        } else {
            ans[i] = dp[w[i]];
        }
    }

    if (err) {
        cout << -1 << endl; return 0;
    }

    for(int i = 0; i < m; i++) {
        cout << ans[i] << endl;
    }





    return 0;
}


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

using namespace std;

namespace IntegerMath
{
  int64_t floor_div(int64_t x, int64_t y) {
    return static_cast<int64_t>(
      ::floorl(
        static_cast<long double>(x)
        /
        static_cast<long double>(y)
      )
    );
  }

  int64_t ceil_div(int64_t x, int64_t y) {
    return static_cast<int64_t>(
      ::ceill(
        static_cast<long double>(x)
        /
        static_cast<long double>(y)
      )
    );
  }

  int64_t sqrt(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::sqrtl( 
        static_cast<long double>(x)
      ) )
    );
  }

  int64_t log2(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::log2l( 
        static_cast<long double>(x)
      ) )
    );
  }    

  int64_t log10(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::log10l( 
        static_cast<long double>(x)
      ) )
    );
  }

  int64_t number_of_digits(int64_t x) {
    return static_cast<int64_t>(
      ::ceill( ::log10l( 
        static_cast<long double>(x + 1)
      ) )
    );
  }

  uint64_t gcd(uint64_t a, uint64_t b)
  {
    uint64_t n = std::min(a, b), m = std::max(a, b);
    return (n == 0) ? m : gcd(m % n, n);
  }

  uint64_t lcm(uint64_t a, uint64_t b)
  {
    uint64_t d = gcd(a, b);
    return (a % d == 0) ? (a / d) * b : a * (b / d);
  }
};

class Prime
{
private:
  std::set<uint64_t> _primes;

  bool _is_prmie(uint64_t n) const {
    uint64_t m = IntegerMath::sqrt(n);
    for (uint64_t d : _primes) {
      if (n % d == 0) { return false; }
      if (d > m) { break; }
    }
    return true;
  }

public:
  Prime(uint64_t n) {
    _primes.insert(2);

    for (uint64_t i = 3; i <= n; i += 2) {
      if (_is_prmie(i)) {
        _primes.insert(i);
      }
    }
  }

  std::set<uint64_t> set() const { return _primes; }
};

std::list<std::pair<uint64_t, uint64_t>> prime_division(uint64_t n)
{
  std::list<std::pair<uint64_t, uint64_t>> list;

  uint64_t m = IntegerMath::sqrt(n) + 1;

  for (uint64_t p : Prime(m).set()) {
    uint64_t e = 0;

    for (e = 0; n % p == 0; ++e) { n /= p; }

    if (e > 0) { list.emplace_back(p, e); }

    if (n == 1) { break; }
  }

  if (n > 1) { list.emplace_back(n, 1); }

  return list;
}

int main()
{
  uint64_t A, B;
  cin >> A >> B;
  
  uint64_t G = IntegerMath::gcd(A, B);
  
  cout << (prime_division(G).size() + 1) << endl;
  
  return 0;
}

Measured memory_bytes: 7552
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>

using namespace std;

int main(){
    int n;
    vector<vector<int>> a;
    bool c;
    int sum, max_ = 0;

    cin >> n;
    a.resize(2);
    generate(a.begin(), a.end(), [n](){ vector<int> b; b.resize(n); copy_n(istream_iterator<int>(cin), n, b.begin()); return b; });
    
    for(int i = 0; i < n; i++){
        sum = 0;
        c = false;
        for(int j = 0; j < n; j++){
            if(i == j){
                sum += a[0][j];
                c = true;
            }
            sum += a[ c ? 1 : 0 ][j];
        }
        if(max_< sum)
            max_ = sum;
    }
    cout << max_ << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
/*     cout << "S = " << s << endl;
    cout << "S[3] = " << s[3] << endl;
    cout << "length = " << s.length() << endl; */
    int odd_zero = 0;
    int odd_one = 0;
    int even_zero = 0;
    int even_one = 0;   
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '0') {  
            if (i % 2 == 0) {
                even_zero++;
            } else {
                odd_zero++;
            }
        } else {
            if (i % 2 == 0) {
                even_one++;
            } else {
                odd_one++;
            }
        }
    }
/*     cout << "odd_zero = " << odd_zero << endl;  //0
    cout << "odd_one = " << odd_one << endl;    //1
    cout << "even_zero = " << even_zero << endl; //2
    cout << "even_one = " << even_one << endl;  //3 */
 
    int odd_flag = 0;   
    if (odd_zero > odd_one) {
        odd_flag = 0;
    } else {
        odd_flag = 1;
    } 
    int even_flag = 0;
    if (even_zero > even_one) {
        even_flag = 0;
    } else {
        even_flag = 1;
    }
    int flag = 0;
    int max = odd_zero;
    if (odd_zero < odd_one) {
        flag = 1;
        max = odd_one;
    }
    if (max < even_zero) {
        flag = 2; 
        max = even_zero;
    }
    if (max < even_one) {
        flag = 3;
        max = even_one;
    }
    int sum = 0;
//    cout << "flag = " << flag << endl;
    switch (flag)
    {
    case 0:
        sum += odd_one + even_zero;
        break;
    case 1:
        sum += odd_zero + even_one;
        break;
    case 2:
        sum += even_one + odd_zero;
        break;
    case 3:
        sum += even_zero + odd_one;
        break;
    default:
        break;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        String checked = s + s.substring(0, p.length() - 1);
        String result = "No";
        if(checked.contains(p)) result="Yes";
        System.out.println(result);
    }
}



Measured memory_bytes: 26252
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;
int main(){
    int n,m,x,y;
    cin >> n >> m >> x >> y;
    vector<int> xl,yl;
    string ans = "War";
    int q;
    for(int i =0;i<n;i++){
        cin >> q;
        xl.push_back(q);
    }
    for(int i =0;i<m;i++){
        cin >> q;
        yl.push_back(q);
    }
    
    for(int j=-100;j<=100;j++){
       if(j>x && j<=y){
           for(int i =0;i<n;i++){
             if(j<=xl[i]){
                 break;
             }else if(i == n-1){
                 for(int k =0;k<m;k++){
                     if(j>yl[k]){
                       break;
                     }else if(k == m-1){
                       ans = "No War";
                       cout << ans << endl;
                       return 0;
                     }
           }
    }
    }
}
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>

const int MOD=1e9+7;

void addmod(int& x,int y){
  x=(x+y)%MOD;
}

int dp[100];
int tmp[100];

int main(){
  std::string K;
  int D;
  std::cin>>K>>D;
  int prefix=0;
  for(char c:K){
    for(int rem=0;rem<D;rem++){
      for(int d=0;d<10;d++){
	addmod(tmp[(rem+d)%D],dp[rem]);
      }
    }
    for(int rem=0;rem<D;rem++){
      dp[rem]=tmp[rem];
      tmp[rem]=0;
    }
    for(int d=0;d<c-'0';d++){
      addmod(dp[(prefix+d)%D],1);
    }
    prefix=(prefix+(c-'0'))%D;
  }
  printf("%d\n",(dp[0]+MOD-(prefix!=0))%MOD);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,Q,ans=1e9,a[2005];
priority_queue<int> q;
vector<int> q2;
void update(){
	while(!q.empty()){
		if(q.size()>=k)q2.push_back(-q.top());
		q.pop();
	}
}
int main(){
	scanf("%d%d%d",&n,&k,&Q);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(a[j]>=a[i])q.push(-a[j]);
			else update();
		}
		update();
		if(q2.size()>=1)sort(q2.begin(),q2.end());
		if(q2.size()>=Q&&q2[0]==a[i])ans=min(ans,q2[Q-1]-a[i]);
		q2.clear();
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3848
from sys import stdin
def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    b = [0] * (n + 1)
    for x in a:
        b[x] += 1
    m = max(a)
    l = 0
    r = m
    f = []
    while l <= r:
        b[r] -= 1
        if l < r:
            b[m-l] -= 1
        l += 1
        r -= 1
        if l <= r:
            f.append(max(m - l + 1, r + 1))
    for x in f:
        if b[x] > 0:
            b[x] = 0
    print "Possible" if all(not x for x in b) else "Impossible"
main()


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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  rep(i, N) {
    cin >> a.at(i);
  } 
  
  sort(a.rbegin(), a.rend());
  
  int A = 0, B = 0;
  rep(i, N) {
    if (i % 2 == 0) {
      A += a.at(i);
    }
    else {
     B += a.at(i);      
    } 
  }
  
  cout << A - B << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char s[100];
int main()
{
	int a,l;
	cin>>a;
	scanf("%s",s);
	l=strlen(s);
	if(l<=a)
	{
		printf("%s", s); 
	}
	else
	{
		for(int i=0;i<a;i++)
		printf("%c", s[i]);
		printf("...");
	}
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

int c;
string S, res;
stack<int>st;
bool B[26];

int main() {
	cin >> S;
	st.push(S.size());
	for (int i = S.size() - 1; i != -1; --i) {
		if (!B[S[i] - 'a']) {
			B[S[i] - 'a'] = true;
			++c;
			if (c == 26) {
				st.push(i);
				c = 0;
				memset(B, false, sizeof B);
			}
		}
	}
	memset(B, false, sizeof B);
	for (int i = 0; i != S.size(); ++i) {
		if (i == st.top()) {
			for (int j = 0; j != 26; ++j) {
				if (!B[j]) {
					res += j + 'a';
					break;
				}
			}
			memset(B, false, sizeof B);
			st.pop();
			while (i != S.size() && S[i] != res.back())
				++i;
			continue;
		}
		B[S[i] - 'a'] = true;
	}
	for (int j = 0; j != 26; ++j) {
		if (!B[j]) {
			res += j + 'a';
			break;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
main :: IO ()
main = do
  xs <- map read . words <$> getContents
  print $ solve xs

solve :: [Int] -> Int
solve xs = go 0 0 xs
  where
    go s p [] = s - p
    go s p (x:xs) = go (s + x1) (p `max` p1) xs
      where
       r = x `mod` 10
       p1 = if r == 0 then 0 else 10 - r
       x1 = x + p1

Measured memory_bytes: 508
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int main(){
	int n,a,b;
	bool flag;
	string number;
	map<string,int> info;
	vector<string> seq;
	
	while(cin >> n && n){
		info.clear();
		seq.clear();
		while(n--){
			cin >> number >> a >> b;
			if(!info[number])seq.push_back(number);
			while(b-- && info[number]<1000000){
				info[number] += a;
			}
		}
		flag = true;
		for(int i=0;i<seq.size();i++){
			if(info[seq[i]]>=1000000){
				flag = false;
				cout << seq[i] << endl;
			}
		}
		if(flag)cout << "NA" << endl;
	}
}

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

int main() {
 int n; cin >> n;
 vector<int> p(n); vector<bool> flag(n,0);
 ll cnt=0;
 rep(i,n){
 cin >> p[i];
 if(p[i]==i+1)flag[i]=1;
 }
 rep(i,n-1){
   if(flag[i]==1){
     cnt++;
     flag[i+1]=0;
   }
 }
 if(flag[n-1]==1)cnt++;

 cout << cnt << endl;

}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        long g=sc.nextInt();
        for (int i = 0; i < n-1; i++) {
			g=gcd(g,sc.nextInt());
		}

        out.println(g);
        out.flush();
    }
    static long gcd(long a, long b){
        if(min(a,b) == 0)return max(a,b);
        return gcd(max(a,b) % min(a,b),min(a,b));
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//        this.a=a;
//        this.b=b;
//    }
//    public int compareTo(P p){
//        return b-p.b; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 37372
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF (LL)(1LL<<60)
#define all(a) a.begin(), a.end()
#define gr greater<LL>()

using namespace std;

long long gcd(long long a, long long b) {
  long long _max = a > b ? a : b;
  long long _min = a > b ? b : a;
  if (!(_max%_min)) return _min;
  else return gcd(_min, _max%_min);
}
 
long long lcm(long long a, long long b) {
  return a/gcd(a,b)*b;
}


void solve(long long N, long long M, std::string S, std::string T){
    LL l1 = lcm(N, M);
    LL n = l1/N, m=l1/M;
    LL l2 = lcm(n, m);
    int i=0, j=0;
    while(i<N&&j<M){
        if(S[i] != T[j]){
            cout << -1 << endl;
            return;
        }
        i += l2/n;
        j += l2/m;
    }
    cout << l1 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(N, M, S, T);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;

int main(){
   int n; cin >> n;
   vector<int> a(n);
   REP(i,n) cin >> a[i];
   vector<int> rate(9,0);
   
   REP(i,n){
       if(a[i] < 400) ++rate[0];
       else if(a[i] < 800) ++rate[1];
       else if(a[i] < 1200) ++rate[2];
       else if(a[i] < 1600) ++rate[3];
       else if(a[i] < 2000) ++rate[4];
       else if(a[i] < 2400) ++rate[5];
       else if(a[i] < 2800) ++rate[6];
       else if(a[i] < 3200) ++rate[7];
       else ++rate[8];
   }
   int ans = 0;
   REP(i,8){
       if(rate[i] > 0) ++ans;
   }
   cout << max(ans,1) << " " << ans + rate[8] << endl;


}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
      
        int ans = 0;
        int max = 0;
        
        if (n >= 100000) {
          ans = 90909;
        }
		else if (n >= 10000) {
          ans += 909;
          ans += (n - 9999);
        } else if (n >= 1000) {
          ans = 909;
        }
        else if (n >= 100) {
          ans += 9;
          ans += (n - 99);
        } else if (n >= 10) {
          ans = 9;
        } else {
          ans = n;
        }
    
		// 出力
		System.out.println(ans);
	}
}


Measured memory_bytes: 22612
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

// calculate x%m for x "properly" for all x
long long int mod(long long int x, long long int m);

// calculate inverse of x in mod m
// if there is inverse of x   : return (inverse of x)
// if there is no inverse of x: return 0
long long int mod_inverse(long long int x, long long int m);

// calculate inverse of x in mod m for PRIME m
long long int mod_inverse_Fermat(long long int x, long long int m);

// calculate x^n mod m
long long int fast_power(long long int x, long long int n, long long int m);

// extended euclid gojjohou
long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y);



using ll = long long int;
using namespace std;

long long int MOD = 1e9+7;

int main(){

  ll N, K, tmp;
  cin >> N >> K;

  if(K == N+1){
    cout << 1 << endl;
    return 0;
  }

  ll factN1=1, factK, factN1K;
  for(ll i = 1; i <=N+1; i++){
    factN1 *= i;
    factN1 = (factN1 + MOD)%MOD;
    if(i == K){
      factK = factN1;
    }
    if(i == N+1-K){
      factN1K = factN1;
    }
  }

  ll ans = 0;
  for(ll i = K; i <= N+1; i++){
    ans += i*(N-i+1)+1;
    ans = (ans+MOD)%MOD;

  }

  cerr << "Answer:" << endl;
  cout << ans << endl;
  
  return 0;
  
}



long long int mod(long long int x, long long int m){
  if(x>0){
    return x%m;
  }
  else if(x==0){
    return 0;
  }
  else if((-x)%m == 0){
    return 0;
  }
  else{
    return m - (-x)%m;
  }
}


long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y){
  long long int d = a;
  if(b != 0){
    d = euclid_extended(b, a%b, y, x);
    y -= (a/b)*x;
  }
  else{
    x = 1;
    y = 0;
  }
  
  return d;
}

long long int mod_inverse(long long int x, long long int m){
  long long int tmp, x_inv, gcd_xm;
  gcd_xm = euclid_extended(x, m, x_inv, tmp);
  // if the inverse is calculate properly
  if(gcd_xm == 1){
    return mod(x_inv, m);
  }
  else{
    //std::cerr << "Error in mod_inverse: there is no inverse of x in mod m" << std::endl;
    return 0;
  }
}

long long int mod_inverse_Fermat(long long int x, long long int m){
  return fast_power(x, m-2, m);
}

long long int fast_power(long long int x, long long int n, long long int m){
  long long int ans = 1;
  
  while(n > 0){
    if(n&1){
      ans = ans * x;
      ans = mod(ans, m);
    }
    x = x*x;
    x = mod(x, m);
    n = n>>1;
  }
  
  return ans;
}


Measured memory_bytes: 3628