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

#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define ld long double
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
#define sze(v) (int)(v.size())

typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<vector<int>>Vv;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue <int, vector<int>, greater<int>>PQL;
typedef unordered_map<int,int>ump;

const int mod=1e9+7;
const int modx=998244353;
const int Nx=1e5+2;
const int inf= (int)(1e19+10LL);

void solve(){
  int n;
  sl(n);
  map<string,int>counter;
  for(int i=0;i<n;i++){
	  string x;
	  sl(x);
	  counter[x]++;
  }
  cout<<"AC x "<<counter["AC"]<<endl;
  cout<<"WA x "<<counter["WA"]<<endl;
  cout<<"TLE x "<<counter["TLE"]<<endl;
  cout<<"RE x "<<counter["RE"]<<endl;
		
}
 
signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();
 
   }
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
int main() {
	int n;
	bool f = 1;
	cin >> n;
	vector<string>s(n);
	for (int i = 0; i < n; i++) {
		cin >> s.at(i);
	}
	for (int i = 0; i < n-1; i++) {
		if (s.at(i)[s[i].size() - 1] != s.at(i + 1)[0])f = 0;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i!=j&&s.at(i) == s.at(j))f = 0;
		}
	}
	if (f == 1)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main(){
    int a,b,c,x;
    while(~scanf("%d%d%d%d",&a,&b,&c,&x)){
        int ans=0;
        for(int i=0;i<=a;i++) for(int j=0;j<=b;j++) for(int k=0;k<=c;k++) if(i*500+j*100+k*50==x) ans++;
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
long long b[50005];
long long a[250];
int n;
long long kgcd(long long a, long long b)
{ 
    if (a == 0) return b; 
    if (b == 0) return a; 
    if (!(a & 1) && !(b & 1)) 
        return kgcd(a>>1, b>>1)<<1;
    else if (!(b & 1))
		return kgcd(a, b>>1); 
    else if (!(a & 1)) return kgcd(a>>1, b); 
    else return kgcd(abs(a - b), a > b ? b : a); 
} 

int main()
{
	int n, i, j;
	long long temp;
	while( cin >> n , n ) {
		for( i = 0 ; i < n * ( n + 1 ) / 2  ; ++ i ) 
			scanf( "%lld" , &b[i] );
		temp = b[0];
		for( i = 1 ; i < n ; i++ ) {
			temp = kgcd( b[i] , temp );
		}
		for( j = 0 ; j < n ; ++ j ) {
			a[j] = b[j] / temp;
		}
		temp /= sqrt( b[n] / a[0] / a[1] );
		for( i = 0 ; i < n ; ++i ) {
			a[i] = b[i] / temp;
		}
		printf( "%lld\n" , temp );
		sort( a , a + n );
		for( j = 0 ; j < n ; ++ j ) {
			if( j != n - 1 )
				printf( "%lld " , a[j] );
			else
				printf( "%lld\n" , a[j] ); 
		}
	}
	return 0;
}

Measured memory_bytes: 1492
import numpy as np

n = input()
a = np.array([int(num) for num in input().split(' ')])

min = 100000000000
sunuke = 0
araiguma = a.sum()
for i in range(0, len(a) - 1):
    sunuke += a[i]
    araiguma -= a[i]
    dif = abs(sunuke - araiguma)
    if dif < min: min = dif
print(min)


Measured memory_bytes: 32956
def main():
  import sys
  input = sys.stdin.readline
  from collections import deque
  
  n,q=map(int,input().split())
  ab=[[] for _ in range(n+1)]
  for _ in range(n-1):
    a,b=map(int,input().split())
    ab[a].append(b)
    ab[b].append(a)
  ans=[0]*(n+1)
  for _ in range(q):
    p,x=map(int,input().split())
    ans[p]+=x
  
  l,parent=deque([1]),[0]*(n+1)
  parent[1]=1
  while l:
    x=l.popleft()
    for i in ab[x]:
      if parent[i]:
        continue
      l.append(i)
      ans[i]+=ans[x]
      parent[i]=1
      
  print(*ans[1:])
if __name__=='__main__':
  main()

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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

#define DMAX 
#define NMAX 
#define MMAX 

using namespace std;

int n, k, a[3];

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> a[0] >> a[1] >> a[2];	

	sort(a, a + 3);
	swap(a[0], a[2]);

	int nrop = a[0] - a[1];
	a[1] += nrop;
	a[2] += nrop;
	int nrop2 = (a[0] - a[2]) / 2;
	a[2] += nrop2 * 2;
	nrop += nrop2;
	if(a[0] != a[2]) nrop += 2;
	cout << nrop;
}

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

void solve(){
	int n;
	cin >> n;
	if(n >= 30) cout << "Yes\n";
	else cout << "No\n";
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int t = 1;
	while(t--) solve();
}

Measured memory_bytes: 3652
#include <stdio.h>
int main(void){
    int n, i, a, b, sumA = 0, sumB = 0;
    
    while(1){
        // input n.
        scanf("%d", &n);
        if(n < 1){
            break;
        }
        
        for(i = 0; i < n; ++i){
            // input the i th of A's card and B's one.
            scanf("%d %d", &a, &b);
            
            // calculate points.
            if(a < b){
                sumB += a + b;
            } else if(a == b){
                sumA += a;
                sumB += b;
            } else {
                sumA += a + b;
            }
        }
        
        // output
        printf("%d %d\n", sumA, sumB);
        
        // initialize
        sumA = 0;
        sumB = 0;
    }
    
    return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define ull unsigned long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define mod (1000*1000*1000+7)
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
template <typename T>
string NumberToString(T pNumber)
{
     ostringstream oOStrStream;
     oOStrStream << pNumber;
     return oOStrStream.str();
}
ll modPow(ll x,ll n,ll m)
{
    if(n==0)
    return 1%m;
    ll u = modPow(x,n/2,m);
    u=u*u%m;
    if(n%2==1)
    u=u*x%m;
    return u;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
ll seive[1000000];
void seiveForm()
{
    ll i,j;
    seive[0]=seive[1]=1;
    f(i,2,100000)
    {
        if(seive[i]==0)
            for(j=i*i;j<1000000;j+=i)
                seive[j]=1;
    }
}
bool isPerfectSquare(ll num)
{
    double n = sqrt(num);
    return n==(ll)n?true:false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,i,j,t,temp=1,sum,cost=0,total=0;
    cin>>n;
    ll arr[n];
    rep(i,n)
    {
        cin>>arr[i];
        if(i>0 && arr[0]==arr[i])
            temp++;
    }
    if(temp==n)
        cout<<"0\n";
    else
    {
        sum=accumulate(arr,arr+n,0);
        cost=round((double)sum/n);
        temp=0;
        rep(i,n)
        {
            temp=modPow(abs(arr[i]-cost),2,mod);
            total+=temp;
        }
        cout<<total<<"\n";
    }
    return 0;
}


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

int main(){
  int n, k;
  cin >> n >> k;
  cout << ((n+1)/2 >= k ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include <bitset>
#include <type_traits>
#include <string>
#include <climits>
#include <cmath>
#include <vector>


using namespace std;

// long long func(long long a, long long b, long long c){ 
//     long long ret = 0;
//     a %= c; 
//     while (b) { 
//         if (b & 1){
//         	ret = (ret + a) % c; 
//         }  
//         a = (2 * a)%c; 
//         b >>= 1;
//     } 
//     return ret; 
// } 

int main(){
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif

	int N, a, b, count = 0;
	cin >> N;

	for(int i=0;i<N;i++){
		cin >> a >> b;
		if(a==b){
			count++;
		} else{
			count = 0;
		}
		if(count >= 3){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    string S;
    cin >> S;
    int ans = 0;
    int x = S.size();
    REP(i,floor(x/2)){
        if(S[i] == S[x-i-1]) continue;
        else ans++;
    }
    cout << ans << endl;
}

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

const int MAX_N=1e6+10;
const int INF=1e9+10;

int dist[MAX_N],N,M,id;
vector <pair<int,int> > g[MAX_N];
int dits[MAX_N];
map <pair<int,int>,int> Map;
priority_queue <pair<int,int> > Q;

void add_edge(int u,int v,int cost1,int cost2){
	g[u].push_back(make_pair(v,cost1));
	g[v].push_back(make_pair(u,cost2));
}

int main(){
	scanf("%d%d",&N,&M);
	id=N;
	for(int i=0;i<M;i++){
		int u,v,c;
		scanf("%d%d%d",&u,&v,&c); 
		u--; v--; 
		if(Map.find(make_pair(u,c))==Map.end()){
			Map[make_pair(u,c)]=id;
			add_edge(u,id++,1,0);
		}
		else add_edge(u,Map[make_pair(u,c)],1,0);
		if(Map.find(make_pair(v,c))==Map.end()){
			Map[make_pair(v,c)]=id;
			add_edge(v,id++,1,0);
		}
		else add_edge(v,Map[make_pair(v,c)],1,0);
		add_edge(Map[make_pair(u,c)],Map[make_pair(v,c)],0,0);
	}
	for(int i=0;i<MAX_N;i++) dist[i]=INF;
	dist[0]=0;
	Q.push(make_pair(-dist[0],0));
	while(!Q.empty()){
		int val=-Q.top().first,x=Q.top().second;
		Q.pop(); 
		if(dist[x]<val) continue;
		for(int i=0;i<g[x].size();i++){
			int to=g[x][i].first,cost=g[x][i].second;
			if(dist[to]>dist[x]+cost){
				dist[to]=dist[x]+cost;
				Q.push(make_pair(-dist[to],to));
			}
		}
	}
	if(dist[N-1]==INF) printf("-1\n");
	else printf("%d\n",dist[N-1]);
	return 0;
}

Measured memory_bytes: 73724
# cook your dish here
n = int(input())
l = list(map(int, input().split()))
small=large=l[0]
table = 0
for i in range(1,len(l),1):
    if l[i] < large:
        table += (abs(l[i]-large))
    if l[i] > large:
        large = l[i]
print(table)

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

int main(){
    int N,amari;
    scanf("%d",&N);
    amari = N%10;
    if(amari==2||amari==4||amari==5||amari==7||amari==9){
        printf("hon\n");
    }else if(amari==3){
        printf("bon\n");
    }else{
        printf("pon\n");
    }
    return 0;
}

Measured memory_bytes: 1624
#include<stdio.h>
  
void swap(int* a,int* b){
  int tmp=*a;
  *a=*b;
  *b=tmp;
}
  
int Partition(int A[],int p,int r){
  int x = A[r];
  int i=p-1,j;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      swap(&A[i],&A[j]);
    }
  }
  swap(&A[i+1],&A[r]);
  return i+1;
}
  
int main(){
  int n,i,x;
  int A[100000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  x=Partition(A,0,n-1);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    if(i==x)printf("[");
    printf("%d",A[i]);
    if(i==x)printf("]");
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans;
const int MOD=998244353;
int n,S,dp[3003][3003],a[3003],NUM[3003];
int main(){
	cin>>n>>S;
	for (int i=1;i<=n;i++) cin>>a[i];
	dp[0][0]=1,NUM[0]=1;
	for (int i=1;i<=n;i++){
		for (int j=a[i];j<=S;j++)
			dp[i][j]=NUM[j-a[i]];
		for (int j=a[i];j<=S;j++) NUM[j]+=dp[i][j],NUM[j]%=MOD;
		ans=(ans+1ll*dp[i][S]*(n-i+1))%MOD;
		NUM[0]++;
	}
	cout<<ans;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
#define lli long long int
const long int M = 1000000007;
using namespace std;

void printg(vector<vector<int> > v, int n)
{
    for(int i=1;i<=n;i++)
    {
        cout << i << ": ";
        for(int j=0;j<v[i].size();j++)
        {
            cout << v[i][j] << "->";
        }
        cout << endl;
    }
}
int solve(vector<vector<int> > &v,int dp[],int n,int s)
{
    if(dp[s]) return dp[s];
    if(!v[s].size())
    {
        dp[s] = 0;
        return 0;
    }
    for(int j=0;j<v[s].size();j++)
    {
        if(!dp[v[s][j]]) solve(v,dp,n,v[s][j]);
        dp[s] = max(dp[s],dp[v[s][j]] + 1);
    }
    return dp[s];
}
int main()
{
    int n,m;
    cin >> n >> m;
    int i,j;
    vector<vector<int> > v(n+1);
    for(i=0;i<m;i++)
    {
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
    }
    //printg(v,n);
    int dp[n+1] = {0};
    for(i=1;i<=n;i++) solve(v,dp,n,i);
    //for(i=1;i<=n;i++) cout << dp[i] << " ";
    cout << *max_element(dp,dp+n+1);
}



Measured memory_bytes: 12332
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

const INF = int(math.MaxInt32)
const INF64 = math.MaxInt64 / 2

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func uniqIntSlice(a []int) []int {
	m := make(map[int]struct{})
	for _, v := range a {
		m[v] = struct{}{}
	}
	u := []int{}
	for k := range m {
		u = append(u, k)
	}
	return u
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

//a:old b:new a>b -> a=b (update) more small
func chmin(a *int, b int) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

//a:old b:new a>b -> a=b (update) more small
func chmin64(a *int64, b int64) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

//a:old b:new a<b -> a=b (update) more large
func chmax(a *int, b int) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}

//a:old b:new a<b -> a=b (update) more large
func chmax64(a *int64, b int64) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}
type DP struct{
	count int
	s string
}

func main() {
	n := nextInt()
	//a := make([]float64,n)
	var sum float64
	for i:=0;i<n;i++{
		//a[i]:=1/float64(nextInt())
		sum += 1/float64(nextInt())
	}
	fmt.Println(1/sum)
}

Measured memory_bytes: 640
# D - Rain Flows into Dams

N = int(input())
A = [int(a) for a in input().split()]

x = 0
for i in range(N):
    x = 2 * A[i] - x

ans = [x // 2]
for i in range(N - 1):
    ans.append(2 * A[i] - ans[i])

print(*ans)


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

public class Main {

	Scanner sc = new Scanner(System.in);
	final int p = 100000007;
	int[][] dp = new int[1001][1001];

	void run() {
		init();
		int r = sc.nextInt();
		int c = sc.nextInt();
		int a1 = sc.nextInt();
		int a2 = sc.nextInt();
		int b1 = sc.nextInt();
		int b2 = sc.nextInt();
		int w1 = Math.abs(a1 - b1);
		int h1 = Math.abs(a2 - b2);
		int w2 = r - Math.abs(a1 - b1);
		int h2 = c - Math.abs(a2 - b2);

		int w = Math.min(w1, w2);
		int h = Math.min(h1, h2);
		int ans = dp[w + h][w];
		if (w1 == w2)
			ans = ans * 2 % p;
		if (h1 == h2)
			ans = ans * 2 % p;
		System.out.println(ans);
	}

	void init() {
		dp[0][0] = 1;
		for (int i = 1; i < 1001; i++) {
			dp[i][0] = 1;
			for (int j = 1; j < 1001; j++) {
				dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % p;
			}
		}
	}

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

Measured memory_bytes: 24708
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>
#include <queue>
#include <set>

constexpr long long INFLL = 1e18;

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

int main()
{
    int k;
    cin >> k;
    int surplus = 7 % k;
    set<int> s;
    int count = 1;
    while (s.count(surplus) == 0) {
        if (surplus == 0) {
            break;
        }
        s.insert(surplus);
        surplus = (surplus * 10 + 7) % k;
        count++;


    }
    if (surplus > 0) {
        count = -1;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 50024
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}


signed main() {
    string s,t;cin >>s>>t;
    if(s==t.substr(0,s.size()))cout <<"Yes"<<endl;
    else cout <<"No"<<endl;
}

















Measured memory_bytes: 3632
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int N;
int a[MAX_N];

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  REP(i, N) cin >> a[i];

  sort(a, a + N);

  int ans = a[N - 1] - a[0];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
 
using namespace std;
 
string s;
int k;
set<string> substrings;
 
int main() {
  cin >> s;
  cin >> k;
  for (int i = 0; i < s.size(); i++) {
    for (int j = 1; j <= s.size() - i && j <= k; j++) {
      substrings.insert(s.substr(i, j));
    }
  }
  set<string>::iterator it = substrings.begin();
  for (int i = 1; i < k; i++) it++;
  cout << *it;
}


Measured memory_bytes: 1664
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, H: int, a: "List[int]", b: "List[int]"):
    ma = max(a)
    b.sort(reverse=True)
    i = 0
    for i in range(N):
        if b[i] <= ma:
            i -= 1
            break
        H -= b[i]
        if H <= 0:
            print(i + 1)
            return
    print(i + 1 + -(-H // ma))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    a = [int()] * (N)  # type: "List[int]"
    b = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, H, a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define TYPE(x) typeid(x).name()
int main(){
	int k;
	int a,b;
	int flag=0;
	cin>>k>>a>>b;
	for(int i=a;i<=b;++i){
		if(i%k==0){
			flag=1;
		}
	}
	if(flag==0)cout<<"NG";
	else cout<<"OK";
}


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

void printDir(int n,string dir){
	for(int i = 0;i < n; ++i){
  	cout << dir;
  }
}

int main(){
  vector<int> s(2),t(2);
  int diff_x = 0, diff_y =0;
  
  cin >> s[0] >> s[1] >> t[0] >> t[1];
  
  diff_x = t[0] - s[0];
  diff_y = t[1] - s[1];
  
  printDir(diff_y,"U");
  printDir(diff_x,"R");
  printDir(diff_y,"D");
  printDir(diff_x,"L");
  printDir(1,"L");
  printDir(diff_y + 1,"U");
  printDir(diff_x + 1,"R");
  printDir(1,"D");
  printDir(1,"R");
  printDir(diff_y + 1,"D");
  printDir(diff_x + 1,"L");
  printDir(1,"U");
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int, int> pii;
const int mod = (int)1e9 + 7;

vector<vector<bool>> maj;

double cvv(double a, double b){return a*a + b*b; };
vector<vector<pair<int, double>>> r;

const double INF = 1e22;

int main()
{

	int xs,ys,xt,yt, n;
	cin >>xs >>ys >>xt >>yt >>n;
	VI xx(n+2), yy(n+2), rr(n+2);
	rep(i,n) cin >> xx[i] >> yy[i] >> rr[i];
	xx[n]=xs; yy[n]=ys; rr[n]=0;
	xx[n+1]=xt; yy[n+1]=yt; rr[n+1]=0;
	
	
	
	vector<double>  d(n+4,INF);
	d[n]=0;
	vector<char> usd(n+4,0);
	
	for(;;){
		int v= -1;
		rep(u, n+2){
			if(!usd[u] && (v==-1 || d[u] < d[v])) v =u;
		}
		if(v ==-1) break;
		usd[v] = 1;
		rep(u, n+2){
			double ky =max(0.0, sqrt(cvv(xx[u]-xx[v], yy[u]-yy[v])) - (rr[u]+rr[v]));
			d[u] = min(d[u], d[v] + ky);
		}
	}



	
	printf("%.15f\n", d[n+1]);
	return 0;
}


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


void solve(){

}

int main(){
    long long X;
    cin >> X;
    bool flg = false;
    long long ans = 1;
    for(long long i = X; i >= 0; i--){
        for(long long j = 2; j<= 33; j++){
            for(long long k = 2; k <= 10 && pow(j,k) <= 1000; k++){
                if( i == (long long)pow(j,k)){
                    flg = true;
                    ans = i;
                    break;
                }
            }
            if(flg) break;
        }
        if(flg) break;
    }
    cout << ans << endl;
}


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

int N, R;
int main() {
  cin >> N;
  int prev = -1, cnt = 0;
  for(int i = 0; i < N; ++i) {
    int a; cin >> a;
    if(prev == a) {
      ++cnt;
      if(cnt % 2 == 0) ++R;
    } else {
      cnt = 1;
    }
    prev = a;
  }
  cout << R << endl;
  return 0;
}


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

int main()
{
	string week[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int m, d;
	while (cin >> m >> d && m != 0 || d != 0)
	{
		int w = 3 - 1;
		bool f = false;
		for (int i = 1; i <= 12; i++)
		{
			for (int j = 1; j <= month[i - 1]; j++)
			{
				w = (w + 1) % 7;
				if (i == m && j == d)
				{
					cout << week[w] <<endl;
					f = true;
					break;
				}
			}
			if (f)break;
		}
	}
	return 0;
}

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

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

  int ans;
  int sum = v[0] + v[1] + v[2];
  if ((sum % 2) == ((v[2] * 3) % 2)){
    ans = (v[2] * 3 - sum) / 2;
  } else {
    ans = ((v[2] + 1) * 3 - sum) / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <iterator>
#include <functional>

using namespace std;

typedef unsigned                    ui;
typedef int                         si;
typedef long                        sl;
typedef long long                   ll;
typedef unsigned long long          ull;

#ifdef LOCALHOST
std::ifstream in("input.txt", std::ifstream::in);
#endif // LOCALHOST

#ifdef LOCALHOST
#define is in
#else
#define is cin
#endif // LOCALHOST

int main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    ll n, W;
    cin >> n >> W;

    vector<ll> w(n + 1, 0);
    vector<ll> v(n + 1, 0);

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

    ll answer = 0;
    vector<vector<ll>> dp(W + 1, vector<ll>(n + 1, 0));
    for (int i = 1; i <= W; ++i) {
        cerr << "w = " << i << endl;
        for (int j = 1; j <= n; ++j) {
            dp[i][j] = dp[i - 1][j];
            dp[i][j] = max(dp[i][j], dp[i][j - 1]);
            if (w[j] <= i) {
                dp[i][j] = max(dp[i - w[j]][j - 1] + v[j], dp[i][j]);
            }

            answer = max(answer, dp[i][j]);

            // cerr << dp[i][j] << " ";
        }
        // cerr << endl;
    }

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 82304
#include<stdio.h>


int main(){

  int k,h,a,b,j,v,key,i,e;
  int cnt = 0;
  int hai[10000];
  int hai2[500];

  scanf("%d",&k);
  for( i = 0; i < k; i++){
    scanf("%d",&hai[i]);
  }

  scanf("%d",&a);

  for( e = 0; e < a; e++){
    scanf("%d",&hai2[e]);
  }

  for(v = 0; v < a; v++){
  j = 0;
  key = hai2[v];
  hai[k] = key;
  while(hai[j] != key){
    j++;
    if(j == k){
      break;
    }
    if(key == hai[j]){
      cnt++;
    }
  }
   if(j == 0){
    cnt++;
  }
  
  }

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

  return 0;
    }



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

int main() {
	int n;
	int a[100][2];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i][0];
	for (int i = 0; i < n; i++) cin >> a[i][1];

	int ans = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < i+1; j++) sum += a[j][0];
		for (int j = i; j < n; j++) sum += a[j][1];
		if (sum > ans) ans = sum;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector <int>v;
  int n;
  scanf("%d",&n);
  int mi=1000;
  int ma=0;
  for (int i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    if (a<mi) mi=a;
    if (a>ma) ma=a;
  }
  int ans;
  ans=ma-mi;
  printf ("%d",ans);
  return 0;
  
    
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
k,n = [int(i) for i in readline().split()]
a = [int(i) for i in readline().split()]

a.sort()

d = a[0]+(k-a[n-1])
for i in range(n-1):
    d = max(d, a[i+1]-a[i])

print(k-d)

Measured memory_bytes: 24908
#include<bits/stdc++.h>
#define f(i,n) for(int i=0;i<(n);i++)
using namespace std;
signed main(){
	string s[3];
	int a[3]={},b=0;
	cin>>s[0]>>s[1]>>s[2];
	while(1){
		a[b]++;
		if(a[b]>(int)(s[b].size())){
			cout<<(char)(b+'A')<<endl;
			break;
		}
		b=s[b][a[b]-1]-'a';
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int r,c,a[101][101]={};
    cin>>r>>c;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            a[i][c]+=a[i][j];
            a[r][j]+=a[i][j];
        }
        a[r][c]+=a[i][c];
    }
    for(int i=0;i<=r;i++){
        for(int j=0;j<=c;j++){
            if(j<c)
            cout<<a[i][j]<<" ";
            else cout<<a[i][j];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


int main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,n)cin>>a[i];
  sort(a,a+n);
  reverse(a,a+n);
  int ans=0;
  rep(i,n){
    if(i%2==0)ans+=a[i];
    else ans-=a[i];
    }
  cout<<ans<<endl;
  return 0;
  }

  
    


Measured memory_bytes: 256
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

n=int(input())
a=list(map(int,input().split()))
l=1
for i in range(0,n):
    l=lcm(l,a[i])
ans=0
for i in range(0,n):
    ans=ans+l//a[i]
print (ans%(10**9+7))

Measured memory_bytes: 4084
N = int(input())
A = list(map(int, input().split()))

cumA = [0] * N
tmp = 0
for i in range(N):
    tmp += A[i]
    cumA[i] = tmp

from bisect import bisect_left

index = bisect_left(cumA, cumA[-1] / 2)

if index == 0:
    left = 0
else:
    left = cumA[index - 1]
right = cumA[index]
ans = min(right * 2 - cumA[-1], cumA[-1] - left * 2)


print(ans)


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

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

    int n;
    string s;
    cin >> n >> s;

    int ans = 0;
    while (true) {
        int index = s.find("ABC");
        if (index == (int)string::npos) {
            break;
        } else {
            s = s.substr(index + 3);
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int abs(int a){
  if(a>=0) return a;
  else return -a;
}

int max(int a, int b){
  if(a>=b) return a;
  else return b;
}

int main(){
  int N;
  int x[101],y[101],h[101];
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    scanf("%d%d%d",&x[i],&y[i],&h[i]);
  }

  //h[i]が0でないiを調べておく．
  int pi;
  for(int i=1;i<=N;i++){
    if(h[i]!=0) pi=i;
  }

  //中心を全探索
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      int H;
      H=h[pi]+abs(x[pi]-i)+abs(y[pi]-j);
      int A=1;
      for(int k=1;k<=N;k++){
        if(h[k]==max(H-abs(x[k]-i)-abs(y[k]-j),0)) A=1;
        else{
          A=0;
          break;
        }
      }
      if(A==1){
        printf("%d %d %d\n",i,j,H);
      }
    }
  }

  return 0;
}


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

int main()
{
    ull H, N, sum;
    cin >> H >> N;
    sum=0;
    for(ull i=0; i<N; i++)
    {
        ull temp=0;
        cin >> temp;
        sum = sum + temp;
        if(sum > H)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(sum >= H)
    {
        cout << "Yes" << endl;
        return 0;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<list>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
using namespace std;
#define REP(i,m,n) for(int i = (m); i < (n);i++)
#define rep(i,n) REP(i,0,n)


int main() {
	int n;
	cin >> n;
	cout << 800 * n - (n/15)*200 << endl;
	return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n;
    cin >> n;
    vector<string> ss(n);
    vector<vector<int>> trie(1, vector<int>(26, -1));
    vector<int> sizes(1, 0);
    vector<int> terminal(1, 0);
    for (int i = 0; i < n; ++i) {
        cin >> ss[i];
        const int l = ss[i].size();
        int node = 0;
        sizes[0]++;
        for (int j = 0; j < l; ++j) {
            int next = trie[node][ss[i][j] - 'a'];
            if (next == -1) {
                next = trie.size();
                trie.emplace_back(26, -1);
                trie[node][ss[i][j] - 'a'] = next;
                sizes.push_back(0);
                terminal.push_back(0);
            }
            sizes[next]++;
            node = next;
        }
        terminal[node]++;
    }

    vector<vector<vector<int>>> comparisons;
    vector<int> prefixes;
    for (int i = 0; i < n; ++i) {
        const int l = ss[i].size();
        int node = 0;
        int prefix = 0;
        vector<vector<int>> comparison(26, vector<int>(26));
        for (int j = 0; j < l; ++j) {
            prefix += terminal[node];

            const int ch = ss[i][j] - 'a';
            for (int c = 0; c < 26; ++c) {
                if (c == ch) {
                    continue;
                }
                if (trie[node][c] != -1) {
                    comparison[ch][c] += sizes[trie[node][c]];
                }
            }
            node = trie[node][ch];
        }
        comparisons.push_back(comparison);
        prefixes.push_back(prefix);
    }

    li q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        li k;
        string p;
        cin >> k >> p;
        k--;
        li ans = 1 + prefixes[k];
        for (int ch = 0; ch < 26; ++ch) {
            const int pch = p[ch] - 'a';
            for (int c = 0; c < ch; ++c) {
                const int pc = p[c] - 'a';
                ans += comparisons[k][pch][pc];
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 372588
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  int fir = a[0];
  rep(i, n - k){
    if(a[i] < a[i + k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 4784
import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int C = sc.nextInt();
	int D = sc.nextInt();	
    	System.out.println(A+B > C+D ? "Left" : (A+B < C+D ? "Right" : "Balanced"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int ans = 0;

	for(int i = 1 ; i <= N ; i++){
	    int n = i;
	    int cnt = 0;
	    while(n > 0){
		cnt += n % 10;
		n /= 10;
	    }
	    ans += (cnt>=A && cnt<=B ? i : 0);
	}
	System.out.println(ans);
    }
    private void solveC() {
    }
    private void solveD() {
    }
}


Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for (int i = 2; i < N; i++) {
    if (S[i - 2] == 'A' && S[i - 1] == 'B' && S[i] == 'C') {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	map<char,int> mp;
	for(int i=0;i<10;i++){
		mp[(char)('0'+i)]=i;
	}
	mp['a']=10;
	mp['b']=11;
	mp['c']=12;
	mp['d']=13;
	mp['e']=14;
	mp['f']=15;
	string base16="0123456789abcdef";
	int q; cin >> q;
	while(q--){
		vector<unsigned int> v(9);
		for(int i=0;i<9;i++){
			string s; cin >> s;
			for(char c:s){
				v[i]*=16;
				v[i]+=mp[c];
			}
		}
		int b=0;
		unsigned int res=0;
		for(int i=0;i<32;i++){
			int c=0;
			for(int j=0;j<8;j++){
				if(v[j]&(1LL<<i))c++;
			}
			int d=0;
			if(v[8]&(1LL<<i))d++;
			if((b+c+d)%2){
				res+=(1LL<<i);
				b=(b-c+8)/2;
			}
			else b=(c+b)/2;
		}
		if(res==0){
			printf("0\n");
		}
		else{
			string ans="";
			while(res){
				ans+=base16[res%16];
				res/=16;
			}
			reverse(ans.begin(), ans.end());
			for(char c:ans){
				printf("%c",c);
			}
			printf("\n");
		}
	}
}



Measured memory_bytes: 3048
#if defined(LOCAL)
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#endif
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <iostream>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <limits>
#include <numeric>
#include <queue>
#include <memory>

using namespace std;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ii = pair<int,int>; using lu = unsigned long long; using l = long long;
using vs = vector<string>; using vii = vector<ii>;
using vl = vector<l>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>; using sl = unordered_set<l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; const double PI = M_PI;
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));

void solve(istream& in, ostream& out);
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  tst::test_init(argc, argv);
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  tst::maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}
const l MOD = e9 + 7; // end of template

void solve(istream& in, ostream& out) {
  l n; unordered_set<string> ss;
  bool ok = true;
  string prev;
  in >> n;
  F(i, 0, n) {
    string s; in >> s;
    ok = ok and ss.count(s) == 0;
    if (i) ok = ok and prev.back() == s[0];
    ss.emplace(s);
    swap(prev, s);
  }
  out << (ok ? "Yes" : "No") << lf;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(){

    int n, l;
    cin >> n;
    cin >> l;

    int taste;
    bool flag = false;
    if(l >= 0){
        for(int i = 1; i < n; i++){
            taste += l + i;
        }
    }else{
        for(int i = 0; i < n; i++){
            if(i == abs(l)){
                flag = true;
                continue;
            }
            taste += l + i;
        }
        if(!flag){
            taste -= l + n - 1;
        }
    }

    cout << taste << endl;

    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
int x[5],i,j;
while(scanf("%d,%d,%d,%d,%d",&x[0],&x[1],&x[2],&x[3],&x[4])!=EOF){
for(j=0;j<5;j++){
for(i=0;i<4;i++){
if(x[i]>x[i+1]){
int g=x[i+1];
x[i+1]=x[i];
x[i]=g;
}}}
if(x[0]==x[1] && x[1]==x[2] && x[2]==x[3]){
printf("four card\n");
continue;
}
if(x[1]==x[2] &&x[2]==x[3]&&x[3]==x[4]){
printf("four card\n");
continue;
}
if(x[0]==x[1]&&x[1]==x[2]&&x[3]==x[4]){
printf("full house\n");
continue;
}
if(x[0]==x[1]&&x[2]==x[3]&&x[3]==x[4]){
printf("full house\n");
continue;
}
if(x[0]<=10 && x[0]+1==x[1]&&x[1]+1==x[2]&&x[2]+1==x[3]&&x[3]+1==x[4]){
printf("straight\n");
continue;
}
if(x[0]==1&&x[1]==10&&x[2]==11&&x[3]==12&&x[4]==13){
printf("straight\n");
continue;
}
if(x[0]==x[1]&&x[1]==x[2]){
printf("three card\n");
continue;
}
if(x[1]==x[2]&&x[3]==x[2]){
printf("three card\n");
continue;
}
if(x[2]==x[3]&&x[3]==x[4]){
printf("three card\n");
continue;
}
if(x[0]==x[1] && x[2]==x[3]){
printf("two pair\n");
continue;
}
if(x[0]==x[1] && x[2]==x[3]){
printf("two pair\n");
continue;
}
if(x[0]==x[1]&&x[3]==x[4]){
printf("two pair\n");
continue;
}
if(x[1]==x[2]&&x[3]==x[4]){
printf("two pair\n");
continue;
}
if(x[0]==x[1]){
printf("one pair\n");
continue;
}
if(x[2]==x[1]){
printf("one pair\n");
continue;
}
if(x[2]==x[3]){
printf("one pair\n");
continue;
}
if(x[3]==x[4]){
printf("one pair\n");
continue;
}
printf("null\n");
}
return 0;
}

Measured memory_bytes: 1008
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int m,n,i,j;
	char c[105][105];
	scanf("%d%d",&m,&n);
	getchar();
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		scanf("%c",&c[i][j]);
		getchar();
		c[i][n]=0;
	}
	for(i=0;i<m;i++)
	{
		printf("%s\n%s\n",c[i],c[i]);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#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
using namespace std;
#define rep(i, n) for (long long  i = 0; i < (long long)(n); i++)






int main() {
	int s,k;
		
	cin >> s>>k;
	
	
	if ((s+k)%2==0) {
		cout << (s + k) / 2 << endl;
	
	}
	else {

		cout << "IMPOSSIBLE" << endl;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

#define PB push_back

using namespace std;

const int N = 1e5 + 500;

int n, m, A[N];
vector < int > a, b, nep;


int main(){
	scanf("%d%d", &n, &m);
	if(m == 1){
		int x; scanf("%d", &x);
		if(x == 1){
			printf("1\n1\n1\n");
			return 0;
		}
		printf("%d\n2\n%d %d\n", x, 1, x - 1);
		return 0;
	}
	for(int i = 0;i < m;i++){
		scanf("%d", A + i);
		if(A[i] % 2){
			nep.PB(A[i]);
		}
		else{
			a.PB(A[i]);
		}
	} 
	if((int)nep.size() > 0)
		a.insert(a.begin(), nep[0]);
	if((int)nep.size() > 1)
		a.PB(nep[1]);
	if((int)nep.size() > 2){
		printf("Impossible\n");
		return 0;
	}
	for(int i = 0;i < (int)a.size();i++){
		if(!i){
			if(a[i] - 1)
				b.PB(a[i] - 1);
			b.PB(2);
		}
		else if(i + 1 < (int)a.size()){
			b.PB(a[i]);
		}
		else{
			if(a[i] - 1)
				b.PB(a[i] - 1);
		}
	}
	for(int x : a)
		printf("%d ", x);
	printf("\n");
	printf("%d\n", (int)b.size());
	for(int x : b)
		printf("%d ", x);
	printf("\n");
	return 0;
	
}

Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <math.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}

	int X;
	std::cin >> X;

	int result = 1;
	int sq = (int)sqrt(X);
	for (int b = 2; b <= sq; ++b) {
		int bp = b;
		for (int p = 2;; ++p) {
			bp *= b;
			if (bp <= X) {
				result = std::max(result, bp);
			} else {
				break;
			}
		}
	}
	std::cout << result << "\n";
}


Measured memory_bytes: 512