akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

// int selectionSort(int A[], int N) {
//     int minj, tmp, sw = 0;
//     for(int i = 0; i < N; i++) {
//         minj = i;
//         for(int j = i; j < N; j++) {
//             if(A[minj] > A[j]) {
//                 minj = j;
//             }
//         }
//         tmp = A[i]; A[i] = A[minj]; A[minj] = tmp;
//         if(minj != i) sw++;
//     }
//     return sw;
// }

// int main() {
//     int A[100], N, sw;

//     scanf("%d", &N);
//     for(int i = 0; i < N; i++) scanf("%d", &A[i]);

//     sw = selectionSort(A, N);

//     for(int i = 0; i < N; i++) {
//         if(i > 0) printf(" ");
//         printf("%d", A[i]);
//     }

//     printf("\n");
//     printf("%d\n", sw);

//     return 0;
// }

int selectionSort(int A[], int N) {
    int sw = 0;
    for(int i = 0; i < N; i++) {
        int minj = i;
        for(int j = i; j < N; j++) {
            if(A[minj] > A[j]) minj = j;
        }
        int tmp;
        if(minj != i) {
            tmp = A[minj]; A[minj] = A[i]; A[i] = tmp;
            sw++;
        }
    }
    return sw;
}

int main() {
    int N;
    int A[100];
    scanf("%d", &N);
    for(int i = 0; i < N; i++) scanf("%d", &A[i]);
    int sw = selectionSort(A, N);
    for(int i = 0; i < N; i++) {
        if(i != 0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
    printf("%d\n", sw);
    return 0;
}



Measured memory_bytes: 2724
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int a;
int main() {
	//freopen("1.txt","r",stdin);
	read(a);
	printf("%d\n",a+a*a+a*a*a);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 3660
#include <iostream>
using namespace std;
int main(void){
    int S;
    cin >>   S;
    int top = S / 100;
    int bot = S % 100;
    int frag_y = 0;
    int frag_m = 0;
    //YYMM
    if (bot > 0 && bot <=12) 
        frag_y = 1;
    //MMYY
    if (top > 0 && top <=12)
        frag_m = 1;
    
    if (frag_y == 1)
        frag_m==1 ? cout << "AMBIGUOUS" : cout << "YYMM";
    
    else
        frag_m==1 ? cout << "MMYY" : cout << "NA";
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,p; int h=0;
    scanf("%lld",&n);
    for(int i=sqrt(n);i>0;i--)
    {
        if(n%i==0)
        {
          p=n/i;
          break;
        }
    }
    while(p>=1)
    {
        h++;
        p=p/10;
    }
    printf("%lld\n",h);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define MAXN 40
#define MAXX 10
#define INF 1000000
using namespace std;

int dp[MAXN + 1][MAXX * MAXN + 1][MAXX * MAXN + 1];
int a[MAXN], b[MAXN], c[MAXN];
int n, ma, mb, ans;

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

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

    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= MAXX * MAXN; j++)
            for(int k = 0; k <= MAXX * MAXN; k++)
                    dp[i][j][k] = INF;

    dp[0][0][0] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= MAXX * MAXN; j++) {
            for(int k = 0; k <= MAXX * MAXN; k++) {
                if(dp[i][j][k] == INF)  continue;
                dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
                dp[i+1][j+a[i]][k+b[i]] = min(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
            }
        }
    }

    ans = INF;
    for(int i = 1; i <= MAXX * MAXN; i++) {
        for(int j = 1; j <= MAXX * MAXN; j++) {
            if(i * mb == j * ma)
                ans = min(ans, dp[n][i][j]);
        }
    }
    if(ans == INF)  ans = -1;
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 25856
N = int(input())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
alice = 0
bob = 0
i = 0
while i < len(a):
    alice += a[i]
    i += 1
    if i >= len(a):
        break
    bob += a[i]
    i += 1
print(alice - bob)

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>
#define all(a) a.begin(),a.end()
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<ll, ll> > a, b;
    for(int i=0; i<n; ++i){
        int x, y;
        cin >> x >> y;
        a.push_back({x, y});
    }
    for(int i=0; i<m; ++i){
        int x, y;
        cin >> x >> y;
        b.push_back({x, y});
    }
    
    for(ll i=0; i<n; ++i){
        pair<ll, ll> ans = {INT_MAX, 0};
        for(ll j=0; j<m; ++j){
            ans = min(ans, {abs(a[i].first-b[j].first) + abs(a[i].second-b[j].second), j});
        }
        cout << ans.second+1 << endl;
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    cin>>n;
    if(n<1200){
        cout<<"ABC"<<endl;

    }else if(n<2800){
        cout<<"ARC"<<endl;

    }else{
        cout<<"AGC"<<endl;

    }
    return  0;
}


Measured memory_bytes: 256
n, h = map(int, input().split())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

B = sorted(B, reverse=True)
a_max = max(A)

bigger = [x for x in B if x >= a_max]
throw_b = len(bigger)

throw = 0
check = 0

while check == 0:
    if throw >= throw_b:
        break
    h = h - B[throw]
    throw += 1
    if h <= 0:
        break

if h <= 0:
    ans = throw
else:
    ans = throw + -(-h//max(A))

print(ans)

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

int main() {
  int N;
  cin >> N;
  int A,c,minc;
  for (int i=0;i<N;i++){
    cin >> A;
    c=0;
    while (A%2==0){
      A/=2;
      c++;
    }
    if (i==0 || minc > c)
      minc=c;
  }
  cout << minc << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		if(R-L > 673) {
			System.out.println(0);
			return;
		}
		L %= 2019;
		R %= 2019;
		if(L >= R)
			R += 2019;
		int ans = 2018;
		for(int i = L; i < R; i++)
			for(int j = i+1; j <= R; j++)
				ans = Math.min(ans, i * j % 2019);
		System.out.println(ans);
	}

}


Measured memory_bytes: 25044
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
    long long K,N,D,cnt=0;
    char s;
    cin >> N;
    long long j=N-1;
    vector<char>c(N);
    for(int i=0;i<N;i++){
        cin >> c[i];
    }
    for(int i=0;i<N;i++){
        if(c[i]=='W'){
            for(j;j>-1;j--){
                if(c[j]=='R'){
                    s=c[j];
                    c[j]=c[i];
                    c[i]=s;
                    cnt++;
                    break;
                }
                if(i==j){
                    break;
                }
            }
        }
        if(i==j){
            break;
        }
    }
    cout << cnt;
}

Measured memory_bytes: 3576
N,M = map(int,input().split())
X = list(map(int,input().split()))
D = [0]*(M-1)
if N>=M:
	print(0)
else:
	X.sort()
	ans = X[M-1]-X[0]
	for i in range(M-1):
		D[i] = X[i+1]-X[i]
	D.sort()
	D.reverse()
	for i in range(N-1):
		ans -= D[i]
	print(ans)

Measured memory_bytes: 13968
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    string s;
    cin >> s;
    map<char,int> mp;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
    }
    bool flg=true;
    for(auto p:mp){
        if(p.second%2==1) flg=false;
    }
    puts(flg?"Yes":"No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,i;
    cin>>n;
    int l,sum=0,mx=0;
    for (i=0;i<n;i++)
    {
        cin>>l;
        sum+=l;
        mx=max(l,mx);
    }
    if (sum-mx>mx)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define mprint(x) printf(FORMATCONVERSION(x),(x))
#define FORMATCONVERSION(x) _Generic((x),\
                                    int:"%d",unsigned int:"%u",\
                                    double:"%lf",long long int:"%lld",\
                                    unsigned long long int:"%llu",\
                                    char :"%c",char*:"%s")

