akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;

ll dp[305][305][305];
vector<vector<pair<int,int> > > z;

bool check(int j, int k, int p)
{
    assert(j<=k);
    assert(k<p);
    int siz=z[p].size();
    int i;
    for(i=0; i<siz; i++) {
        int l=z[p][i].first;
        int num=z[p][i].second;
        if(num==1) {
            if(k>=l) return false;
        }
        else if(num==2) {
            if(l>k || l<=j) return false;
        }
        else {
            if(l>j) return false;
        }
    }
    return true;
}

int main(int argc, char* argv[])
{
    int n,m;
    scanf("%d%d", &n, &m);
    
    z.resize(n+1);
    int i;
    for(i=0; i<m; i++) {
        int l,r,x;
        scanf("%d%d%d", &l, &r, &x);
        z[r].push_back(make_pair(l,x));
    }

    dp[0][0][0]=1;
    int j,k;
    for(i=0; i<n; i++) {
        for(j=0; j<=i; j++) {
            for(k=j; k<=i; k++) {
                if(dp[i][j][k]) {
                    if(check(j,k,i+1)) {
                        dp[i+1][j][k]=(dp[i+1][j][k]+dp[i][j][k])%MOD;
                    }
                    if(check(j,i,i+1)) {
                        dp[i+1][j][i]=(dp[i+1][j][i]+dp[i][j][k])%MOD;
                    }
                    if(check(k,i,i+1)) {
                        dp[i+1][k][i]=(dp[i+1][k][i]+dp[i][j][k])%MOD;
                    }
                }
            }
        }
    }

    ll ans=0;
    for(j=0; j<n; j++) {
        for(k=j; k<n; k++) {
            ans=(ans+dp[n][j][k])%MOD;
        }
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 217472
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a == b){
            System.out.println("a == b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a < b");
        }
    }
}


Measured memory_bytes: 26212
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <bitset>
#include <queue>

#define pb push_back
#define ins insert
#define pob pop_back
#define er erase
#define emp empty
#define f first
#define s second
#define ff f.f
#define fs f.s
#define sf s.f
#define ss s.s
#define var auto
#define M int main()
#define For(itr,max) for(int itr = 0;itr <= max;itr++)

using namespace std;
template<typename  T>
using s = set<T>;
template<typename T>
using  v = vector<T>;
template<typename T1, typename  T2>
using p = pair < T1, T2>;
typedef p<int, int> pii;
typedef v<int> vi;
typedef v<pii> vpii;
typedef s<int> si;
typedef s<pii> spii;
typedef long long ll;


//const int Max = 1e8 + 10;
const int Mx = 1e5;
ll n;
ll H[Mx];
ll dpA[Mx];
ll dpB[Mx];
ll dpC[Mx];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a, b, c; cin >> a >> b >> c;
		if (i == 0)
		{
			dpA[0] = a;
			dpB[0] = b;
			dpC[0] = c;
		}
		else
		{
			dpA[i] = a +  max(dpB[i - 1], dpC[i - 1]);
			dpB[i] = b + max(dpA[i - 1], dpC[i - 1]);
			dpC[i] = c + max(dpB[i - 1], dpA[i - 1]);
		}
	}
	cout << max(max(dpB[n - 1], dpC[n - 1]), dpA[n - 1]);
}

Measured memory_bytes: 2560
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    k = int(input())
    if k%2==0 or k%5==0:
        print(-1)
        exit()
    
    x = 7
    ans = 1
    while x % k != 0:
        x = (x*10 + 7) % k
        ans += 1
    print(ans)
main()

