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

int main() {
    map<string, int> ans;
    ans["MON"] = 6;
    ans["TUE"] = 5;
    ans["WED"] = 4;
    ans["THU"] = 3;
    ans["FRI"] = 2;
    ans["SAT"] = 1;
    ans["SUN"] = 7;
    string s;
    cin >> s;
    cout << ans[s] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <list>
#include <string>
#include <memory.h>
#include <bitset>
#include <stack>
#include <assert.h>
using namespace std;
#define ll long long
#define ppi pair<int, int>
#define mp make_pair
const int N = 2e5 + 2, K = 20;
const int mod = 1e9 + 7 , inf = 2e9;
int dp[N][3];
int a[N] , b[N] , c[N];

int main()
{
#ifndef ONLINE_JUDGE
	//freopen("inp.txt", "r", stdin);
#endif
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		scanf("%d%d%d", a + i, b + i, c + i);
	dp[n - 1][0] = max(b[n - 1] , c[n - 1]);
	dp[n - 1][1] = max(a[n - 1], c[n - 1]);
	dp[n - 1][2] = max(a[n - 1], b[n - 1]);
	for (int i = n - 2; i >= 0; i--)
	{
		dp[i][0] = max(dp[i + 1][1] + b[i] , dp[i + 1][2] + c[i]);
		dp[i][1] = max(dp[i + 1][0] + a[i], dp[i + 1][2] + c[i]);
		dp[i][2] = max(dp[i + 1][0] + a[i], dp[i + 1][1] + b[i]);
	}
	int q = max(dp[0][0], dp[0][1]);
	cout << max(q, dp[0][2]);
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>
#include <math.h>


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)



using namespace std;

bool is_integer( float x ){
    return floor(x)==x;
}


int main() {
    int a,b;
    int flag = false;
    vector<int> vc;
    cin >> a >> b;

    for(int i = a; i < 10000; i ++){
        if((int)(i*0.08) == a) vc.push_back(i);
    }

    for(int i = 0; i < vc.size(); i ++){
        if((int)(vc[i]*0.1) == b){
               cout << vc[i];
               flag = true;
               break;
        }
    }

    if(!flag) cout << -1;

    return 0;
}











Measured memory_bytes: 3600
function Main(input){
    input= input.split(" ");
    input= input.map(Number);
    
    var sub = function(arry){
        var sum = 0;
        arry.forEach(element => {
            sum += element;
        });
        return sum;
    }
    
    if(sub(input) <= 21){
        console.log('win');
    }else{
        console.log('bust');
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8")); 

Measured memory_bytes: 7372
#include <stdio.h>

int main() {
  char ch[250]={0};
  char a[250] ={0};
  int h;
  int i,j,k,l,n,m;


  while(1){
    i=0;
    while(1){
      
      scanf("%c",&ch[i]);
      if(ch[i] == '\n') {    
	break;
      }
      
      i++;
    }
   
    if ( i == 1 && ch[0] == '-' ) break;

    //  printf("%d",i);
    
    scanf("%d",&m);
    
    for(j=0;j<m;j++){
      scanf("%d", &h );
      
      for(k=0;k<i-h;k++) {
	a[k] = ch[h+k];
	//    printf("a[%d] = ch[%d]の%c\n",k ,h+k,ch[h+k]);
      }
      for(k=0;k<h;k++){
	a[i-h+k] = ch[k];
	//   printf("a[%d] = ch[%d]の%c\n",i-h+k,k,ch[k]);
      }
      for(k=0; k<i; k++){
	ch[k] = a[k];
	// printf("ch[%d] = a[%d]の%c\n",k,k,a[k]);
      }
    }
    for(k=0;k<i;k++) {
      printf("%c",ch[k]);
    }
    printf("\n");
      scanf("%c",&ch[0]);
  }
  
  
  return 0;
  
}


Measured memory_bytes: 2068
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long LL;

namespace INPUT {
	const int L = 1 << 15;
	char _buf[L], *S, *T, c;
	char _gc () {
		if (S == T) {
			T = (S = _buf) + fread (_buf, 1, L, stdin);
			if (S == T) return EOF;
		}
		return *S++;
	}
	void readi (int &X) {
		bool flag;
		for (c = _gc (); (c < '0' || c > '9') && c != '-'; c = _gc ());
		if (c == '-') X = 0, flag = true; else X = c & 15, flag = false;
		for (c = _gc (); c >= '0' && c <= '9'; X = X * 10 + (c & 15), c = _gc ());
		if (flag) X = -X;
	}
	void readl (LL &X) {
		bool flag;
		for (c = _gc (); (c < '0' || c > '9') && c != '-'; c = _gc ());
		if (c == '-') X = 0, flag = true; else X = c & 15, flag = false;
		for (c = _gc (); c >= '0' && c <= '9'; X = X * 10 + (c & 15), c = _gc ());
		if (flag) X = -X;
	}
}
using INPUT :: readi;
using INPUT :: readl;

const int Maxn = 1E5 + 5;

int N, M; LL K;
int x[Maxn];
int a[Maxn];

int lnk[Maxn];
bool vis[Maxn];
int stk[Maxn], tp;

int ans[Maxn];

void Dfs (int u) {
	if (vis[u]) return ;
	vis[u] = true, stk[++tp] = u, Dfs (lnk[u]);
}

int main () {
	readi (N);
	for (int i = 1; i <= N; ++i)
		readi (x[i]), lnk[i] = i;
	readi (M), readl (K);
	for (int i = 1; i <= M; ++i)
		readi (a[i]), swap (lnk[a[i] - 1], lnk[a[i]]);
	memset (vis, false, sizeof (vis));
	for (int i = 1; i < N; ++i)
	if (!vis[i]) {
		tp = 0, Dfs (i);
		for (int j = 1; j <= tp; ++j)
			ans[stk[j]] = stk[(j + K - 1) % tp + 1];
	}
/*	for (int i = 1; i < N; ++i)
		cerr << lnk[i] << ' '; cerr<<endl;
	for (int i = 1; i < N; ++i)
		cerr << ans[i] << ' '; cerr<<endl;*/
	LL Ans = x[1];
	printf ("%lld\n", Ans);
	for (int i = 1; i < N; ++i)
		Ans += x[ans[i] + 1] - x[ans[i]],
		printf ("%lld\n", Ans);
	return 0;
}


Measured memory_bytes: 3328
#include<stdio.h> 
int main(){ 
  int n; 
  scanf("%d",&n); 
  for(int a=1;a<=9;a++)for(int b=1;b<=9;b++){ 
    if(a*b==n){ 
      puts("Yes"); 
      return 0; 
    } 
  } 
  puts("No"); 
}


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

int main(){
	// sengen
	LL n;
	// nyuryoku
	cin >> n;
	LL x[n],y[n];
	LL max1,min1,max2,min2;
	LL tmp1,tmp2;
	for(LL i=0;i<n;i++){
		cin >> x[i] >> y[i];
		tmp1 = x[i] + y[i];
		tmp2 = abs(1e9 + 1 - x[i]) + y[i];
		if(i==0){
			min1 = tmp1;
			max1 = tmp1;
			min2 = tmp2;
			max2 = tmp2;
		}else{
			min1 = min(min1,tmp1);
			max1 = max(max1,tmp1);
			min2 = min(min2,tmp2);
			max2 = max(max2,tmp2);
		}
	}
	// keisan
	cout << max(max1 - min1,max2 - min2) << endl;
	// syutsuryoku
}

Measured memory_bytes: 6720
/*
 * Author : Sadi
 * Thu 09/07/2020
 * 17:30:37.90
 */
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    vector<int> A(n + 1), B(n + 1), C(n);
    for(int i = 1; i <= n; ++i) {
        cin >> A[i];
    }
    for(int i = 1; i <= n; ++i) {
        cin >> B[i];
    }
    for(int i = 1; i < n; ++i) {
        cin >> C[i];
    }
    int sum = B[A[1]];
    // cout << sum << endl;
    for(int i = 2; i <= n; ++i) {
        sum += B[A[i]];
        // cout << sum << endl;
        if(A[i] - 1 == A[i - 1]) {
            sum += C[A[i - 1]];
            // cout << sum << endl;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <cmath>
#include <cstdio>
int a, b; double x, y, r;
int main() {
	r = asin(1);
	while(scanf("%d,%d", &a, &b), a | b) {
		x += a * cos(r), y += a * sin(r);
		r -= b / 180.0 * acos(-1);
	}
	printf("%d\n%d\n", (int)(x), (int)(y));
}

Measured memory_bytes: 2884
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;

ll fastpowMOD(ll a, ll p,ll MOD);
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; a %= MOD; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }

ll count2(ll n){
	ll c = 0;
	while(n>0 && n%2==0){
		c++;n/=2;
	}
	return c;
}

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

int main(){
	ll n,m;
	cin>>n>>m;
	
	vector<ll> a(n);
	
	for(ll i=0;i<n;i++){
		cin>>a[i];	
	}
	ll ntwo = 0;
	while(a[0]>0 && a[0]%2==0){
		ntwo++;
		a[0] /= 2;
	}
	ll f = 1;
	ll x = a[0];
	for(ll i=1;i<n;i++){
		ll c = 0;
		while(a[i]>0 && a[i]%2==0){
			c++;
			a[i] /= 2;
		}
		if(c!=ntwo){
			f = 0;break;
		}
		x = lcm(a[i],x);
	}
	
	if(f==0){
		cout<<0<<"\n";
	}
	else{
		ll ans = 0;
		ll i=1;
		//ll rtwo = fastpowMOD(2,ntwo,MOD);
		x *= fastpowMOD(2,ntwo-1,MOD);
	
		//cout<<"lcm "<<lcm<<"\n";
		
		ll cnt = m/x;
		if(cnt%2==0){
			ans = cnt/2;
		}
		else{
			ans = cnt/2+1;
		}
		
		cout<<ans<<"\n";
	}
	
	
	
	
	
	
}


















Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

long long n,a,b,c,d;

int main()
{
    cin >> n >> a >> b >> c >>d;
    long long t=a-b,ans=0;
    n--;
    for(int i=n;i>=0;i--)
    {
        long long j=n-i;
        long long r=d*i-c*j;
        long long l=c*i-d*j;
        if(t>=l&&t<=r)
        {
            ans=1;
           //  cout << i << " " << j << endl;
           // cout << l << " " << r << endl;
            break;
        }
    }
    if(ans)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


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 ac=0,wa=0,tle=0,re=0;
    for(int i = 0;i<n;i++){
      String s = sc.next();
      if(s.equals("AC")){
        ac++;
      }else if(s.equals("WA")){
        wa++;
      }else if(s.equals("TLE")){
        tle++;
      }else{
        re++;
      }
    }
    System.out.println("AC x "+ac);
    System.out.println("WA x "+wa);
    System.out.println("TLE x "+tle);
    System.out.println("RE x "+re);

  }
}


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



int main() {
    string s,sc;
    int n;
    cin>>n>>s;
    sc = s;

    int count=0;
    while(count==0) {
        count=1;
        for (int i = 1; i < s.size(); i++) {
            if (s.at(i-1) == '(' && s.at(i) != s.at(i - 1)) {
                s.erase(i-1, 2);
                count = 0;
                break;
            }
        }
    }
    for(int i=0;i<s.size();i++){
        if(s.at(i)==')'){
            sc.insert(0,"(");
        }else{
            sc.insert(sc.size(),")");
        }
    }
    cout<<sc<<endl;
}


Measured memory_bytes: 256
from math import floor, ceil

s = input()

def isKaibun(str1):
    
    halflen = floor(len(str1) / 2)
    backlen = ceil(len(str1) / 2)
    back = ''.join(reversed(str1[backlen:]))
    if str1[:halflen] == back:
        return True
    else:
        return False

if isKaibun(s):
    front = (len(s)-1) // 2
    fs = s[:front]
    if isKaibun(fs):
        rear = (len(s)+3) // 2
        rs = s[rear-1:]
        if isKaibun(rs):
            print('Yes')
            exit()

print('No')

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int x = int.Parse(s[0]);
            int a = int.Parse(s[1]);
            int b = int.Parse(s[2]);

            string ans = "A";
            if (Math.Abs(a-x) > Math.Abs(b-x))
            {
                ans = "B";
            }

            Console.WriteLine(ans);
            Console.ReadLine();

        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<long long> vll, vLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
int nmax = 100000;
vint x(nmax);

int gcd( int a, int b )
{
	int r, tmp;
 
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,X;
    cin >> N >> X;
    REP(i,N) {
        cin >> x[i];
    }
    int ans = abs(X-x[0]);
    REP(i,N-1){
        ans = gcd(ans,abs(x[i+1]-x[i]));
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

main(void)
{  
	int s,s1,m,m1,h;           
	scanf("%d",&s);
	m=s/60;
	s1=s%60;
	h=m/60;
	m1=m%60;
	printf("%d:%d:%d\n",h,m1,s1);          
	return 0;
}

Measured memory_bytes: 592
#include <cstdio>

int y1, m1, d1, y2, m2, d2;

int day[2][12]={

{31,28,31,30,31,30,31,31,30,31,30,31},

{31,29,31,30,31,30,31,31,30,31,30,31}

};

bool uruu(int year) {

    if (year%400==0) return true;

    else if (year%100==0) return false;

    else if (year%4==0) return true;

    else return false;

}

int main() {

    while (scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2)) {

        if (y1==-1&&m1==-1&&d1==-1&&y2==-1&&m2==-1&&d2==-1) break;

        long long res = 0, flag;

        if (y1==y2) {

            if (uruu(y1)) flag = 1;

            else flag = 0;

            if (m1==m2) res = d2-d1;

            else {

                for (int i=m1; i<m2-1; i++) res += day[flag][i];

                res += day[flag][m1-1] - d1;

                res += d2;

            }

        } else {

            if (uruu(y1)) flag = 1;

            else flag = 0;

            for (int i=m1; i<12; i++) res += day[flag][i];

            res += day[flag][m1-1] - d1;

            if (y1+1<y2) for (int i=y1+1; i<y2; i++) {

                if (uruu(i)) res += 366;

                else res += 365;

            }

            if (uruu(y2)) flag = 1;

            else flag = 0;

            for (int i=0; i<m2-1; i++) res += day[flag][i];

            res += d2;

        }

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

    }

}

Measured memory_bytes: 0
import sys
readline = sys.stdin.readline
write = sys.stdout.write
sys.setrecursionlimit(10**5)
def solve():
    N = int(readline())
    if N == 0:
        return False
    S = readline().strip() + "$"
    L = len(S)
    pt = [0]*L
    st = []
    for i in range(L):
        if S[i] == '(':
            st.append(i)
        elif S[i] == ')':
            k = st.pop()
            pt[i] = k
            pt[k] = i

    ans = 0
    def parse(cur):
        nonlocal ans
        ps = []
        ls = []
        su = 0
        while 1:
            ms = []
            while 1:
                if S[cur] == '(':
                    v = parse(cur+1)
                    cur = pt[cur]+1
                else:
                    v = int(S[cur])
                    cur += 1
                ms.append(v)
                if S[cur] != '*':
                    break
                cur += 1
            l = len(ms)
            ms_a = [1]*(l+1)
            for i in range(l):
                ms_a[i+1] = ms_a[i] * ms[i]
            ps.append(ms_a)
            ls.append(l)
            su += ms_a[-1]
            if S[cur] != '+':
                break
            cur += 1
        p1 = c1 = 0; s1 = 0
        q1 = d1 = 0; t1 = 0; u1 = 0
        q2 = d2 = 0; t2 = 0; u2 = 0
        s = 0
        while p1 < len(ls):
            k1 = ps[p1][c1+1]
            if s1 + k1 >= N:
                break
            if c1 + 1 < ls[p1]:
                c1 += 1
            else:
                s1 += ps[p1][-1]
                p1 += 1; c1 = 0
        while p1 < len(ls):
            k1 = ps[p1][c1+1]
            while (q1, d1) <= (p1, c1):
                k2 = ps[q1][d1]
                if p1 == q1:
                    v = (s1 - t1) + (k1 // k2)
                else:
                    kk = ps[q1][-1]
                    v = (s1 - t1) + (k1 + kk // k2 - kk)
                if v >= N:
                    if d1 + 1 < ls[q1]:
                        d1 += 1
                    else:
                        t1 += ps[q1][-1]
                        q1 += 1; d1 = 0
                    u1 += 1
                else:
                    break
            while (q2, d2) <= (p1, c1):
                k3 = ps[q2][d2]
                if p1 == q2:
                    v = (s1 - t2) + (k1 // k3)
                else:
                    kk = ps[q2][-1]
                    v = (s1 - t2) + (k1 + kk // k3 - kk)
                if v > N:
                    if d2 + 1 < ls[q2]:
                        d2 += 1
                    else:
                        t2 += ps[q2][-1]
                        q2 += 1; d2 = 0
                    u2 += 1
                else:
                    break
            ans += u1 - u2
            if c1 + 1 < ls[p1]:
                c1 += 1
            else:
                s1 += ps[p1][-1]
                p1 += 1; c1 = 0
        return su
    parse(0)
    write("%d\n" % ans)
    return True
while solve():
    ...


Measured memory_bytes: 140480
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
int main()
{
   ll n,m,i,j,t,a,b,c,p,kk; 
   cin>>n;
   char k;
   string s; s="";
   while(n)
   {
    
      if(n%26==0)
      {
      	k='z';
		  n--; 
	  }
	  else 
	  {
	  	 k=n%26+'a'-1;
	  } 
   	  s+=k;
   	  n=n/26;
   }
   reverse(s.begin(),s.end());
   cout<<s<<endl;
}
	 



Measured memory_bytes: 3596
n, a1, a2 = map(int, input().split(" "))
print(n)
wa = a2 - a1 + 1
l1 = a1 - 1
l2 = n - a2
hwa = wa // 2
pari = wa % 2
# print(wa,l1,l2,hwa,pari)
 
tmp = 0
for i in range(2, n):
    if l1 + l2 + 1 >= i:
        tmp += l1 + l2 - i + 2
    if i - 1 <= l1:
        tmp -= 1
    if i - 1 <= l2:
        tmp -= 1
    # print("himonokazu",tmp)
    if hwa > i:
        tmp += wa
    elif hwa == i:
        if pari == 1:
        	tmp += wa
        else:
            tmp += hwa
    # print("wamoirete",tmp)
    # print((i-1),(hwa-1),(l1-1),l2-1)
    if i <= hwa + l1:
        # print(min(hwa,l1,hwa+l1-i+1,i-1))
        tmp += min(hwa, l1, hwa + l1 - i + 1, i - 1) * 2
        if pari == 0 and hwa < i:
            tmp -= 1
            # print("l1gen")
        # print("l1",tmp)
    if i <= hwa + l2:
        # print(min(hwa,l2,hwa+l2-i+1,i-1))
        tmp += min(hwa, l2, hwa + l2 - i + 1, i - 1) * 2
        if pari == 0 and hwa < i:
            tmp -= 1
            # print("l2gen")
        # print("l2", tmp)
    print(tmp)
    tmp = 0

Measured memory_bytes: 43372
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
	string s;
	cin>>s;
	int count=0,best=-1;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
			count++;
		}
		else {
			best = max(best, count);
			count=0;
		}
	}
    best = max(best, count);
	cout<<best<<endl;
	return 0;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * (n+1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


N, M = map(int, input().split())
Union = UnionFind(N)
bad_value = N*(N-1)//2
bridge = []
for i in range(M):
    a, b = map(int, input().split())
    bridge.append((a, b))
bridge.reverse()
ans = [bad_value]
for a, b in bridge:
    if Union.same(a, b):
        Union.union(a, b)
        ans.append(bad_value)
        continue
    else:
        X = Union.size(a)
        Y = Union.size(b)
        Union.union(a, b)
        bad_value -= X*Y
        ans.append(bad_value)
        continue
ans.reverse()
for i in range(1, M+1):
    print(ans[i])

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

int main(){
  int a,b;
  cin>>a>>b;
  if(a<=b){
    for(int i=0;i<b;i++){
      cout<<a;
    }
  }
  else{
    for(int i=0;i<a;i++){
      cout<<b;
    }
  }
}

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

int main(){
	//(正)<-!!!!!!!!!!整数
	int64_t n;
	cin >> n;
	for(int64_t i = 1; i <= 3500; i++){
		for(int64_t j = 1; j <= 3500; j++){
			if(4 * i * j - n * i - n * j == 0) continue;
			if(n * i * j % (4 * i * j - n * i - n * j)) continue;
			int64_t k = n * i * j / (4 * i * j - n * i - n * j);
			if(k <= 0) continue;
			cout << i << ' ' << j << ' ' << k << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
S = int(input())
 
L = S // 100 # 前半2桁
R = S % 100 # 後半2桁
 
if 1 <= L <= 12:
  if 1 <= R <= 12: print('AMBIGUOUS')
  else: print('MMYY')
else:
  if 1 <= R <= 12: print('YYMM')
  else: print('NA')

Measured memory_bytes: 9168
n=int(input())
mod=10**9+7
ans=[0]*(1000+1)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

for i in range(1000+1):
  for j in factorization(i):
    ans[j[0]]+=j[1]
  if n==i:
    break
anss=1
for i in range(2,len(ans)):
  anss*=(ans[i]+1)%mod
  anss%=mod
print(anss)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n; cin>>n; int c; int sum,d; sum=0; d=0;
  rep(i,n) {cin>>c; sum=sum+c; d=d+(c*c); }
  cout<<(sum*sum-d)/2<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

int main (int argc, char* argv[]) {
	int a, b, k;
	cin >> a >> b >> k;
	for (int i = min(a, b); i >= 1; i--) {
		if (a % i == 0 && b % i == 0) {
			k--;
			if (k == 0) {
				cout << i << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
import itertools
from collections import Counter
n = int(input())
s = [input()[0] for _ in range(n)]
cnt = Counter(s)
#print(cnt)

ans = 0
for x,y,z in itertools.combinations("MARCH",3):
 # print(x,y,z)
  ans += cnt[x]*cnt[y]*cnt[z]
  #print(cnt[x],cnt[y],cnt[z])
        
print(ans)

Measured memory_bytes: 10068
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n, a;
	cin >> n >> a;

	cout << (n % 500 <= a ? "Yes" : "No") << endl;
	return 0;
}


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

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

    sort(s.begin(),s.end());
    if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[3]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')

N = iin()
A = iln()

c = [0 for _ in range(N+1)]
c[0] = A[0]
for i in range(N):
    c[i+1] = c[i] + A[i]

counter = collections.Counter(c)

ans = 0
for v in counter.values():
    ans += v*(v-1)//2
print(ans)




Measured memory_bytes: 43228
import sys
readlines = sys.stdin.buffer.readlines
input = sys.stdin.buffer.readline
N, Ma, Mb = map(int, input().split())
X = [tuple(map(int, line.split())) for line in readlines()]

INF = 1 << 30
x = [[INF]*201 for _ in [0]*201]
y = [[INF]*201 for _ in [0]*201]

n = N//2
X, Y = X[:n], X[n:]
for bit in range(1 << n):
    totA = totB = cost = 0
    for i in range(n):
        if bit >> i & 1:
            a, b, c = X[i]
            totA += a
            totB += b
            cost += c

    x[totA][totB] = min(x[totA][totB], cost)

for bit in range(1 << (N-n)):
    totA = totB = cost = 0
    for i in range(N-n):
        if bit >> i & 1:
            a, b, c = Y[i]
            totA += a
            totB += b
            cost += c

    y[totA][totB] = min(y[totA][totB], cost)

ans = INF
M = 405//max(Ma, Mb)
for i, t in enumerate(x):
    for j, s in enumerate(t):
        if s == INF:
            continue
        for k in range(1, M+1):
            I = k*Ma-i
            J = k*Mb-j
            if 0 <= I <= 200 and 0 <= J <= 200:
                ans = min(ans, s + y[I][J])

print(ans if ans < INF else -1)


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

using namespace std;

typedef long long ll;
const long double Pi = acos(-1.0);

void solve(){
    long double r;
    cin >> r;
    cout << setprecision(20) << fixed << 2*r*Pi;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t =1, i = 1;
    //cin >> t;
    while(t--){
        solve();
        ++i;
    }
    return 0;
}


Measured memory_bytes: 3812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int N;
  cin >> N;
  int P[N];
  for(int i = 0; i < N; i++){
    cin >> P[i];
  }
  int cnt = 0;
  for(int i = 0; i < N; i++){
    if(P[i] != i + 1) cnt++;
  }
  if(cnt <= 2) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int main()
{
	string s;
	cin>>s;
	vector<int> a(26);
	for(int i=0;i<s.size();i++)
		a[s[i]-'a']++;
	
	if(s.size()<26)
	{
		for(int i='a';i<='z';i++)
			if(!a[i-'a'])
				{s=s+(char)i;break;}
		cout<<s;
	}
	else
	{
		s+=' ';
		if(next_permutation(s.begin(),s.end()))
		{
			for(int i=0; s[i]!=' ';i++)
				cout<<s[i];
		}
		else
			cout<<-1;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <ios>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>

#define REP(i, n) for(int i = 0;i < n;i++)

using namespace std;

const int INF = 100000000;

int main(){
  string s;
  string t;
  cin >> s;
  cin >> t;

  int s_size = s.length();
  int t_size = t.length();

  for (int i = s_size - t_size; i >= 0; i--) {
    string result(s);
    int count = 0;
    for (int j = 0; j < t_size; j++) {
      if ((s[i+j] != t[j]) && (s[i+j] != '?')) {
        break;
      }
      result[i+j] = t[j];
      count++;
    }
    if (count == t_size) {
      for (int k = 0; k < s_size; k++) {
        if (result[k] == '?') {
          result[k] = 'a';
        }
      }
      cout << result << endl;
      return 0;
    }
  }

  cout << "UNRESTORABLE" << endl;
  return 0;
}

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

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

  if (n[0] == n[1] && n[1] == n[2]) {
    cout << "Yes" << endl;
  } else if (n[1] == n[2] && n[2] == n[3]){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#[macro_use]
mod utils {
    macro_rules! input {
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};
 
        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
}
 

fn main() {
    input!{
        n: u64,
        r: u64,
    }
    if n < 10{
        println!("{}",r+((10-n)*100));
    }else{
        println!("{}", r);
    }

}

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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i, k , n) for(int i = k; i <= n; i++)
typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int x; cin >> x;
   int ans = 1;
   for(int i = 2; i*i <= x; i++)
   {
      for(int j = 2; j <= 9; j++)
      {
         int k = ceil(pow(i, j));
         if(k <= x)
            ans = max(ans, k);
         else
            break;
      }
   }
   cout << ans << nl;
   return 0;
}


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

int main () {
    string k[][5] = {
        {"wa", "", "nn", "", "wo"},
        {"a", "i", "u", "e", "o"},
        {"ka", "ki", "ku", "ke", "ko"},
        {"sa", "si", "su", "se", "so"},
        {"ta", "ti", "tu", "te", "to"},
        {"na", "ni", "nu", "ne", "no"},
        {"ha", "hi", "hu", "he", "ho"},
        {"ma", "mi", "mu", "me", "mo"},
        {"ya", "", "yu", "", "yo"},
        {"ra", "ri", "ru", "re", "ro"},
    };

    map<char, int> m;
    m.insert(make_pair('T', 0));
    m.insert(make_pair('L', 1));
    m.insert(make_pair('U', 2));
    m.insert(make_pair('R', 3));
    m.insert(make_pair('D', 4));

    string line;
    while (cin >> line) {
        for (int i = 0, size = line.size(); i < size; i += 2) {
            cout << k[line[i] - '0'][m[line[i+1]]];
        }
        cout << endl;
    }
}

Measured memory_bytes: 1200
#include <iostream>
using namespace std;
int main(){
int a;
int b;
int c;
char d;
int e;
int f;
e=0;
f=0;
while(cin >>a>>d>>b>>d>>c){
if(a*a+b*b==c*c){e=e+1;}
if(a==b){f=f+1;}
}
cout <<e<<endl<<f<<endl;}

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

int main() {
    int h1, s1, h2, s2;
    cin >> h1 >> s1 >> h2 >> s2;
    int cnt1 = h2 / s1 + (h2 % s1 != 0);
    int cnt2 = h1 / s2 + (h1 % s2 != 0);
    if (cnt1 <= cnt2) cout << "Yes";
    else cout << "No";
    return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    if(n==3 || n==5 || n==7) cout << "YES" << "\n";
    else cout << "NO" << "\n";
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

const int MAX_H = 10000;

int main() {
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	rep(i,n) cin >> a[i] >> b[i];
	vector<vector<int>> dp(n+1, vector<int>(MAX_H + 1, INF));
	dp[0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= h; j++) {
			if (j - a[i] <= 0) {
				dp[i+1][j] = min(dp[i][j], b[i]);
			} else {
				dp[i+1][j] = min(dp[i][j], dp[i+1][j - a[i]] + b[i]);
			}
		}
	}
	cout << dp[n][h] << endl;
}

Measured memory_bytes: 42280
from bisect import bisect_right
n=int(input())
A=[int(input()) for _ in range(n)][::-1]

DP=[A[0]]
for i in range(1,n):
    num=A[i]
    if DP[-1]<=num:
        DP.append(num)
    else:
        index=bisect_right(DP,num)
        DP[index]=num
print(len(DP))

Measured memory_bytes: 56792
N,M = gets.split.map(&:to_i)
max_l = 0
min_r = 10**5
M.times do |i|
    l,r = gets.split.map(&:to_i)
    max_l = l if max_l < l
    min_r = r if min_r > r
end
if max_l <= min_r then
    puts min_r-max_l+1
else
    puts 0
end

Measured memory_bytes: 1788
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

ans=0
for i in range(n):
    if a[i]<=b[i]:
        ans+=a[i]
        if a[i+1]>=b[i]-a[i]:
            ans+= b[i]-a[i] 
            a[i+1]-=b[i]-a[i]
        else:
            ans+=a[i+1]
            a[i+1]=0
    else:
        ans+=b[i]
print(ans)


Measured memory_bytes: 18624
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
typedef long long ll;

int main() {
	int k, n;
	std::vector<int> A;
	std::cin >> k >> n;
	for (int i = 0; i < n; i++) {
		int a;
		std::cin >> a;
		A.emplace_back(a);
	}
	std::vector<int> backet;
	for (int i = 0; i < k; i++) {
		backet.emplace_back(0);
	}
	for (auto iter = A.begin(); iter != A.end(); iter++) {
		backet[*iter]++;
	}
	int c = 0;
	for (int i = 0; i < n; i++) {
		while (1) {
			if (backet[c] != 0) {
				A[i] = c;
				backet[c]--;
				break;
			}
			c++;
		}
	}
	int max = 0;
	for (auto iter = A.begin(); iter != A.end()-1; iter++) {
		if (max < *(iter + 1) - *iter) {
			max = *(iter + 1) - *iter;
		}
	}
	if (max < k - A[n - 1] + A[0]) {
		max = k - A[n - 1] + A[0];
	}
	std::cout << k - max << std::endl;

	return 0;
}

Measured memory_bytes: 6896
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
ll n,a,b;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>a>>b;
  if(a>b) cout<<0<<endl;
  else if(n==1 && a==b) cout<<1<<endl;
  else if(n < 2) cout<<0<<endl;
  else if(n==2) cout<<1<<endl;
  else {
    cout<<(b-a)*(n-2) + 1<<endl;
  }
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n,a=0,x[100];
    char s[100];
    fill(x,x+100,0);
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>s[i];
    a=n;
    for(int i=0;i<n;i++){
        if(x[i]==1)
            continue;
        for(int j=i+1;j<n;j++){
            if(s[i]==s[j]){
                x[j]=1;
                a--;
            }
        }
    }
    if(a==4)
        cout<<"Four"<<endl;
    else
        cout<<"Three"<<endl;
    return 0;
}

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

using namespace std;

int main(void)
{
    string s;
    cin >> s;

    int count = 0;
    int maxv = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'R'){
            count++;
        }
        else {
            maxv = max(maxv, count);
            count=0;
        }
    }
    cout << max(maxv, count) << endl;

    return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define ed "\n"
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << endl;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int64_t, int >prime_factor(int64_t n){map< int64_t, int > ret;for(int64_t i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int a,b; cin>> a >> b;
    out(max(a-2*b,0LL));

    return 0;
}

Measured memory_bytes: 256
N=int(input())
d=[]
for i in range(N):
    d.append(int(input()))

n=0
d.sort(reverse=True)
dd=[]
dd.append(d[0])
for i in range(N):
    if d[i]<min(dd):
        dd.append(d[i])

n=len(dd)
print(n)

Measured memory_bytes: 3060
ref="ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba"
while 1:
	n=input()
	if n==0:break
	key=map(int,raw_input().split())
	code=list(raw_input())
	for i in range(len(code)):
		code[i]=ref[(ref.index(code[i])+key[i%n])%52]
	print "".join(map(str,code))

Measured memory_bytes: 4208
#include<iostream>
#include<algorithm>
using namespace std;
string a,b;
int c,d;
int dp[2][5000],ans;
int main(){
  while(cin>>a>>b){
    c=a.size(),d=b.size();
    ans=0;
    for(int i=0;i<2;i++)
      for(int j=0;j<5000;j++)dp[i][j]=0;
    for(int i=1;i<=c;i++){
      for(int j=1;j<=d;j++){
	int ni=i%2,ri=1-i%2;
	if(a[i-1]==b[j-1])dp[ni][j]=dp[ri][j-1]+1;
	else dp[ni][j]=0;
	ans=max(ans,dp[ni][j]);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

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

#define endl '\n'
#define len(x) (int)x.size()
#define rep(a, b, i) for (int i = a; i < b; i++)
#define repi(a, b, i) for (int i = a; i > b; i--)
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mem(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define __                                                                                                             \
    ios_base::sync_with_stdio(false);                                                                                  \
    cin.tie(0);                                                                              
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
const ld PI = 3.141592653589793;
const int MAXK = 1e5;

int k;
string s;
set<string> st;

string ltrim(string str)
{
    str.erase(0, str.find_first_not_of('0'));
    return str;
}

bool isLunlun(string r) {
	r = ltrim(r);

	for (int i = 1; i < (int)r.size(); i++)
		if (abs(r[i]-r[i-1]) > 1)
			return false;

	return true;
}

void solve(int i, char last) {
	st.insert(s);
	if (i == 0) return;
	if (i == 10) {
		for (char c = '0'; c <= '9'; c++) {
			s[9] = c;
			solve(i-1, c);
		}
	} else {
		for (char c = '0'; c <= '9'; c++) {
			if (abs(c-last) <= 1) {
				char b = s[i-1];
				s[i-1] = c;
				solve(i-1, c);
				s[i-1] = b;
			}
		}
	}
}

int32_t main() {
    __;
	cin >> k;
	
	s = string(10, '0');
	
	solve(10, k);

	auto it = st.begin();
	advance(it, k);
	cout << ltrim(*it) << endl;

    return 0;
}


















Measured memory_bytes: 18944
// Problem : A - Between Two Integers
// Contest : AtCoder - AtCoder Beginner Contest 061
// URL : https://atcoder.jp/contests/abc061/tasks/abc061_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
const int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int a,b,c;cin>>a>>b>>c;
if(c>=a and c<=b)
cout<<"Yes";
else
cout<<"No";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


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

int main() {
    int a, b;
    char oparator;
    while (true) {
        cin >> a >> oparator >> b;
        if (oparator == '?') break;
        if (oparator == '+') {
            cout << a + b << endl;
            continue;
        } else if (oparator == '-') {
            cout << a - b << endl;
            continue;
        } else if (oparator == '*') {
            cout << a * b << endl;
            continue;
        } else if (oparator == '/') {
            cout << a / b << endl;
            continue;
        }
    }
}

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007

#define trace1(x)                    cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;

typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m,k,x;
    cin>>k>>x;
    for(i=max(ll(-1000000),x-k+1);i<=min(ll(100000),x+k-1);i++)
    cout<<i<<" ";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int a,b;
	int i,j,k,l=0,m[1000]={0};

	while(1){
		scanf("%d%d",&a,&b);
		
		if(a==0&&b==0){
			break;
		}
		
		for(i=1;i<a+1;i++){
			for(j=2;j<a+1;j++){
				for(k=3;k<a+1;k++){
					if(b==(i+j+k)&&i<j&&j<k){
						m[l]=m[l]+1;
					}
				}
			}
		}
		
		l++;
	}
	
	for(i=0;i<l;i++){
		printf("%d\n",m[i]);
	}
	
	return 0;
}

Measured memory_bytes: 604
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] cs = s.toCharArray();
        char[] ct = t.toCharArray();
        Arrays.sort(cs);
        Arrays.sort(ct);
        String ss = new String(cs);
        String st = new String(ct);
        st = new StringBuilder(st).reverse().toString();
        if(ss.compareTo(st) < 0){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
	}
}

Measured memory_bytes: 35756