#define mswap(x,y) _Generic((x),int:swap_int,unsigned int:swap_uint,\
                            long long:swap_ll,unsigned long long:swap_ull)(&(x),&(y))

void swap_int(int *a,int *b){int tmp = *a;*a = *b;*b= tmp;return;}
void swap_uint(unsigned int *a,unsigned int *b){unsigned int tmp = *a;*a = *b;*b= tmp;return;}
void swap_ll(long long *a,long long *b){long long tmp = *a;*a = *b;*b= tmp;return;}
void swap_ull(unsigned long long *a,unsigned long long *b){unsigned long long tmp = *a;*a = *b;*b= tmp;return;}

int main(void){
    int h,a;
    scanf("%d %d",&h,&a);
    int ans;
    if(h % a == 0){
        ans = h / a;
    }else{
        ans = h / a;
        ++ans;
    }
    mprint(ans);
    return 0;
}

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

int main() {
	long long n;
	cin >> n;
	long long x;
	long long arr[n+1]={};
	for(int i=0;i<n-1;i++){
	    cin >> x;
	    arr[x]++;
	}
	for(int i=1;i<=n;i++){
	    cout << arr[i] << endl;
	}
}


Measured memory_bytes: 5144
#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];
    sort(a.begin(), a.end(), greater<int>());
    int alice = 0, bob = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0) alice += a[i];
        else bob += a[i];
    }
    cout << alice - bob << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
long long min(long long a, long long b){
  if(a>b) return b;
  else return a;
}

int main(void){
  int n,k;
  long long h[100005],dp[100005]={0};
  scanf("%d",&n);
  scanf("%d",&k);
  for(int i=1;i<=n;i++) scanf("%lld",&h[i]);
  for(int i=2;i<n+1;i++){
     dp[i]=dp[i-1]+fabs(h[i]-h[i-1]);
     for(int j=2;j<k+1;j++){
       if(i>j) dp[i]=min(dp[i],dp[i-j]+fabs(h[i]-h[i-j]));

     }
  }
  printf("%lld",dp[n]);
  return 0;
}

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