Measured memory_bytes: 68052
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var input = cin.ReadLine.Split(' ');
            var x = int.Parse(input[0]);
            var y = int.Parse(input[1]);

            int result = 0;
            for (int i = 0; i < 2; i++)
            {
                if (x > y)
                {
                    result += x;
                    x--;
                }
                else
                {
                    result += y;
                    y--;
                }
            }
            Console.Write(result);
        }
    }
    public class deci
    {
        public bool IsFinish { get; set; } = false;
        public int Len { get; set; }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define rep(i, n) for(int i = 0; i < n; i++)
#define run(i, a, b) for(int i = a; i < b; i++)
#define cinarr(arr, n) rep(_i, n) cin >> arr[_i]
#define cinset(st, n) int _t; rep(i, n) {cin >> _t; st.insert(_t);}
#define coutarr(arr, n) rep(_i, n) cout << arr[_i] << " "; cout << endl
#define coutvec(vec) for(auto _e: vec) cout << _e << " "; cout << endl;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define F first
#define S second
#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

int main() {
    FAST_IO

    int n, m;
    cin >> n >> m;

    vector<vector<int>> adj(n);

    rep(i, m){
        int a, b;
        cin >> a >> b;

        a--;
        b--;
        
        adj[a].pb(b);
        adj[b].pb(a);
    }

    ll connected = 0;

    vector<bool> vis(n, false);
    queue<int> q;

    for(int i = 0; i < n; i++){
        if(vis[i]) continue;
        connected++;
        q.push(i);
        while(!q.empty()){
            int nd = q.front();
            q.pop();
            vis[nd] = true;
            for(auto node: adj[nd]){
                if(!vis[node])
                    q.push(node);
            }
        }
    }

    cout << (connected - 1) << endl;
}


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

int main() {
    string s,t,k;
    cin>>s>>t;
    rep(i,s.size()) {
        k=s[s.size()-1];
        k+=s.substr(0,s.size()-1);
        if (k==t) {
            cout<<"Yes"<<endl;
            return 0;
        }
        s=k;
    }
    cout<<"No"<<endl;
    return 0;
}   


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>

#define LL long long

using namespace std;

inline LL read() {
    LL x = 0, f = 1;
    char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while('0' <= c && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int main() {
    LL x = read();
    LL now = 100;
    int cnt = 0;
    while(now < x) {
        now *= 1.010;
        ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll INF64 = 1e18;

template <typename T>
string to_string(const vector<T> &v) {
    string ret = "<";
    for (auto it : v) {
        ret += to_string(it) + ", ";
    }
    ret.pop_back(); ret.pop_back();
    ret += ">";
    return ret;
}

void debug_print() { cerr << endl; }

template <typename T, typename ...U>
void debug_print(T t, U... u) {
    cerr << " " << to_string(t);
    debug_print(u...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_print(__VA_ARGS__)
const int N = 1e5 + 5;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  vector<int> C;
  int N,T,c,t;
  cin>>N>>T;
  for(int i=0;i<N;i++){
    cin>>c>>t;
    if(t<=T)C.push_back(c);
  }
  if(C.empty())cout<<"TLE";
  else cout<<*min_element(C.begin(),C.end());
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i,n) for (int i = 0; i < n; i++)
# define sort(v) sort(v.begin(),v.end())
# define rsort(v) reverse(v.begin(),v.end())
# define all(v) v.begin() ,v.end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const long long INF = 1LL << 60;

ll A,B,K;

int main()
{
  cin >> A >> B >> K;
  if(A < K){
    auto rest = K - A;
    A = 0;
    if(B < rest){
      cout << 0 << " " << 0 << endl;
    }else{
      B -= rest;
      cout << A << " " << B << endl;
    }
  }else{
    A -= K;
    cout << A << " " << B << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
 
#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 1000005
int n;
int a[MN];

int np2[MN];
int choose(int a, int b){
    if(np2[a]-np2[a-b]-np2[b] == 0) return 1;
    else return 0;
}

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

    cin >> n;
    FOR(i, 1, n){
        np2[i] = i/2+np2[i/2];
    }
    //cout << np2[10];
    int ree = 0;
    bool hz = false, ho = false, ht = false;
    FOR(i, 1, n){
        char c;
        cin >> c;
        a[i] = c-'1';
        ree += a[i]*choose(n-1, i-1);
        ree %= 2;
        if(a[i] == 0) hz = true;
        if(a[i] == 1) ho = true;
        if(a[i] == 2) ht = true;
    }
    if(ree == 1){
        cout << "1\n";
    } else{
        if(ho){
            cout << "0\n";
        } else{
            ree = 0;
            FOR(i, 1, n){
                a[i] /= 2;
                ree += a[i]*choose(n-1, i-1);
                ree %= 2;
            }
            if(ree == 1){
                cout << "2\n";
            } else{
                cout << "0\n";
            }
        }
        /*if(hz && ht && !ho){
            cout << "2\n";
        } else{
            cout << "0\n";
        }*/
    }

    return 0;
}


Measured memory_bytes: 8064
<?php
  fscanf(STDIN,"%s",$s);
 $j = strlen($s)-1;
 $c = 0;
 for($i=0;$i<(int)(strlen($s)/2);$i++){
   if($s[$j] != $s[$i]){
     $c++;
   }
   $j--;
 }
 echo $c;


Measured memory_bytes: 16240
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( 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 ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
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" ) } ; }

#[allow(unused_macros)]
macro_rules! chmin {
    ( $ x : expr , $ y : expr ) => {
        if $x > $y {
            $x = $y;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        a: u64, b: u64, c: u64
    }

    let mut ret = 1u64 << 60;
    chmin!(ret,a+b);
    chmin!(ret,a+c);
    chmin!(ret,b+c);
    println!("{}", ret);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define MOD 1000000007
using namespace std;

vector<ll> g[200001];
ll vis[200001];
ll val[200001];
ll idx;
void fun(ll u,ll pa)
{
	vis[u]=1;
	val[u]=idx;
	for(ll i=0;i<g[u].size();i++){
		ll v=g[u][i];
		if(!vis[v]){
			fun(v,u);
		}
	}
}
int main()
{
	ll t;
//	cin>>t;
	t=1;
	while(t--){
		ll n,m;
		cin>>n>>m;
		for(ll i=1;i<=m;i++){
			ll u,v;
			cin>>u>>v;
			g[u].pb(v);
			g[v].pb(u);
		}
		for(ll i=1;i<=n;i++){
			if(!vis[i]){
				idx++;
				fun(i,-1);
			}
		}
		ll cnt[200001]={};
		for(ll i=1;i<=n;i++){
			cnt[val[i]]++;
		}
		ll ans=0;
		for(ll i=1;i<=200000;i++){
			ans=max(ans,cnt[i]);
		}
		cout<<ans<<"\n";
	}
	return 0;
}


Measured memory_bytes: 28528
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())
a=list(map(int, input().split()))
q=int(input())

b=[]
c=[]
for i in range(q):
    A, B = map(int, input().split())
    b.append(A)   
    c.append(B)

from collections import Counter
su=sum(a)
a=Counter(a)
#print(a)

for i in range(q):
    a[c[i]]+=a[b[i]]
    su+=(c[i]*a[b[i]]-b[i]*a[b[i]])

    a[b[i]]=0
    print(su)
#print(sum(a))

Measured memory_bytes: 29148
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-3;
const double PI = acos(-1);

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

string s[300];
int n;
int tate[300][300], yoko[300][300], naname1[300][300], naname2[300][300];

int main(){
	while(cin>>n && n){
		rep(i, n) cin>>s[i];
		int ans = 0;
		rep(i, 300) rep(j, 300) tate[i][j] = yoko[i][j] = naname1[i][j] = naname2[i][j] = 0;
		rep(i, n){
			rep(j, n){
				tate[i+1][j+1] = (s[i][j]=='1'?tate[i][j+1]+1:0);
				yoko[i+1][j+1] = (s[i][j]=='1'?yoko[i+1][j]+1:0);
				naname1[i+1][j+1] = (s[i][j]=='1'?naname1[i][j]+1:0);
				ans = max({ans, tate[i+1][j+1], yoko[i+1][j+1], naname1[i+1][j+1]});
			}
		}
		for(int i = n; i > 0; i--){
			for(int j = 1; j <= n; j++){
				naname2[i][j] = (s[i-1][j-1]=='1'?naname2[i+1][j-1]+1:0);
				ans = max(ans, naname2[i][j]);
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 4604
using System;

class Nationalbudget
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int p, q,a,b;
        string s1, s2;
        int[] sum;
        char[] c1, c2;

        for(int i=0; i< n; i++)
        {
            s1 = Console.ReadLine();
            s2 = Console.ReadLine();
            a = Math.Max(s1.Length, s2.Length);      
            b = Math.Min(s1.Length, s2.Length);
            sum = new int[a+1];
            c1 = s1.ToCharArray();
            c2 = s2.ToCharArray();
            Array.Reverse(c1);
            Array.Reverse(c2);
            if (a > 80) { Console.WriteLine("overflow"); continue; }

            for(int j = 0; j < b;j++)
            {
                p = int.Parse(c1[j].ToString());
                q = int.Parse(c2[j].ToString());
                sum[j] += (p + q);

            }

            for (int j = b; j < a; j++)
            {
                if (s1.Length >= s2.Length)
                    sum[j] += int.Parse(c1[j].ToString());
                else
                    sum[j] += int.Parse(c2[j].ToString());
            }
            for (int l = 0; l < a; l++)
            {
                if (sum[l] >= 10) { sum[l + 1] += sum[l] / 10; sum[l] = sum[l] % 10; }
            }
            if (sum.Length == 81 && sum[sum.Length-1] != 0) 
                  { Console.WriteLine("overflow");continue; };
            if (sum[sum.Length - 1] != 0) Console.Write(sum[sum.Length - 1]);
            for (int k=sum.Length-2; k>= 0; k--)
            {
                Console.Write("" + sum[k]);
            }
           
            Console.WriteLine();
        }
    }

}

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


void solve(){
    int n , k;
    cin>>n;
    cin>>k;
    const int INF = 1e9+5;
    vector <int> dp(n+1,INF);
    int H[n+1];
    for(int i = 1;i<n+1;i++){
        cin>>H[i];
    }
    dp[1]=0;
    dp[2] = abs(H[1]-H[2]);

    for(int i =1;i<n+1;i++){
        for(int j = i+1;j<=i+k;j++){
            if(j<n+1){
                dp[j]=min(dp[j],dp[i]+abs(H[i]-H[j]));
            }
        }
    }

cout<<dp[n]<<endl;


}

int main(){
solve();
}

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

string S;

void solve(){
    if(S == "Sunny") cout << "Cloudy";
    else if(S == "Cloudy") cout << "Rainy";
    else cout << "Sunny";

}
int main(){
    cin >> S;
    solve();
    return 0;
}

Measured memory_bytes: 256
N = 100005
primes = [True]*N
primes[0] = False
primes[1] = False
for i in range(2,N):
  for j in range(i+i,N,i):
    primes[j] = False
#print(primes)

likenums = [False]*N
for k in range(1,N,2):
  likenums[k] = (primes[k] and primes[(k+1)//2])

integ = [0]*N
for k in range(1,N):
  integ[k] = integ[k-1]+(1 if likenums[k] else 0)
#print(integ)

Q = int(input())
for q in range(Q):
  l,r, = map(int,input().split())
  print(integ[r]-integ[l-1])


Measured memory_bytes: 54936
//
// Created on 2020/03/07.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

int main() {
    string ans = "No";
    string s;
    cin>>s;
    if (s[0] != s[1]){
        ans = "Yes";
    }
    else if(s[1] != s[2]){
        ans ="Yes";
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    N,M,X = LMIIS()
    books = []
    for _ in range(N):
        books.append(LMIIS())
    up = 12 * 10**5 + 1
    min_cost = up
    for i in range(2**N):
        algo = [0]*M
        cost = 0
        for j in range(N):
            if i & (2**j):
                cost += books[j][0]
                for k in range(M):
                    algo[k] += books[j][k+1]
        if min(algo) < X:
            continue
        min_cost = min(min_cost,cost)
    print(min_cost if min_cost != up else -1)

        



if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
	while(true){
		int N, M;
		cin >> N >> M;
		if(N == 0 && M == 0){ break; }
		int r;
		cin >> r;
		vector< vector<int> > logs(M + 1, vector<int>(1261));
		for(int i = 0; i < r; ++i){
			int t, n, m, s;
			cin >> t >> n >> m >> s;
			logs[m][t] += (s > 0) ? 1 : -1;
		}
		int q;
		cin >> q;
		for(int i = 0; i < q; ++i){
			int ts, te, m;
			cin >> ts >> te >> m;
			vector<int> integral(logs[m]);
			for(int j = 0, s = 0; j < integral.size(); ++j){
				s += integral[j];
				integral[j] = s;
			}
			int answer = 0;
			for(int j = ts; j < te; ++j){
				if(integral[j] > 0){ ++answer; }
			}
			cout << answer << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 49160
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << x << ", ";
#define ll long long
#define pb push_back
using namespace std;
#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
int dp[100005][3] = {};
int main()
{
    FAST_IO
    int n;
    cin >> n;
    vector<vector<int>> A(n, vector<int>(3));
    for (int i = 0; i < n; i++)
    {
        cin >> A[i][0] >> A[i][1] >> A[i][2];
    }
    dp[0][0] = A[0][0];
    dp[0][1] = A[0][1];
    dp[0][2] = A[0][2];
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            dp[i][j] = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]) + A[i][j];
        }
    }
    cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    int n;
    cin >> n;
    ll sum = 0;
    rep(i,n){
        ll l,r = 0;
        cin >> l >> r;
        sum += (r-l+1);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

#include <atcoder/all>
using namespace atcoder;

int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        int n,m,a,b;
        scanf("%d%d%d%d",&n,&m,&a,&b);
        printf("%lld\n",floor_sum(n,m,a,b));
    }
}

Measured memory_bytes: 3824
#include <iostream>
#define f(a) ((a)*(a))

using namespace std;
int main(){
    int d;
    long long int sum;
    while(cin >> d){
        sum=0;
        for(int i=1;i*d<600;i++){
            sum+=f(i*d)*d;
        }
    cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a, b;
  char c;
  cin >> a >> c >> b;
  cout << (c == '+' ? a + b : a - b) << endl;
}

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

int main(){
    int n;
    cin >> n;
    if(n >= 28){
        cout << "Yes" << endl;
        return 0;
    }
    for(int i = 0; i <= 6; i++){
        for(int j = 0; j <= 3; j++){
            if(i * 4 + j * 7 == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int oddCount = 0;
    for (int i = 0; i < n; i++) {
      if (sc.nextInt() % 2 == 1) {
        oddCount++;
      }
    }
    System.out.println(oddCount % 2 == 0 ? "YES" : "NO");
  }
}

Measured memory_bytes: 48532
def f(n):
    t = 1
    count = 0
    while(n>=t**2):
        if n%t == 0:
            count += 2 if t != n//t else 1
        t += 1
    return count

N = int(input())
count = 0
for i in range(1,N+1):
    if f(i) == 8 and i%2:
        count += 1
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<vector>
#include<deque>
#include<list>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int n;
	int x[1001];
	cin>>n;

	int mi=2001,ma=0;
	rep(i,n){
		cin>>x[i+1];
		mi=min(mi,x[i+1]);
		ma=max(ma,x[i+1]);
	}

	int ans=3001;
	for(int i=0; i<ma+1; i++){
		int t=max(i-mi,ma-i);
		ans=min(ans,t);
	}
	cout<<ans<<endl;
	return 0;
}



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

int MOD = 1000000007;

// fact(n)%MOD, invFact(n)%MOD, inv(n)%MOD, nCk
// Constructor O(N)
// other O(1)
template<typename T>
class Choose {
public:
	std::vector<T> fact, inv, invFact;

	Choose(T N) :fact(N), inv(N), invFact(N) {
		inv[1] = 1;
        for(int i=2;i<inv.size();++i) inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
		fact[0] = invFact[0] = 1;
        for(int i=1;i<fact.size();++i){
			fact[i] = fact[i - 1] * i % MOD;
			invFact[i] = (invFact[i - 1] * inv[i]) % MOD;
		}
	}

	//Get nCk
	T operator () (T n, T k) const {
		if (not ((T)0 <= k and k <= n)) return 0;
		return (((fact[n] * invFact[k]) % MOD) * invFact[n - k]) % MOD;
	}
};


long long C(Choose<long long> const& choose, int x, int y) {
    // O(1)
    return choose(x, y);
}

int main() {
    int N, K;
    long long ans = 0;
    std::cin >> N >> K;
    Choose<long long> choose(N+1); // O(N)

    for (int k=0; k<=std::min(N, K); k++) {
        // n-k個の部屋にkだけ振り分ける
        const auto x = C(choose, N-1, k);
        const auto y = C(choose, N, k);
        ans += x * y % MOD;
        ans %= MOD;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 7952
#[warn(unused_mut)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[warn(unused_mut)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[warn(unused_mut)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        k: usize,
    }

    let mut n = n;

    let mut ans = 0;
    while n > 0 {
        ans += 1;
        n /= k;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
	char s[100002];
	cin>>s;
	int che[30]={0};
	for(int i=0;i<strlen(s);i++)
	{
		che[s[i]-'a']++;
	}
	int flag=0;
	for(int i=0;i<26;i++)
	{
		if(che[i]==0)
		{
			printf("%c\n",'a'+i);
			flag=1;
			break;
		}
	}
	if(flag==0)
	cout<<"None"<<endl;
	return 0;
} 

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());

    rep(i,n-1){
        if(a[i]==a[i+1]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

int main(){
  string s,t;cin >> s >> t;
  vector<vector<int>> G(26);

  s = s+s;
  int ch;
  rep(i,s.size()){
    ch = s[i] - 'a';
    G[ch].push_back(i+1);
  }

  ll ans = 0;
  int temp;
  if(s.find(t[0]) == string::npos) {
    cout << -1 << endl;
    return 0;
  }else {
    temp = G[t[0] - 'a'][0];
    ans += temp;
  }
  //cout << ans << endl;


  for(int i = 1;i < t.size();i++){
    if(s.find(t[i]) == string::npos){
      cout << -1 << endl;
      return 0;
    }

    ch = t[i] - 'a';
    //cout << ch << " " << G[ch][0] << endl;
    vector<int>::iterator it = upper_bound(G[ch].begin(),G[ch].end(),temp);
    ans += *it - temp;
    temp = *it%(s.size()/2);
    //cout << ans << endl;
  }

  cout << ans << endl;
}

Measured memory_bytes: 4708
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

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

	ll mx = 0;
	ll x = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'I') x++;
		else x--;
		mx = max(mx, x);
	}

	cout << mx << endl;
}

Measured memory_bytes: 256
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3
2 2 4
---+/
/+---test
5
3 8 7 5 5
---+/
/+---test
3
1000000000 1000000000 0
---+/

void main(string[] args) {
  readln;
  const A = readln.split.map!(to!long).array;
  const N = A.length;

  auto M = new long[N];
  foreach (i, v; A) {
    M[0] += v * (2 - (i%2)*4);
  }
  M[0] /= 2;

  foreach (i; 1..N) {
    M[i] = A[i-1]*2 - M[i-1];
  }

  foreach (i, v; M) {
    if (i != 0) " ".write;
    v.write;
  }
  writeln;
}


Measured memory_bytes: 7064
#include<iostream>
#include<string.h>
using namespace std;

int main()
{
	int n,a,b;
	while(cin>>n>>a>>b && n!=0){
		bool ok[1000001];
		memset(ok,false,sizeof(ok));
		int ans=0;
		ok[0]=true;
		for(int i=0;i<=n;i++){
			if(ok[i]){
				if(i+a<=n)
					ok[i+a]=true;
				if(i+b<=n)
					ok[i+b]=true;
			}
			else ans++;
		}
		cout<<ans<<endl;
	}
	return 0; 
}

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

p, q = [0], [0]
for i in range(n):
	p.append(p[i] + a[i])
for i in range(m):
	q.append(q[i] + b[i])

j, ans = m, 0
for i in range(n+1):
	if p[i] > k:
		break

	while q[j] > k - p[i]:
		j -= 1

	ans = max(ans, i+j)

print(ans)

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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            if (isHarhad(n))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
        static bool isHarhad(int n)
        {
            int sum = 0;
            int nCopy = n;
            while (nCopy > 0)
            {
                sum += nCopy % 10;
                nCopy /= 10;
            }
            if (n % sum == 0)
                return true;
            return false;
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <math.h>
#include <limits.h>
double N;
int main(){
    long int i;
    long int division1;
    long int cal;
    long int ans;
    
    
    scanf("%lf",&N);
    ans = N-1;
    for(i=1;i<=sqrt(N);i++){
        division1 = N/i;
        if(N == division1*i){
            cal = (division1-0.1)+(i-1);
            if(ans>=cal){
                ans = cal;
            }
        }
    }
    printf("%ld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n;
 	cin >> n;
 	ll temp = n % 10;
 	if (temp == 2 || temp == 4 || temp == 5 || temp == 7 || temp == 9)
 		cout << "hon" << endl;
 	else if (temp == 0 || temp == 1 || temp == 6 || temp == 8) 
 		cout << "pon" << endl;
 	else 
 		cout << "bon" << endl;
	return 0;
}

Measured memory_bytes: 3688
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
l = [A,B,C,D,E]
m = min(l)
mn = l.index(m)
c = 0
cities = [N,0,0,0,0,0]
while cities[mn] == 0:
    p00 = min(A,cities[0])
    p01 = min(B,cities[1])
    p02 = min(C,cities[2])
    p03 = min(D,cities[3])
    p04 = min(E,cities[4])
    cities[0]-=p00
    cities[1]-=p01
    cities[2]-=p02
    cities[3]-=p03
    cities[4]-=p04
    cities[1]+=p00
    cities[2]+=p01
    cities[3]+=p02
    cities[4]+=p03
    cities[5]+=p04
    c += 1
c += 5-mn+math.ceil(N/m)-1
print(c)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		a[0] = 1;
		while(sc.hasNext()) {
			String[] s = sc.next().split(",");
			int t0 = s[0].charAt(0) - 'A';
			int t1 = s[1].charAt(0) - 'A';
			int k = a[t0];
			a[t0] = a[t1];
			a[t1] = k;
		}
		sc.close();
		for(int i = 0; i < 3; i++) {
			if(a[i] == 1) {
				System.out.println((char)(i + 'A'));
				break;
			}
		}
	}
}


Measured memory_bytes: 26168
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  int b[n];
  int c[n];
  int x=0; //mannzokudo
  for(int i=0;i<n;i++){scanf("%d",&a[i]);}
  for(int i=0;i<n;i++){scanf("%d",&b[i]);}
   for(int i=0;i<n;i++){scanf("%d",&c[i]);}
  for (int i=0;i<n;i++){
    int y=a[i]-1;
    x=x+b[y];// printf("%d",x);
    if(a[i+1]-a[i]==1){
      x=x+c[y];
    }
    }
printf("%d\n",x);
}
  

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

using namespace std;

inline void quit(){ exit(0); }

typedef long long ll;

ll mpow(ll _x, ll _y, ll _mod){
    if(_y==0) return 1;
    if(_y==1) return _x%_mod;
    if(_y&1) return (mpow(_x, _y-1, _mod)*_x)%_mod;
    ll _tmp = mpow(_x, _y>>1, _mod);
    return (_tmp*_tmp)%_mod;
}

int a, b;
int cnt;
int tmp = 1;

int main(){
    cin >> a >> b;
    while(tmp < b){
        tmp += a-1;
        cnt++;
    }
    printf("%d", cnt);
}


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

int main() {
  int n;
  while (cin >> n) {
    int ans = 0;
    for (int a = 0; a <= 9; a++) {
      for (int b = 0; b <= 9; b++) {
        for (int c = 0; c <= 9; c++) {
          for (int d = 0; d <= 9; d++) {
            if (a + b + c + d == n) ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3032
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;



int main(){
	vector<int> a={1,3,5,7,8,10,12};
	vector<int> b={4,6,9,11};
	
	int x,y;
	cin >> x >> y;
	
	if(x==2 || y==2){
		cout << "No" << endl;
		return 0;
	}
	
	int check=0;
	for(int i=0;i<a.size();i++){
		if(x==a[i])check++;
		if(y==a[i])check++;
	}
	if(check==2){
		cout << "Yes" << endl;
		return 0;
	}
	
	check=0;
	for(int i=0;i<b.size();i++){
		if(x==b[i])check++;
		if(y==b[i])check++;
	}
	if(check==2){
		cout << "Yes" << endl;
		return 0;
	}
	
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define M 100000
#define INF 1000000000000
int main () {
    int n, W;
    cin >> n >> W;
    vector <long long> dp(M + 1, INF);
    dp[0] = 0;
    int sol = 0;
    for (int i = 1; i <= n; i ++) {
        long long v, w;
        cin >> v >> w;
        for (int j = M; j >= w; j --) {
            dp[j] = min(dp[j], dp[j - w] + v);
            if (dp[j] <= W) {
                sol = max(sol, j);
            }
        }
    }
    cout << sol;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
    int n,a;
    cin >> n;
    if(n > 0){
        long arr[n]; 
        for (int i=0; i<n; i++){
            cin >> a;
            arr[i] = a;
        }
        long cmparr[3] = {arr[0], arr[0], arr[0]};
        cmparr[2] = arr[0];
        for (int j=1; j<n; j++){
            if((arr[j-1] > arr[j])&&(cmparr[0] > arr[j])){
                cmparr[0] = arr[j];
            }
            if((arr[j-1] < arr[j])&&(cmparr[1] < arr[j])){
                cmparr[1] = arr[j];
            }
            cmparr[2] += arr[j];
        }
        cout << cmparr[0] << " " << cmparr[1] << " " << cmparr[2] << endl;
    }
    return 0;
}


Measured memory_bytes: 3196
n, a, b, c = map(int, input().split())
L = [a, b, c]
X = [0]*n
for i in range(n):
    s = str(input())
    if s == 'AB':
        x, y = 0, 1
    elif s == 'AC':
        x, y = 0, 2
    else:
        x, y = 1, 2
    X[i] = (x, y)

ans = []
for i in range(n):
    x, y = X[i]
    if i != n-1:
        if L[x] == 0 and L[y] == 0:
            print('No')
            exit()
        else:
            if L[x] == 0:
                L[x] += 1
                L[y] -= 1
                ans.append(x)
            elif L[y] == 0:
                L[x] -= 1
                L[y] += 1
                ans.append(y)
            else:
                nx, ny = X[i+1]
                if x in {nx, ny}:
                    L[x] += 1
                    L[y] -= 1
                    ans.append(x)
                else:
                    L[x] -= 1
                    L[y] += 1
                    ans.append(y)
    else:
        if L[x] == 0 and L[y] == 0:
            print('No')
            exit()
        else:
            if L[x] == 0:
                L[x] += 1
                L[y] -= 1
                ans.append(x)
            elif L[y] == 0:
                L[x] -= 1
                L[y] += 1
                ans.append(y)
            else:
                L[x] += 1
                L[y] -= 1
                ans.append(x)

print('Yes')
d = {0:'A', 1:'B', 2:'C'}
for i in range(n):
    print(d[ans[i]])


Measured memory_bytes: 81508
// by gantheory™
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 10;

int n, m, d[ N ], t[ N ];

int main() {
  ios_base::sync_with_stdio(0);cin.tie(0);cout.setf(ios::fixed);cout.precision(20);
  cin >> n;
  for ( int i = 0 ; i < n ; ++i )
    cin >> d[ i ];
  cin >> m;
  for ( int i = 0 ; i < m ; ++i )
    cin >> t[ i ];
  map< int, int > dmp, tmp;
  for ( int i = 0 ; i < n ; ++i )
    ++dmp[ d[ i ] ];
  for ( int i = 0 ; i < m ; ++i )
    ++tmp[ t[ i ] ];
  for ( auto it : tmp ) {
    int now = it.first;
    int num = it.second;
    if ( dmp.count( now ) == 0 ) {
      cout << "NO" << '\n';
      return 0;
    }
    if ( dmp[ now ] < num ) {
      cout << "NO" << '\n';
      return 0;
    }
  }
  cout << "YES" << '\n';
}


Measured memory_bytes: 20608
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    map<int, int> cnt;
    for(int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        cnt[x]++;
    }
    for(auto &it : cnt)
        it.second /= 2;
    vector<int> res;
    for(auto it: cnt) {
        if(it.second > 0)
            res.push_back(it.first);
        if(it.second > 1)
            res.push_back(it.first);
    }
    sort(res.begin(), res.end());
    ll ans = 0;
    reverse(res.begin(), res.end());
    if(res.size() <= 1)
        cout << 0 << "\n";
    else {
        ans = (ll)res[0] * res[1];
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
 
#define mod 1000000007
typedef long long int LL;
const int MAX = 105;
const int INF = 1e9;



int main() {	
	char x;
	cin >> x;
	printf ("%c\n", x + 1);
	return 0;
}

Measured memory_bytes: 256