akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    long long a, b, ans = 0;
    cin >> n >> a >> b;
    vector<int> x(n);
    for(int i=0;i<n;i++) cin >> x[i];
    sort(x.begin(), x.end());
    for(int i=1;i<n;i++) ans += min((x[i]-x[i-1]) * a, b);
    cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		int[] tr=new int[N];
		for(int i=0; i<N; i++) {
			tr[i]=sc.nextInt();
		}
		Arrays.sort(tr);
		int max=Integer.MAX_VALUE;

		for(int i=0; i<=N-K; i++) {
			max=Math.min(max, tr[K-1+i]-tr[i]);
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 50820
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {            
            var nm = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = nm[0];
            int m = nm[1];
            var A = new bool[n,n];
            var B = new bool[m,m];

            //.→true #→false
            for (int i = 0; i < n; ++i)
            {
                string input = Console.ReadLine();
                for (int j = 0; j < n; ++j)
                {
                    A[i, j] = input[j] == '.';
                }
            }
            for (int i = 0; i < m; ++i)
            {
                string input = Console.ReadLine();
                for (int j = 0; j < m; ++j)
                {
                    B[i, j] = input[j] == '.';
                }
            }

            for (int i = 0; i < n - m + 1; ++i)
            {
                for (int j = 0; j < n - m + 1; ++j)
                {
                    if (A[i, j] == B[0, 0])
                    {
                        bool match = true;
                        for (int k = 0; k < m; ++k)
                        {
                            for (int l = 0; l < m; ++l)
                            {
                                if (A[i + k, j + l] != B[k, l])
                                {
                                    match = false;
                                    break;
                                }
                            }
                            if (!match) break;
                        }
                        if (match)
                        {
                            Console.WriteLine("Yes");
                            Environment.Exit(0);
                        }
                    }
                }
            }
            Console.WriteLine("No");

        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define mod 1000000007
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int pr[1000007];
bool isnotprime(ll x){if(x==1)return 1;if(x==2)return 0;if(x%2==0)return 1;return(pr[x/64]&(1<<((x>>1)&31)));}
void sieve(ll n){for(ll i=3;i*i<=n;i+=2){if(!isnotprime(i))for(ll j=i*i,k=i<<1;j<n;j+=k)pr[j/64]|=(1<<((j>>1)&31));}}
ll fpow(ll x,ll y){x=x%MOD;ll res=1;while(y){if(y&1)res=res*x;res%=MOD;y=y>>1;x=x*x;x%=MOD;}return res;}
ll inv(ll a,ll m){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   ll n,k;
   cin>>n>>k;
   ll a[n];
   for(int i=0;i<n;i++)
   cin>>a[i];
   ll dp[n];
   for(int i=0;i<n;i++)
   dp[i]=mod;
   dp[0]=0;
   for(int i=1;i<n;i++)
   {
   	for(int j=1;j<=k;j++)
   	{
   		if(i-j<0)
   		continue;
   		dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
   	}
   }
   cout<<dp[n-1];
   


}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            var n = long.Parse(Console.ReadLine());

            // 整数配列の入力
            var a = Console.ReadLine().Split(' ').Select(q => long.Parse(q)).ToArray();

            string result = "Yes";

            var num1 = 0;
            var num2 = 0;
            var num4 = 0;

            for(int i = 0; i < n; i++) {
                if(a[i] % 4 == 0) {
                    num4++;
                } else if(a[i] % 2 == 0) {
                    num2++;
                } else {
                    num1++;
                }
            }

            if(num1 > num4 + 1) {
                result = "No";
            }

            if(num1 == num4 + 1 && num2 != 0) {
                result = "No";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


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

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

template <class T> class MultiArray2
{
    public:
        T* _a;
        int _w;
        int _h;
        MultiArray2(int w, int h, bool clr = false)
        {
            _w = w; _h = h;
            _a = new T[_w * _h];
            if(clr) memzero();
        }

        void memzero()
        {
            memset(_a, 0, _w * _h * sizeof(T));
        }

        ~MultiArray2()
        {
            delete _a;
        }

        T* operator[](int i)
        {
            return _a + (i * _h);
        }
};

template <class T> class MultiArray3
{
    public:
        T** _a2;
        T* _a;
        int _d1;
        int _d2;
        int _d3;
        MultiArray3(int d1, int d2, int d3, bool clr = true)
        {
            _d1 = d1; _d2 = d2; _d3 = d3;
            _a = new T[_d1 * _d2 * _d3];
            _a2 = new T*[_d1 * d2];
            for(int i = 0; i < d1 * d2; i++ ) _a2[i] = _a + (i * _d3);
            if(clr) memzero();
        }

        void memzero()
        {
            memset(_a, 0, _d1 * _d2 * _d3 * sizeof(T));
        }

        ~MultiArray3()
        {
            delete _a;
            delete _a2;
        }

        T** operator[](int i)
        {
            return _a2 + (i * _d2);
        }
};

int main()
{
    int h, w;
    cin >> h >> w;
    MultiArray2<int> a(w, h);
    MultiArray2<int> b(w, h);
    MultiArray3<bool> dp(w, h, (w + h) * 80 );

    rep(j, h)
        rep(i, w) cin >> a[i][j];
    rep(j, h)
        rep(i, w) cin >> b[i][j];

    rep(j, h)
    {
        rep(i, w)
        {
            int d = abs(a[i][j] - b[i][j]);
            int premax = (i + j) * 80;
            int leftmax = ( w - i + h - j) * 80;
            if( i == 0 && j == 0 )
            {
                dp[i][j][d] = true;
            }
            else
            {
                for( int p = 0; p <= min(premax, leftmax + 80) ; p++ )
                {
                    if( ( i > 0 && dp[i - 1][j][p] ) || ( j > 0 && dp[i][j - 1][p] ) )
                    {
                        if( p + d <= leftmax ) dp[i][j][p + d] = true;
                        if( p - d >= 0 ) 
                        {
                            dp[i][j][p - d] = true;
                        }
                        else
                        {
                            dp[i][j][d - p] = true;
                        }
                    } 
                }
            }
        }
    }
    int ans = 0;
    while( !dp[w-1][h-1][ans] ) ans++;
    cout << ans << endl;

}

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

int main(void){
    int N,ans;
    scanf("%d", &N);
    double tmp;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 1) {
            tmp++;
        }
    }
    printf("%f\n",tmp/N);

}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  vector<P> vc;
  REP(i, n) {
    int s, t;
    cin >> s >> t;
    vc.push_back(P(t, s));
  }
  sort(ALL(vc));  // 終了時刻でソート
  int ans = 0;
  int last = 0;
  REP(i, n) {
    if (last < vc[i].second) {
      ans++;
      last = vc[i].first;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3868
import math
x,y=0,0
angle=math.pi/2
while True:
    d,a=map(int,input().split(","))
    if (d,a)==(0,0):
        break
    y +=math.cos(angle)*d
    x +=math.sin(angle)*d
    angle -=a*math.pi/180
print(int(y))
print(int(x))



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

int N;
int main() {
  cin >> N;
  int l, r, sum = 0;
  for (int i = 0; i < N; i++){
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define ri rd<int>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i)
const int maxN = 2007;

template<class T> T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; return f ? x : -x;
}

int n;
int col[maxN], pre[maxN];
vector<int> adj[maxN];
bool fix[maxN];
bool is[maxN];
int leaf[maxN], las[maxN];
bool hav[maxN];
bool use[maxN];
vector<int> ans;

void rot(int x) {
	ans.push_back(x);
	int t = col[0];
	do { swap(col[x], t); x = pre[x]; } while (x);
	swap(col[0], t);
}

void solve() {
	while (1) {
		int cccc = 0;
		per (i, n, 0) if (!fix[i]) {
			if (adj[i].size() == 0) {
				is[i] = true;
				leaf[i] = las[i] = i;
				++cccc;
			}
			else if (adj[i].size() == 1 && is[adj[i][0]]) {
				is[i] = true;
				leaf[i] = leaf[adj[i][0]];
				++cccc;
			}
		}
		cerr << cccc << endl;
		rep (i, 0, n) if (!fix[i] && adj[i].size() > 1) {
			vector<int> tmp;
			for (vector<int>::iterator it = adj[i].begin(); it != adj[i].end(); ++it)
				if (!leaf[*it]) tmp.push_back(*it);
			adj[i] = tmp;
		}
		memset(use, 0, sizeof use);
		while (1) {
			if (is[col[0]]) {
				int v = leaf[col[0]], &u = las[v];
				while (v != u && col[0] < col[v]) v = pre[v];
				rot(v);
				fix[u] = true;
				if (u == 0) return;
				u = pre[u];
			}
			else {
				hav[0] = false;
				rep (i, 1, n) if (!fix[i]) 
					hav[i] = hav[pre[i]] | is[col[i]];
				bool flag = false;
				per (i, n, 1) if (!fix[i] && !use[i]) {
					rot(i);
					use[i] = true;
					flag = true;
					break;
				}
				if (!flag) break;
			}
		}
		rep (i, 0, n) if (is[i]) assert(fix[i]);
	}
}

int main() {

	n = ri()-1;
	rep (i, 1, n) adj[pre[i] = ri()].push_back(i);
	rep (i, 0, n) col[i] = ri();
	solve();

	rep (i, 0, n) assert(col[i] == i);
	printf("%d\n", ans.size());
	for (vector<int>::iterator it = ans.begin(); it != ans.end(); ++it)
		printf("%d\n", *it);

	return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

using int64 = long long;

int main() {
	int n;
	while (true) {
		cin >> n;
		if (n == 0) break;
		vector<int64> h(n), j(n - 1);
		for (int i = 0; i < n; ++i) cin >> h[i];
		for (int i = 0; i < n - 1; ++i) cin >> j[i];

		sort(j.rbegin(), j.rend());

		int64 sum = 0;
		for (int i = 0; i < n; ++i) sum += h[i];

		int64 ans = sum * n;
		for (int i = 0; i < n - 1; ++i) {
			sum += j[i];
			int64 res = sum * (n - i - 1);
			ans = max(ans, res);
		}

		cout << ans << endl;
	}
}


Measured memory_bytes: 3888
#include<stdio.h>
int main(void){
    int a,b,c,i;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        i=0;
        c = a+b;
        while(c!=0)
        {
            c = c/10;
            i++;
        }
        printf("%d\n",i);
    }
	return 0;
 }

Measured memory_bytes: 1756
S = input()
N = len(S)

def is_pali(s):
    if s == s[::-1]:
        return True
    return False


if is_pali(S) and is_pali(S[:(N-1)//2]) and is_pali(S[(N+3)//2-1:]):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main{
		
	public static void main(String args[]){
		  
	    Scanner sc = new Scanner(System.in);
	    
	    int A = sc.nextInt();
	    int B = sc.nextInt();
	    int C = sc.nextInt();
	    int D = sc.nextInt();
	    
	    if(A*B > C*D) {
	    	System.out.println(A*B);
	    }else {
	    	System.out.println(C*D);
	    }
	}
}

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

bool used[100000*2];
vector<int> a[100000*2];
int x,y;

void dfs(int v){
  if(used[v]) return;
  used[v]=true;
  if(v<100000) x++;
  else y++;
  for(int u:a[v]){
    dfs(u);
  }
}

int main(){
  int n;
  cin>>n;
  rep(i,0,n){
    int x,y;
    cin>>x>>y;
    x--;
    y--;
    a[x].push_back(y+100000);
    a[y+100000].push_back(x);
  }
  rep(i,0,100000*2) used[i]=false;
  ll ans=0;
  rep(i,0,100000*2){
    x=0;
    y=0;
    dfs(i);
    ans+=(ll)x*y;
  }
  cout<<ans-n<<endl;
}

Measured memory_bytes: 13516
#include<bits/stdc++.h>
#define reg register
#define mod 924844033
#define maxn 3001
using namespace std;
int n, K, fac[maxn], dp[maxn][maxn][3], ans;
int d[maxn], g[maxn][maxn], cnt, sum, p, siz[maxn];
int inc(int x, int y){
    return x + y >= mod ? x + y - mod : x + y;
}
int main(){
    cin >> n >> K;
    fac[0] = 1;
    for(int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
    for(int i = 1; i <= n; i++) {
        if(d[i]) continue;
        dp[0][0][0] = 1; p = 0; cnt++;
        for(int now = i, j = 1; now <= n; now += 2 * K, j++){
            p++; d[now] = 1;
            for(int k = 0; k <= j; k++){
                dp[j][k][0] = 0; dp[j][k][1] = 0; dp[j][k][2] = 0;
                dp[j][k][0] = inc(dp[j - 1][k][1], inc(dp[j - 1][k][2], dp[j - 1][k][0]));
                if(k && now > K) dp[j][k][1] = inc(dp[j - 1][k - 1][0], dp[j - 1][k - 1][1]);
                if(k && now + K <= n) dp[j][k][2] = inc(dp[j - 1][k - 1][2], dp[j - 1][k - 1][0]);
                if(k && now + K <= n) dp[j][k][2] = inc(dp[j][k][2], dp[j - 1][k - 1][1]);
            }
        }
        for(int j = 0; j <= p; j++) g[cnt][j] = inc(dp[p][j][0], inc(dp[p][j][2], dp[p][j][1])); siz[cnt] = p;
    }
    for(int i = 1; i <= cnt; i++){
        sum += siz[i];
        for(int j = siz[i]; j >= 0; j--)
            for(int k = 1; k <= sum - siz[i]; k++)
                g[i][j + k] = inc(g[i][j + k], 1ll * g[i][j] * g[i - 1][k] % mod);
    }
    for(int i = 0; i <= n; i++) {
        g[cnt][i] = 1ll * g[cnt][i] * fac[n - i] % mod;
        if(i + 1 & 1) ans = inc(ans, g[cnt][i]);
        else ans = inc(ans, mod - g[cnt][i]); 
     }
    cout << ans << endl;

}

Measured memory_bytes: 37120
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }
 
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;
struct UF{
  vector<int> data;
  vector<int> weight;
  UF(int N) : data(N, -1), weight(N, 0) {}
  void uni(int x, int y, int w){
    P px = root(x), py = root(y);
    if(px.first != py.first){
      if(data[px.first] > data[px.first]){
        swap(px, py);
        w *= -1;
      }
      data[px.first] += data[py.first];
      data[py.first] = px.first;
      weight[py.first] = px.second - py.second + w;
    }
  }
  P root(int x){
    if(data[x] < 0) return P(x, 0);
    P p = root(data[x]);
    data[x] = p.first;
    weight[x] += p.second;
    return P(data[x], weight[x]);
  }
};
 
int main(){
  int N, M;
  while(cin>>N>>M && N){
    UF uf(N);
    string s; int x, y, z;
    REP(i, M){
      cin>>s;
      if(s == "!"){
        scanf("%d %d %d", &x, &y, &z);
        x--; y--;
        uf.uni(x, y, z);
      }else{
        scanf("%d %d", &x, &y);
        x--; y--;
        P px = uf.root(x);
        P py = uf.root(y);
        if(px.first == py.first){
          printf("%d\n", py.second - px.second);
        }else{
          printf("UNKNOWN\n");
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4608
s = int(input())
if s == 1 :
    print(4)
elif s == 2 :
    print(4)
else :
    count = 1
    while True :
        if s == 4 :
            break
        elif s % 2 == 0 :
            s //= 2
            count += 1
        else :
            s = 3 * s + 1
            count += 1
    print(count + 3)

Measured memory_bytes: 3060
N = int(input())

s = []
cnt = 0

for i in range(N) : 
    s.append(input())
    
for i in range(N) : 
    for j in range(N) : 
        if i != j : 
            if s[i] == s[j] : 
                cnt += 1
                
for i in range(0, N-1, 1) : 
    if s[i][-1] != s[i+1][0] : 
        cnt += 1
        
if cnt == 0 : 
    print("Yes")
else : 
    print("No")

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

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n;
    cin >> n;
    vector <pair <int, int>> ed;
    if (n % 2 == 0) {
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                if (i + j != n + 1) {
                    ed.push_back({i, j});
                }
            }
        }
    }
    else {
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                if (i + j != n) {
                    ed.push_back({i, j});
                }
            }
        }
    }
    cout << ed.size() << '\n';
    for (auto p : ed) {
        cout << p.first << ' ' << p.second << '\n';
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

ll calc(ll x, ll t) {
  x++;
  ll ans=x/(t*2)*t;
  x%=t*2;
  x-=t;
  return ans+max(x,0LL);
}

void Main() {
  ll l,r;
  cin >> l >> r;
  ll ans=0;
  rep(k,50) {
    ll t=1LL<<k;
    ll x=calc(l-1,t),y=calc(r,t);
    ans+=(y+x)%2*t;
  }
  pr(ans);
}

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


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
#define MAX 2000000000
#define PI 3.1415926535897932
using ll = long long;
using Graph = vector<vector<int>>;
//二項係数を求める。

int main(){
  int N; cin>>N;
  string S; cin>>S;
  if(N%2!=0){
    cout<<"No"<<endl;
    return 0;
  }
  rep(i,N/2){
    if(S.at(i)!=S.at(i+N/2)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var n = F();
		var a = new long[n + 1];
		a[0] = 2;
		a[1] = 1;
		for (var i = 2; i <= n; i++) a[i] = a[i - 1] + a[i - 2];
		WriteLine(a[n]);
	}
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
const int mod = 1e9+7;

ll f1[200005], f2[200005];
ll pow2(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b%2 == 1) ans = ans*a%mod;
        a = a*a%mod;
        b/=2;
    }
    return ans;
}
ll nCr(int a, int b){
    return f1[a]*f2[b]%mod*f2[a-b]%mod;
}

int main(){
    f1[0] = f2[0] = 1;
    for(int i=1;i<=200000;i++){
        f1[i] = f1[i-1]*i%mod;
        f2[i] = pow2(f1[i], mod-2);
    }
    int h, w, a, b;
    scanf("%d%d%d%d", &h, &w, &a, &b);
    ll ans = nCr(h-1+w-1, h-1);
    for(int i=1;i<=b;i++){
        int r = h-a;
        int c = i;
        ll res = nCr(r-1+c-1, r-1)*1ll*nCr(h-(r+1)+w-c, h-(r+1))%mod;
        ans = (ans - res + mod)%mod;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 2e5+100;
const ll R2 = modInv(2, MOD);
int b, w;
ll bb=1, ww=1, fac[N], rfac[N], r=1, p=1;
ll comb(int a, int b){
  if(b < 0 || a < b) return 0;
  return fac[a] * rfac[b] % MOD * rfac[a-b] % MOD;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> b >> w;
  fac[0] = 1;
  rfac[0] = 1;
  FOR(i, 1, N){
    fac[i] = fac[i-1] * i % MOD;
    rfac[i] = modInv(fac[i], MOD);
  }
  FOR(i, 0, b+w){
    bb = (bb*2 - comb(i-1, b-1) + MOD) % MOD;
    ww = (ww*2 - comb(i-1, w-1) + MOD) % MOD;
    r = r * R2 % MOD;
    printf("%d\n", (bb+p-ww+MOD) * r % MOD);
    p = p * 2 % MOD;
  }
}

Measured memory_bytes: 5376
from bisect import bisect_left



def index(a, x):
    ''' Locate the leftmost value exactly equal to x
    http: // docs.python.jp / 3.5 / library / bisect.html
    '''
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError


if __name__ == '__main__':
    # ??????????????\???
    # S = [1, 2, 3, 4, 5]
    # T = [3, 4, 1]
    num = int(input())
    S = [int(x) for x in input().split(' ')]
    num = int(input())
    T = [int(x) for x in input().split(' ')]

    # ????´¢??????
    found = 0
    for t in T:
        try:
            index(S, t)
        except ValueError:
            pass
        else:
            found += 1

    # ???????????????
    print(found)

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

int main(){
    int N,K;
    cin >> N >> K;
    double prob = 0.0;
    for(int i=1;i<=N;i++){
        double a=i;
        double n=log(double(K)/a)/log(2.0);
        int powd = max(0, int(n+1.0));
        if(int(a*pow(2.0,powd-1)) == K) powd--;
        powd = max(0,powd);
        double tmp = pow(0.5,double(powd));
        // if(tmp!=1.0){
        //     cout << powd << " " << a*pow(2.0,powd) << " " << a*pow(2.0,powd)/2.0 << " " << tmp << endl;
        // }
        
        prob += tmp;
    }
    prob = prob/double(N);
    printf("%.11f\n",prob);
    return 0;
}

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

int main ()
{
	vector<int> c(9);

	for (int i=0; i<9; ++i)
	{
		cin >> c[i];
	}

	for (int i=1; i<3; ++i)
	{
		int c_i0 = c[i * 3];
		int c_i1 = c[i * 3 + 1];
		int c_i2 = c[i * 3 + 2];

		c_i0 -= c[0];
		c_i1 -= c[1];
		c_i2 -= c[2];

		if (c_i0 != c_i1 || c_i0 != c_i2)
		{
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll h,w,n;cin>>h>>w>>n;
  vll a(0);vvll c(h,vll(w));
  rep(i,0,n){
    ll t;cin>>t;
    rep(j,0,t){
      a.push_back(i+1);
    }
  }

  rep(i,0,h){
    if(i%2){
      rep(j,0,w){
        c[i][j]=a[w*i+j];
      }
    }
    else{
      rep(j,0,w){
        c[i][w-j-1]=a[w*i+j];
      }
    }
  }
  rep(i,0,h){
    rep(j,0,w){
      cout<<c[i][j]<<" ";
    }
    cout<<endl;
  }
  
}


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
#define debug 1

int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
	return 0;
}


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

typedef long long ll;

int n,s[200000];

bool solve()
{
	ll sum=0;int c=0,co=0,c2=0;
	if(n==1)return s[0]!=1;
	for(int i=0;i<n;i++)
	{
		sum+=s[i];
		c+=s[i]==1;
		co+=s[i]&1;
		c2+=s[i]==2;
	}
	if(c||co>1)return(sum-n)&1;
	if(~(sum-n)&1)
	{
		if(co==0)return 0;
		int t=0;
		for(int i=0;i<n;i++)
		{
			int v=s[i]&~1;
			t=std::__gcd(t,v);
		}
		for(int i=0;i<n;i++)
			s[i]/=t;
		return !solve();
	}
	if(c2||co==1)return 1;
	int mv=2e9,po;
	for(int i=0;i<n;i++)
	{
		if(s[i]<mv)mv=s[i],po=i;
	}
	s[po]--;
	return !solve();
}

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",s+i);
	bool ans=solve();
	puts(ans?"First":"Second");
}

Measured memory_bytes: 512
import collections

n = int(input())

scores = collections.defaultdict(list)

for i in range(1, n + 1):
    city, score = input().split()
    scores[city].append([i, int(score)])

# print(scores)

for city in sorted(scores):
    sorted_score = sorted(scores[city], key=lambda x: x[1], reverse=True)
    for v in sorted_score:
        print(v[0])


Measured memory_bytes: 3316
fun main(args: Array<String>) {
    abc121d()
}

fun abc121d() {
    val (a, b) = readLine()!!.split(' ').map { it.toLong() }

    fun calc(x: Long): Long {
        return when {
            x <= 0L -> 0
            x % 2 == 1L -> if ((x + 1) / 2 % 2 == 0L) 0L else 1L
            else -> return calc(x - 1) xor x
        }
    }

    val answer = calc(a - 1) xor calc(b)

    println(answer)
}


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

int g(ll x) {
  int d = 0;
    while(x>0){
    d++;
    x /= 10;
  }
    return d;
}

int top(ll x){
  while(x>=10){
    x /= 10;
  }
  return x;
}

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

  ll m = n;
  int d = g(n);
  bool flag = 1;
  rep(i,d-1) {
    if(m%10 != 9) flag = 0;
    m /= 10;
  }

  int ans;
  if(flag) ans = top(n)+9*(d-1);
  else{
    ans = top(n)-1+9*(d-1);
  }
  cout << ans  << endl;
}


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

int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n%2 == 1){
        cout << "No";
        return 0;
    }
    for(int i = 0 ; i < n/2 ; i += 1){
        if(s[i] != s[i+n/2]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>   
using namespace std;
#define N 3005  
#define REP(i, n) for(int i=0; i<n; i++)
int n;
float x[N];
string u[N];
float ans;
int main() {
    cin>>n;
    REP(i,n){
        cin>>x[i]>>u[i];
    }
    REP(i,n){
        if(u[i]=="JPY"){
            ans+=x[i];
        }else{
            ans+=x[i]*380000;
        }
    }
    printf("%f",ans);
 }


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

int main(){
	int K, S;
	cin >> K >> S;
	
	int i, j, k, /*count=0;*/count1=0, count3=0, count6=0;
	for(i=0; i<=K; i++){
		for(j=i; j<=K; j++){
			for(k=j; k<=K; k++){
//				cout << i << j << k << endl;
				if(i+j+k==S){
					//count++;
					if(i==j && j==k)	count1++;
					else if(i==j || j==k)	count3++;
					else			count6++;
				}
			}
		}
	}

//	cout << count << endl;	
	cout << count1 + 3*count3 + 6*count6 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  string S;
  cin >> S;
  vll a(N, 0);
  for(int i = 0; i < N; i++){
    if(S.at(i) == '#') a.at(i) = 1;
  }
  vll sum(N+1, 0);
  for(int i = 0; i < N; i++){
    sum.at(i+1) = sum.at(i) + a.at(i);
  }
  ll ans = INF;
  for(int i = 0; i <= N; i++){
    //~i-1番目までの黒
    ll black = sum.at(i);
    //i番目以降の白
    ll white = N - 1 - i + 1 - (sum.at(N) - sum.at(i));
    chmin(ans, black+white);
  }
  cout << ans << endl;
}

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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    int k; cin >> k;
    priority_queue<ll, vector<ll>,  greater<ll>> q;
    REP(i, 1, 10){
        q.push(i);
    }
    int count = 0;
    while(1){
        ll c = q.top();
        //cout << c << endl;
        q.pop();
        count++;
        if(count == k){
            cout << c << endl;
            return 0;
        }
        ll k = c % 10;
        if(k-1 >= 0){
            q.push(c * 10 + (k-1));
        }
        q.push(c*10 + k);
        if(k+1 <= 9){
            q.push(c * 10 + (k+1));
        }
    }
}

Measured memory_bytes: 2420
#include <stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, key;
  int A[N+1];
  scanf("%d", &n);

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

  for(j = 1; j <= n; j++){
    key = A[j];
    i = j - 1;
    while(i > 0){
      if(A[i] > key){
	A[i+1] = A[i];
	i = i - 1;
      }
      else break;
    }
    A[i+1] = key;

    if(j >= 2) trace(A, n);
  }
  return 0;
}

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

int main() {
	// your code goes here
    int n,i,ans=0;
    char s[105];
    cin >> s;
    n=strlen(s);
    for(i=0;i<n/2;i++) if(s[i]!=s[n-1-i]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int du[10];
int main()
{
	for (int i=1;i<4;i++)
	{
		int x,y;
		cin>>x>>y;
		du[x]++;
		du[y]++;
	}
	sort(du+1,du+5);
	if (du[1]==1 && du[2]==1 && du[3]==2 && du[4]==2)
	{
		puts("YES");
	}
	else
	{
		puts("NO");
	}
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;
        List<Integer> inputs = new ArrayList<>();
        while ((line = br.readLine().trim()) != null && !line.isEmpty() && !"0 0".equals(line)) {
            output(line);
        }
    }

    public static void output(String inputs) {
        List<Integer> list = Arrays.stream(inputs.split(" ")).map(Integer::valueOf).collect(Collectors.toList());

        int people = list.get(0);
        int stone = list.get(1);

        int cnt = 0;
        int now = stone;
        Integer[] tmp  = new Integer[people];
        for(int i = 0; i < people; i++) {
            tmp[i] = 0;
        }

        while (true) {
            if(0 < now) {
                now--;
                tmp[cnt]++;
            }
            else if(0 == now && 0 < tmp[cnt]) {
                now+=tmp[cnt];
                tmp[cnt] = 0;
            }
            if(tmp[cnt] == stone) {
                System.out.println(cnt);
                break;
            }
            if(++cnt == people) cnt = 0;
        }
    }
}

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

int main(int argc, char const *argv[]) {
  int n, count = 0;
  int a[100];

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

  for (int i = 0; i < n; i++) {
    int minj = i;
    for (int j = i + 1; j < n; j++) {
      if (a[j] < a[minj]) minj = j;
    }

    if (i != minj) {
      swap(a[i], a[minj]);
      count++;
    }
  }

  for (int i = 0; i < n; i++) cout << a[i] << ((i == n - 1) ? '\n' : ' ');
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3084
n=int(input())
x=list(map(int,input().split()))
dic={}
for i in range(n):
  if x[i] in dic.keys():
    dic[x[i]]+=1
  else:
    dic[x[i]]=1
s=0
for i in dic.keys():
  s+=dic[i]*(dic[i]-1)//2
for i in range(n):
  print(s-dic[x[i]]+1)


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

int main(){
    int N,ans=0;
    cin >> N;
    for (int i=1;i<=N;++i){
        if(1<=i && i<=9) ++ans;
        if(100<=i && i<=999) ++ans;
        if(10000<=i && i<=99999) ++ans;
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B1 = 0
for i,a in enumerate(A):
    if i%2 == 1:
        B1 -= a
    else:
        B1 += a
B1 = int(B1)//2
B = [B1]
for i, a in enumerate(A[:-1]):
    B.append(a-B[i])
B = [str(b*2) for b in B]
print(' '.join(B))


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

int main(){
    string s1,s2;
    cin >> s1 >> s2;
    s1=s1+s1;
    if (s1.find(s2)!=-1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3212
# -*- coding: utf-8 -*-


def converter(a, b):
    if a == 0:
        return b
    else:
        return converter(b % a, a)


def main():
    a, b = sorted([int(x) for x in raw_input().strip().split(' ')])
    print converter(a, b) 


if __name__ == '__main__':
    main()

Measured memory_bytes: 6424
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char s[100005];
int win=0,los=0,len,maxn=1000000,pa,ro;
void dfs(int k)
{
//	for(int j=1;j<=2;j++){
//		
//	}
	
	if(s[k]=='g'){
		if(pa+1<=ro){
			win++;
			pa++;
			dfs(k+1);
			pa--;
			win--;
//			cout<<
	//		if(los+1<=win){
	//			los++;
	
	//			dfs(k+1);
				
	//			los--;
	//		}
			
			
			
		}
		else{
	//		los++;
				ro++;
				dfs(k+1);
				ro--;
	//		los--;
			}
		
	}
	if(s[k]=='p'){
		if(pa+1<=ro){
		
//		if(los<=win+1){
			pa++;
			dfs(k+1);
			pa--;
//		}
//		win++;
//			dfs(k+1);
//		win--;
		}
		else{
			los++;
			ro++;
			dfs(k+1);
			ro--;
			los--;
		}
	}
	if(k==len&&pa<=ro){
		if(maxn>(win-los))maxn=(win-los);
//		cout<<win-los<<" ";
	}
	
}
int  main(){
	scanf("%s",&s);
len=strlen(s);
//	cout<<len;
	dfs(0);
//	for(int i=0;i<len;i++){
//		if(s[i]=='g'&&los<=win)win++;
//		else los++;
//		if(s[i]=='p'&&los<=win)los++;
//		else win++;
//	}
//	cout<<win-los;ggppgggpgg
cout<<maxn;
}

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	int N,Q;
  string s;
  cin >> N >> Q;
  cin >> s;
    vector<int> sum(N,0);
 froop1(1,N){
    if(s[i - 1] =='A' && s[i] == 'C') sum.at(i) = 1;
    sum.at(i) += sum.at(i - 1);
  }
  
  froop1(0,Q){
    int r,l;
    cin >> r >> l;
    cout << sum.at(l - 1) - sum.at(r - 1) << endl;
  }
  

return 0;
  }

Measured memory_bytes: 3844
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  // A, C, G, T が存在し、A と T、C と
  char b;
  cin >> b;

  char ans;
  if (b == 'A') {
    ans = 'T';
  } else if (b == 'C') {
    ans = 'G';
  } else if (b == 'G') {
    ans = 'C';
  } else if (b == 'T') {
    ans = 'A';
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
    int n;
    cin >> n;
    bool check = false;

    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
            if(i*j == n){
                check = true;
            }
        }
    }
    if(check){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		int[] prize = new int[]{6000, 4000, 3000, 2000};
		
		for(int i = 0; i < 4; i++){
			final int t = sc.nextInt() - 1;
			final int n = sc.nextInt();
			
			System.out.println(prize[t] * n);
		}
		
	}

}

Measured memory_bytes: 17364
#include <bits/stdc++.h>
#define i64 long long
using namespace std;
 
int main() {
	// your code goes here
	int n; cin>>n;
	int a[n+2];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	cout<<a[n-1]-a[0]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
const double pi = acos(-1);
const int sz = 200002;
int n, m, q, k;
string s, t;
int main() {
	io
	cin>>n>>k;
	priority_queue<int, vector<int>, greater<int>>pq;
	for(int i = 0; i<n; i++) {
		int a;
		cin>>a;
		pq.push(a);
	}
	int ans = 0 ;	
	while(k--) {
		ans += pq.top();
		pq.pop();
	}
	cout<<ans;
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.14159265358979323846

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

  int chk = 1, ans = 0, f = 1;
  for(i=0; i<N; i++){
    if(a[i] == chk){
      chk++;
      f = 0;
    }else{
      ans++;
    }
  }

  if (f == 1){
    printf("-1\n");
    return 0;
  }
  printf("%d\n", ans);
  

  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int a=0,b=0,c=0,d=0;
    bool flag=false;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='W') a++;
        if(s[i]=='E') b--;
        if(s[i]=='N') c++;
        if(s[i]=='S') d--;
    }
    if((a==0&&b==0||a&&b)&&(c==0&&d==0||c&&d))
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;
const int MOD=1e9+7;

int ans=1;
int vis[N];

int32_t main()
{
	IOS;
	int n;
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		if(vis[i])
			continue;
		int cur=i;
		int cnt=0;
		while(cur<=n)
		{
			cnt+=n/cur;
			cur*=i;
		}
		for(int j=2;i*j<=n;j++)
			vis[i*j]=1;
		ans*=(1+cnt);
		ans%=MOD;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n+1];
        for (int i = 2; i <= n; i++) {
            int x = i;
            for (int j = 2; j <= i; j++) {
                while(x % j == 0){
                    a[j]++;
                    x /= j;
                }
                if(x < 2) break;
            }
        }
        long ans = 1L;
        for (int i = 2; i < n+1; i++) {
            if(a[i] > 0) ans = ans * (a[i] + 1) % 1_000_000_007;
        }
        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> dp(n + 1, 0);
    rep(i, n) dp[i + 1] = dp[i] + a[i];
    multiset<ll> b;
    reps(l, 1, n + 1) {
        reps(r, l, n + 1) {
            b.insert(dp[r] - dp[l - 1]);
        }
    }
    ll ans = 0;
    rrep(i, 40) {
        ll bit = 1LL << i;
        ll cnt = 0;
        auto it = b.end(); it--;
        set<ll> s;
        while(true) {
            if ((*it & bit) == bit) cnt++;
            else s.insert(*it);
            if (it == b.begin()) break;
            it--;
        }
        if (cnt >= k) {
            ans |= bit;
            for(auto x : s) b.erase(x);
        }
        // printf("i=%lld, cnt=%lld, ans=%lld\n", i, cnt, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 47388
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>


long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;
int second[10];
bool s[10];
void bits(int i){
    for(int k=9;k>=0;k--){
        if(i<second[k]){
        s[k]=false;
        }
        else{
        i-=second[k];
        s[k]=true;
        }
    }
}

void sets(){
    int l=0;
    int k=1;
    while(k<1024){
        second[l]=k;
        k*=2;
        l++;
    }
}
int main(){
int N;
cin>>N;//店の数
bool store[N][10]={};
for(int i=0;i<N;i++){
    for(int k=0;k<10;k++){
        int c;
        cin>>c;
        if(c==1){
            store[i][k]=true;
        }
    }
}

int p[N][11];
for(int i=0;i<N;i++){
    for(int k=0;k<11;k++){
        cin>>p[i][k];
    }
}
sets();

long long ans=-10000000000;
for(int i=1;i<1024;i++){
    bits(i);
    long long total=0;
    int cnt[N]={};
    for(int k=0;k<10;k++){
        for(int l=0;l<N;l++){
            if(s[k] && store[l][k]){
            cnt[l]++;
            }
        }
    }

    for(int i=0;i<N;i++){
    total+=p[i][cnt[i]];
    }
    ans=max(ans,total);

}



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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

int main() {
	u64 N;
	cin >> N;
	
	set<string> S;
	
	for(u64 t=0; t<N; t++) {
		string c;
		cin >> c;
		S.insert(c);
	}
	
	cout << S.size();
	return 0;
}

Measured memory_bytes: 19224
import java.util.Scanner;

//??\??????????¨?????¨??????????
public class Main {
	static Scanner sc = new Scanner(System.in);
	private static final int QUESTION_NUM = 10; //???????????°

	public static void main(String[] args) {
		int ans = 0; //??????????´???¨
		for(int $ = 0; $ < QUESTION_NUM; $++) {
			ans += sc.nextInt();
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 26228
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,k,n,cnt;
string s,t;
char c;
signed main()
{
	cin>>c;
	c+=1;
	cout<<c;
}

Measured memory_bytes: 256
from collections import deque
N,M = map(int,input().split())
LRD = []
P = [float('inf') for i in range(N)]
Edges = [[] for i in range(N)]
for i in range(M):
    L,R,D = map(int,input().split())
    L -= 1
    R -= 1
    Edges[R].append((L,-D))
    Edges[L].append((R,D))
for i in range(N):
    Q = deque()
    if P[i] == float('inf'):
        P[i] = 0
        Q.append(i)
    while Q:
        current_pos = Q.popleft()
        for next_pos, d in Edges[current_pos]:
            if P[next_pos] == float('inf'):
                P[next_pos] = P[current_pos] + d
                Q.append(next_pos)
            else:
                if P[next_pos] != P[current_pos] + d:
                    print('No')
                    exit()
print('Yes')

Measured memory_bytes: 68592