int main(){
    int D;
    cin >> D;
    vector<int> c(27, 0);
    rep(j, 26) cin >> c[j+1];
    int s[D+1][27];
    rep(i, D) rep(j, 26) cin >> s[i+1][j+1];
    vector<int> t(D+1, 0);
    rep(i, D) cin >> t[i+1];

    int M;
    cin >> M;
    vector<int> d(M+1, 0);
    vector<int> q(M+1, 0);
    rep(i, M) cin >> d[i+1] >> q[i+1];

    ll ans = 0;
    vector<int> lastday(27, 0);

    for(int day = 1; day <= D; day++){
        ans += s[day][t[day]];
        lastday[t[day]] = day;
        for(int j = 1; j <= 26; j++){
            ans -= c[j] * (day - lastday[j]); 
        }
    }

    for(int que = 1; que <= M; que++){
        ans -= s[d[que]][t[d[que]]];
        ans += s[d[que]][q[que]];

        int before = 0;
        for(int pos = d[que] - 1; pos >= 1; pos--){
            if (t[pos] == t[d[que]]){
                before = pos;
                break;
            }
        }
        int after = D+1;
        for(int pos = d[que] + 1; pos <= D; pos++){
            if (t[pos] == t[d[que]]){
                after = pos;
                break;
            }
        }
        ans += c[t[d[que]]] * (after - d[que]) * (before - d[que]);

        before = 0;
        for(int pos = d[que] - 1; pos >= 1; pos--){
            if (t[pos] == q[que]){
                before = pos;
                break;
            }
        }
        after = D+1;
        for(int pos = d[que] + 1; pos <= D; pos++){
            if (t[pos] == q[que]){
                after = pos;
                break;
            }
        }
        ans -= c[q[que]] * (after - d[que]) * (before - d[que]);

        t[d[que]] = q[que];
        cout << ans << endl;
    }

    return 0;
}

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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    // 後ろから解くかわりにすべての文字列を「左右反転」する
    reverse(S.begin(), S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

    // 端から切っていく
    bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false; // 4 個の文字列たちどれかで divide できるか
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) { // d で divide できるか
                can2 = true;
                i += d.size(); // divide できたら i を進める
              	break;
            }
        }
        if (!can2) { // divide できなかったら
            can = false;
            break;
        }
    }

    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

typedef long long ll;

const double eps = 0.00001;
const int MOD = 1000000007;
const int INF = 2147480555;
const ll LINF = 2223372000000000555;
const int N = 1550555;
const int M = 525;

string s[N];
int t[N];
void solve() {
    int n;
    cin >> n;

    for (int i = 1; i <= n; i++){
        cin >> s[i] >> t[i];
    }

    string str;
    cin >> str;

    bool ok = false;
    ll sum = 0;
    for (int i = 1; i <= n; i++){
        if (ok) sum += t[i];
        if (s[i] == str) ok = true;
    }

    cout << sum;

}


int main() {
    ios_base::sync_with_stdio(false);
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 52064
package main

import (
	"bytes"
	"fmt"
)

func main() {
	var s string
	var q int
	fmt.Scanf("%s", &s)
	fmt.Scanf("%d", &q)
	answer := createString(s, q)
	fmt.Println(answer)
}

func createString(s string, q int) string {
	isReversed := false
	var preStr bytes.Buffer
	var postStr bytes.Buffer
	for i := 0; i < q; i++ {
		var t int
		fmt.Scanf("%d", &t)
		if t == 1 {
			isReversed = !isReversed
		} else { // t == 2
			var f int
			var c string
			fmt.Scanf("%d %s", &f, &c)

			if (f == 1 && !isReversed) || (f == 2 && isReversed) {
				preStr.WriteString(c)
			} else {
				postStr.WriteString(c)
			}
		}
	}
	// fmt.Println("pre", preStr.String(), "post", postStr.String())
	var str bytes.Buffer
	str.WriteString(reverse(preStr.String()))
	str.WriteString(s)
	str.WriteString(postStr.String())
	if isReversed {
		return reverse(str.String())
	}
	return str.String()
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


Measured memory_bytes: 7572
#include <bits/stdc++.h>
        #include<iostream>
        #include<cstdio>
        #include<vector>
        #include<queue>
        #include<map>
        #include<cstring>
        #include<string>
        #include <math.h>
        #include<algorithm>
        #include<functional>
   //    #define int long long
        #define inf  1000000007
        #define pa pair<int,int>
#define ll long long
        #define pal pair<ll,ll>
        #define ppa pair<int,pa>
        #define EPS (1e-10)
        #define equals(a,b) (fabs((a)-(b))<EPS)

        using namespace std;

        class Point{
        	public:
        	double x,y;
        	Point(double x=0,double y=0):x(x),y(y) {}
        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
        	Point operator * (double a) {return Point(x*a,y*a);}
        	Point operator / (double a) {return Point(x/a,y/a);}
        	double absv() {return sqrt(norm());}
        	double norm() {return x*x+y*y;}
        	bool operator < (const Point &p) const{
        		return x != p.x ? x<p.x: y<p.y;
        	}
        	bool operator == (const Point &p) const{
        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
        	}
        };
        typedef Point Vector;

        struct Segment{
        Point p1,p2;
        };

    double hen(Vector a){
    if(fabs(a.x)<EPS && a.y>0) return acos(0);
    else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
    else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
    else if(fabs(a.y)<EPS && a.x>0) return 0.0;
    else if(a.y>0) return acos(a.x/a.absv());
    else return 2*acos(0)+acos(-a.x/a.absv());

    }

        double dot(Vector a,Vector b){
        	return a.x*b.x+a.y*b.y;
        }
        double cross(Vector a,Vector b){
        	return a.x*b.y-a.y*b.x;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        //----------------kokomade temple------------
/*        
        int par[100100],ranks[100100],kosuu[100100];     

void shoki(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		ranks[i]=0;
		kosuu[i]=1;
	}
}

int root(int x){
	return par[x]==x ? x : par[x]=root(par[x]);
}

bool same(int x,int y){
return root(x)==root(y);
}

void unite(int x,int y){
 x=root(x);
 y=root(y);
 if(x==y) return;
	if(ranks[x]<ranks[y]){
		par[x]=y;
		kosuu[y]+=kosuu[x];
	}
 else {
	par[y]=x;
 	kosuu[x]+=kosuu[y];
	if(ranks[x]==ranks[y]) ranks[x]=ranks[x]+1;
 }
}

int kazu(int x){
	return kosuu[root(x)];
}
*/


int a[30][100030]={0};

signed main(){
int n,m;
string s;
	cin>>s;
	char c,d;
	c='Z',d='Z';
	int ss=-1,tt=-1;
	for(int i=0;i<s.length();i++){
		char r=s[i];
		if(r==c) {
			ss=i-1;
			tt=i+1;
			goto lll;
		}
		else if(r==d){
ss=i;
			tt=i+1;
			goto lll;
			}
		
		c=d;
		d=r;
	}
	
	lll:;
	/*
	
	for(int j=0;j<26;j++){
		for(int i=1;i<100020;i++){
			a[j][i] += a[j][i-1];
		}
		
	}
	*/
	/*
	int l=s.length();
	int ss=-1,tt=-1;
	for(int i=1;i<l;i++){
		for(int j=i+1;j<=l;j++){
			for(int k=0;k<26;k++){
				if(a[k][j]-a[k][i-1]>= (j-i+1)/2+1){
					ss=i;
					tt=j;
				}
			}
		
		
		}
		
		
	}
	
	*/
cout<<ss<<" "<<tt<<endl;
	
	return 0;
        }


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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int N;

int main(){
	cin.tie(0);
	
	cin>>N;
	
	int r = 0;
	
	if(N>=105)r++;
	if(N>=135)r++;
	if(N>=165)r++;
	if(N>=189)r++;
	if(N>=195)r++;
	
	cout<<r<<endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String args[]){

    Scanner scan = new Scanner(System.in);

    int n = scan.nextInt();
    //String n2 = scan.next();
    String s = scan.next();

    /*System.out.println(s);
    System.out.println(n2);*/

    if (s.length() <= n) {
        System.out.println(s);
    } else {
        String s2 = s.substring(0, n);
        System.out.println(s2+"...");
    }


      scan.close();
    }
  }

Measured memory_bytes: 38656
import java.util.Scanner;

public class Main {
	static int INF = Integer.MAX_VALUE / 2;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] adj = new int[2][N];

		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < N; j++) {
				adj[i][j] = sc.nextInt();
			}
		}
		System.out.println(dfs(adj, 0, 0, N));
	}

	static int dfs(int[][] adj, int i, int j, int N) {
		if(i == 1 && j >= N - 1) return adj[i][j];

		if(i == 1 && j < N-1) {
			return adj[i][j] + dfs(adj, i, j+1, N);
		} else if(i==0 && j >= N-1) {
			return adj[i][j] + dfs(adj, i+1, j, N);
		} else {
			return adj[i][j] + Math.max(dfs(adj, i+1, j, N), dfs(adj, i, j+1, N));
		}
	}
}

Measured memory_bytes: 23636
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
g=int(input())
h=int(input())
i=int(input())
j=int(input())
k=int(input())
l=int(input())
m=int(input())
n=int(input())
o=int(input())
p=int(input())
q=int(input())
r=int(input())
s=int(input())
t=int(input())

x = (a,b,c,d,e,f,g,h,i,j)
y = (k,l,m,n,o,p,q,r,s,t)
z = sorted(x)
w = sorted(y)

print(sum(z[7:]),sum(w[7:]))


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

int main(void)
{
  char str[1000000];
  int i=0,j;

  gets(str);
  for(j=0;j<strlen(str);j++)
    str[j]=toupper(str[j]);

  printf("%s\n",str);
  return 0;
}

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

int main() {
  int x;
  cin >> x;
  int ans;

  if (x < 600) {
    ans = 8;
  } else if (x < 800) {
    ans = 7;
  } else if (x < 1000) {
    ans = 6;
  } else if (x < 1200) {
    ans = 5;
  } else if (x < 1400) {
    ans = 4;
  } else if (x < 1600) {
    ans = 3;
  } else if (x < 1800) {
    ans = 2;
  } else if (x < 2000) {
    ans = 1;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;
string s2;
string t;

void solve();
int main(){
  cin >> s2;
  cin >> t;

  solve();
}

void solve(){
  int lent = t.size();
  int lens = s2.size();
  string t_;
  for(int i=0;i<lent;i++){
    t_=t_ + "?";
  }
  
  if(lens<lent){
    printf("UNRESTORABLE\n");
    return ;
  }
  for(int i=0;i<lens - lent +1;i++){
    bool tx = true;
    for(int j=0;j<lent;j++){
      string sub = s2.substr(lens-lent-i+j,1);
      string subt = t.substr(j,1);
      string hatenat = t_.substr(j,1);
      if(sub.compare(subt) && sub.compare(hatenat)){
        tx=false;
      }
    }
    if(tx){
      s2.replace(lens-lent-i,lent,t);
      break;
    }
    if(i==lens-lent){
      printf("UNRESTORABLE\n");
      return ;
    }
  }

  for(int i=0;i<lens;i++){
    string hatena="?";
    if(!s2.substr(i,1).compare(hatena)){
      string a = "a";
      s2.replace(i,1,a);
    }
  }
  cout << s2 << endl;
  return;
}

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

int main()
{
    int ar[5], i;
    for(i=0; i<5; i++){
        scanf("%d",&ar[i]);
    }

    for(int j=0;j<5; j++){
        if(ar[j]==0){
            printf("%d\n",j+1);
        }
    }
    return 0;
}


Measured memory_bytes: 3756
#include<stdio.h>
int main(void)
{
	int a,s,i,k,g;
	scanf("%d",&a);
	while(a!=0){
	k=0;
	g=0;
		for(i=1;i<=a;i++){
			scanf("%d",&s);
			if(s>=1){
				k++;
			}
			g=s+g;
			}
			if(k==g){
				printf("NA\n");
			}
			else{
				printf("%d\n",k+1);
			}
		scanf("%d",&a);
	}
	return 0;
}

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

#define ALL(obj) (obj).begin(), (obj).end()
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,b) for(int i=a; i<=b; i++)
using ll = long long;
#define pb push_back
class Position {
  public: 
    int x;
    int y;
    Position(int y, int x) {
      this->x = x;
      this->y = y;
    }
    Position(const Position& co) {
      this->x = co.x;
      this->y = co.y;
    }
    Position() {
      this->x = 0;
      this->y = 0;
    }
    bool equal(Position &a) {
      if ( (this->x == a.x) && (this->y == a.y) )
        return true;
      else 
        return false;
    }
};


const int MOD = (int) 1e9 + 7;
const double EPS = 1e-9;
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


int main()
{
  int N;
  cin >> N;
  vector<int> l(2*N);
  rep(i,2*N) cin >> l[i];
  sort(ALL(l));
  int ans = 0;

  for(int i=2*N-2; i>=0; i-=2) {
    ans += l[i];
  }
  cout << ans << endl;
}

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

using namespace std;

class Dice
{
public:
	enum FACE
	{
		eTop = 0,
		eFront,
		eRight,
		eLeft,
		eBack,
		eBottom,
		eFACEMax
	};

	Dice(int v[6])
	{
		for (int i = eTop; i < eFACEMax; i++)
		{
			DV[i] = v[i];
		}
	}

	void ComE()
	{
		int		top = DV[eTop];

		DV[eTop] = DV[eLeft];
		DV[eLeft] = DV[eBottom];
		DV[eBottom] = DV[eRight];
		DV[eRight] = top;
	}

	void ComW()
	{
		int		top = DV[eTop];

		DV[eTop] = DV[eRight];
		DV[eRight] = DV[eBottom];
		DV[eBottom] = DV[eLeft];
		DV[eLeft] = top;
	}

	void ComN()
	{
		int		top = DV[eTop];

		DV[eTop] = DV[eFront];
		DV[eFront] = DV[eBottom];
		DV[eBottom] = DV[eBack];
		DV[eBack] = top;
	}

	void ComS()
	{
		int		top = DV[eTop];

		DV[eTop] = DV[eBack];
		DV[eBack] = DV[eBottom];
		DV[eBottom] = DV[eFront];
		DV[eFront] = top;
	}

	int		GetDV(FACE face)
	{
		return (DV[face]);
	}

private:
	int		DV[eFACEMax];
};

int main()
{
	int v[Dice::eFACEMax];

	cin >> v[Dice::eTop] >> v[Dice::eFront] >> v[Dice::eRight] >> v[Dice::eLeft]>> v[Dice::eBack] >> v[Dice::eBottom];
	cin.ignore();

	Dice	d(v);
	string	str;

	getline(cin, str);
	for (auto it : str)
	{
		switch (it)
		{
		case 'S':
		case 's':
			d.ComS();
			break;
		case 'N':
		case 'n':
			d.ComN();
			break;
		case 'E':
		case 'e':
			d.ComE();
			break;
		case 'W':
		case 'w':
			d.ComW();
			break;
		default:
			break;
		}
	}

	cout << d.GetDV(Dice::eTop) << "\n";

	return 0;
}

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

int main(){
	int n, num, num_i;
	int max1, max2;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	
	max1 = *max_element(a.begin(), a.end());
	for(int i = 0; i < n; i++){
		if(a[i] == max1){
			num = a[i];
			num_i = i;
			a[i] = 0;
			break;
		}
	}
	max2 = *max_element(a.begin(), a.end());
	a[num_i] = num;
	
	for(int i = 0; i < n; i++){
		cout << (a[i] == max1 ? max2 : max1) << endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}

	#define MAX_V 200000

	vector<pair<ll, ll>> G[MAX_V];

	void dfs(int s, vector<ll>& value) {
		rep(i, (int)G[s].size()) {
			int next = G[s][i].first;
			value[next] += value[s];
			dfs(next, value);
		}
	}
}

int main() {

	int n, q;
	cin >> n >> q;
	vector<int> a(n), b(n);
	rep(i, n - 1) {
		cin >> a[i] >> b[i];
		G[a[i] - 1].push_back({ b[i] -1, 0});
	}
	vector<int> p(q), x(q);
	rep(i, q) cin >> p[i] >> x[i];
	vector<ll> value(n, 0);
	// とりあえず各頂点に足す
	rep(i, q) {
		value[p[i] - 1] += x[i];
	}

	dfs(0, value);
	rep(i, n) {
		cout << value[i] << " ";
	}
	cout << endl;


	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007


typedef long long ll;
typedef pair<ll,ll> P;

int main()
{
	string str;
	cin >> str;
	
	if(str.size() < 3){
		cout << "NO" << endl;
		return 0;
	}
	for(int i = 0;i < str.size()-1;i++){
		if(str[i] == 'A' && str[i+1] == 'A'){
			cout << "NO" << endl;
			return 0;
		}
	}
	bool flag = false;
	for(int i = 0;i < str.size() - 2;i++){
		if(str[i] == 'K' && str[i+1] == 'I' && str[i+2] == 'H'){
			flag = true;
		}
	}
	
	string tmp = "";
	
	for(int i = 0;i < str.size();i++){
		if(str[i] != 'A'){
			tmp += str[i];
		}
	}
	
	if(tmp == "KIHBR" && flag){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	
	return 0;
}

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

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
#define EPS = 1e-14;
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::max;
using std::min;
using std::swap;
using std::string;
using std::fill;
using std::pair;
using std::sort;
using std::reverse;
using std::pair;
using std::greater;
using std::priority_queue;
using std::ostream;

template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i] << endl;
	}
	return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last) {
			out << ",";
		}
	}
	out << "]";
	return out;
}

struct edge {
	int from, to, cost;
	edge() {
		*this = edge(-1, -1, -1);
	}
	edge(int from_, int to_, int cost_) {
		from = from_;
		to = to_;
		cost = cost_;
	}
	bool operator<(const edge& e) const {
		return cost < e.cost;
	}
};

string alp = "abcdefghijklmnopqrstuvwxyz";
string s;
void solve() {
	cin >> s;
	rep(i,0,(int)s.size())
	{
		if (alp[s[i] - 'a'] == '.') {
			cout << "no" << endl;
			return;
		} else {
			alp[s[i] - 'a'] = '.';
		}
	}
	cout << "yes" << endl;
}

int main() {
	solve();
}


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

using namespace std;

int main(){
  int N;
  cin >> N;

  if(N < 2)
    cout << "1" << endl;

  else if(2<=N && N<4)
    cout << "2" << endl;

  else if(4<=N && N<8)
    cout << "4" << endl;

  else if(8<=N && N<16)
    cout << "8" << endl;

  else if(16<=N && N<32)
    cout << "16" << endl;

  else if(32<=N && N<64)
    cout << "32" << endl;

  else
    cout << "64" << endl;
}


Measured memory_bytes: 256
(defun main ()
  (let* ((n (read))
         (a* (loop :repeat n :collect (read))))
    (loop :with i := 1 :and count := 0
          :for a :in a*
          :do (if (= a i)
                  (incf i)
                  (incf count))
          :finally (format t "~A~%" (if (= count n)
                                        -1
                                        count)))))

(main)


Measured memory_bytes: 61800
#include <bits/stdc++.h>
using namespace std;
// Macros for easier access
#define ll long long
#define endl '\n'
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define test ll cases; cin>>cases; for(ll testCase = 1; testCase <= cases; testCase++)
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define precise fixed<<setprecision(50)
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define get(a, n)    for(ll it = 0; it < n; it++)    cin>>a[it];
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug(x) cerr << #x << " : " << (x) << endl
// Constants
#define MX 100001
#define mod 1000000007LL
#define inf 1000000000000000000LL
void init(){
	boost;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

int main(){
	init();
	ll n, x;	cin>>n;	ll a[n] = {0};
	for(ll i = 1; i < n; i++){
		cin>>x;	a[x-1]++;
	}
	for(auto x : a)	cout<<x<<endl;
}

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

const int MAX = 2100;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    long long N, K; cin >> N >> K;    
    COMinit();
    for (int i = 1; i <= K; i++)
    {
        cout << (COM(K-1,i-1) * COM(N-K+1, i))%MOD << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#include <iomanip>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int N,K;
	cin >> N >> K;
	double sum=0;
	double tmp;
	rep(i,1,N+1){
		int count=0;
		tmp = i;
		while(tmp<K){
			tmp *= 2;
			count++;
		}
		int j=0;
		double tmp1=1;
		while(j != count){
			tmp1 = tmp1*0.5;
			j++;
		}
		sum += (double)(1.0/N)*tmp1;
	}
	cout << setprecision(10) << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

  string S;
  cin >> S;
  
  int ans = 0;
  
  if(S == "AAA" || S == "BBB"){

    cout <<"No"<<endl;
    
  }else{

    cout << "Yes" <<endl;
  }
}
  
  

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

int main(void){
    double a,b;
    cin >> a >> b;
    
    for(double n = 10*b;n<10*b+10;n+=1){
        if(a<=0.08*n && 0.08*n<a+1){
            cout << n << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
void main() {
  problem();
}

void problem() {
  const S = scan;
  auto N = S.length;

  long solve() {
    if (N < 4) return 0;
    
    const P = 2019;
    long ans;

    auto cs = new long[](P);
    cs[0] = 1;

    long x, t = 1;
    foreach_reverse (c; S) {
        x = ((c-'0').to!long * t + x) % P;
        t = (t * 10) % P;
        ans += cs[x];
        ++cs[x];
    }
    return ans;
  }

  long solve2() {
    const MOD = 2019;
    auto countsPerMod = new long[MOD];
    long answer;

    countsPerMod[0] = 1;
    long acc;

    foreach(i, c; S) {
      const number = c - '0';
      
      auto newCountsPerMod = new long[MOD];
      foreach(m; 0..MOD) {
        newCountsPerMod[(10 * m) % MOD] += countsPerMod[m];
      }
      
      acc = (acc * 10 + number) % MOD;
      answer += newCountsPerMod[acc];
      newCountsPerMod[acc]++;

      countsPerMod = newCountsPerMod;
    }

    return answer;
  }

  solve2().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
import std.bigint, std.functional;

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


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

using namespace std;

using ll = long long;

ll judge(ll n) {
    ll ng = 0, ok = 10000000;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        if (mid * (mid - 1) >= 2 * n) ok = mid;
        else ng = mid;
    }
    if (ok * (ok - 1) == 2 * n) return ok;
    else return -1;
}

void solve(ll n, ll k) {
    ll cur = 1;
    vector< vector<ll> > ans(k);
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < i; j++) {
            ans[i].push_back(cur);
            ans[j].push_back(cur);
            cur++;
        }
    }

    cout << k << endl;
    for (int i = 0; i < k; i++) {
        cout << ans[i].size();
        for (ll x : ans[i]) {
            cout << " " << x;
        }
        cout << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll k = judge(n);
    if (k != -1) {
        cout << "Yes" << endl;
        solve(n, k);
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
import java.util.*;
import java.io.*;
//import java.util.stream.Stream;
import static java.lang.Math.*;

public class Main {
	Scanner cin;

	void init() throws Exception {
		cin = new Scanner(new BufferedInputStream(System.in));
//		cin = new Scanner(new File("in.txt"));
//		System.setOut(new PrintStream(new File("out.txt")));
		solve();
	}

	void solve() {
		int N = cin.nextInt();
		int T = cin.nextInt();
		int[] t = new int[N];
		int cnt = 0;
		t[0] = cin.nextInt();
		for (int i=1;i<N;i++){
			t[i] = cin.nextInt();
			cnt += min(t[i]-t[i-1], T);
		}
		cnt += T;
		System.out.println(cnt);
	}

	public static void main(String[] args) throws Exception {
		Main M = new Main();
		M.init();
	}

}


Measured memory_bytes: 80892
#include <bits/stdc++.h>
using namespace std;using v=vector<int>;int n;int h(v a,v b){int r=1;for(int i=0;i<n;i++)r&=a[i]!=b[i];return r;}int f(int g,v a){cout<<(g?"Yes\n":"No\n");if(g)for(int e:a)cout<<e<<'\n';exit(0);}int main(){cin>>n;v a(n),b(n),c;for(int&e:a)cin>>e;for(int&e:b)cin>>e;c=b;reverse(begin(b),end(b));rotate(begin(c),begin(c)+n/2,end(c));if(h(a,b))f(1,b);if(h(a,c))f(1,c);f(0,a);}

Measured memory_bytes: 7224
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int n;
cin>>n;
vector<int>in;
vector<int>no;
rep(i,n){
int a,b;
cin>>a>>b;
pb(in,b);
pb(no,a);
}
rep(i,100*n){
rep(j,n-1){
if(in[j]<in[j+1]){swap(in[j],in[j+1]);swap(no[j],no[j+1]);}
if(in[j]==in[j+1]&&no[j]>no[j+1])swap(no[j],no[j+1]);
}
}
cout<<no[0]<<" "<<in[0]<<endl;
}

Measured memory_bytes: 1220
def ma():
  n,m=map(int,input().split())
  ans=0
  e=[set(list(map(int,input().split()))[1:]) for i in range(m)]
  f=list(map(int,input().split()))
  for i in range(2**n):
    l={a for a,b in zip(range(1,n+1),bin(i)[2:].zfill(n)) if b=="1"}
    if sum({int(len(e[j-1]&l)%2 !=f[j-1]) for j in range(1,m+1)})==0:ans+=1
  print(ans)

if __name__=="__main__":
  ma()

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

int L, N, X[200000];
ll r[200001], l[200001], MAX;
int main() {
	cin >> L >> N;
	for (int i = 0; i != N; ++i)
		cin >> X[i];
	for (int i = 0; i != N; ++i)
		l[i + 1] = l[i] + X[i] * 2;
	for (int i = N - 1; i != -1; --i) 
		r[i] = r[i + 1] + (L - X[i]) * 2;
	for (int i = 0; i != N; ++i) {
		ll cnt = X[i];
		if (i >= N - (i + 1)) {
			cnt += r[i + 1];
			cnt += l[i] - l[i - (N - (i + 1))];
		}
		else {
			cnt += l[i];
			cnt += r[i + 1] - r[i + 1 + i + 1];
		}
		MAX = max(MAX, cnt);
		cnt = L - X[i];
		if (i <= N - (i + 1)) {
			cnt += l[i];
			cnt += r[i + 1] - r[i + 1 + i];
		}
		else {
			cnt += r[i + 1];
			cnt += l[i] - l[i - (N - (i + 1)) - 1];
		}
		MAX = max(MAX, cnt);
	}
	cout << MAX << endl;
	return 0;
}

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

int main() {
	double ans = 0;
	double rate = 380000.0;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		double x;
		string u;
		cin  >> x >> u;
		if(u[0] == 'J') {
			ans += x;
		} else {
			ans += x*rate;
		}
	}
	cout << setprecision(20) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	set<char> st;
	int n=s.size();
	rep(i,0,n) st.insert(s[i]);
	if(st.size()==n) cout<<"yes";
	else cout<<"no";
		
	
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> num(4);
  for(int i=0;i<4;i++){
    num[3-i]=N%10;
    N/=10;
  }
  for(int i=0;i<(1<<3);i++){
    vector<char> op(3);
    int ans=num[0];
    for(int j=0;j<3;j++){
      if((i & (1<<j))==(1<<j)){
        ans+=num[j+1];
        op[j]='+';
      }
      else{
        ans-=num[j+1];
        op[j]='-';
      }
    }
    if(ans==7){
      for(int i=0;i<4;i++){
        cout << num[i];
        if(i!=3){
          cout << op[i];
        }
      }
      cout << "=7" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3608
// Try AtCoder
// author: Leonardone @ NEETSDKASU
package main

import "fmt"

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(min(a+b, min(b+c, c+a)))
}


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


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 510;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int H,W,h,w;

int Ans[maxn][maxn];

void Work(){
	REP(i,1,H)REP(j,1,W)Ans[i][j]=1000;
	int x=-(h*w-1)*1000-1;
	for(int i=1;i+h-1<=H;i+=h)
		for(int j=1;j+w-1<=W;j+=w){
			Ans[i+h-1][j+w-1]=x;
		}
	int ans=0;
	REP(i,1,H)REP(j,1,W)ans+=Ans[i][j];
	
	if(ans>0){
		puts("Yes");
		REP(i,1,H){
			REP(j,1,W)printf("%d ",Ans[i][j]);puts("");
		}
	}
	else puts("No");
}

void Init(){
	read(H,W,h,w);
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int
main()
{
    int x1,x2,x3,x4,x5;
    cin >> x1;
    cin >> x2;
    cin >> x3;
    cin >> x4;
    cin >> x5;

    if(x1 == 0) {
        cout << "1" << endl;
    } else if(x2 == 0) {
        cout << "2" << endl;
    } else if(x3 == 0) {
        cout << "3" << endl;
    } else if(x4 == 0) {
        cout << "4" << endl;
    } else if(x5 == 0) {
        cout << "5" << endl;
    }
    return 0;
}


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

vector<pair<long long, long long> > prime_factorize(long long N) {
	vector<pair<long long, long long> > res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0; // 指数

		 // 割れる限り割り続ける
		while (N % a == 0) {
			++ex;
			N /= a;
		}

		// その結果を push
		res.push_back({ a, ex });
	}

	// 最後に残った数について
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int main() {
	
	ll n; cin >> n;
	const ll mod = 1000000007;
	vector<ll> num(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		vector<pair<long long, long long>> a_prime;  // a^x ならば { a, x }
		a_prime = prime_factorize(i);
		for (int j = 0; j < a_prime.size(); j++) {
			num[a_prime[j].first] += a_prime[j].second;
			num[a_prime[j].first] %= mod;
		}
	}
	ll ans = 1;
	for (int i = 1; i <= n; i++) {
		ans *= num[i] + 1;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3604