akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
static const int MAX_N = 1001;
int fruits[MAX_N];
using namespace std;
int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    for (int i = 0; i < N; i++) scanf("%d", &fruits[i]);
    sort(fruits, fruits+N);
    int ans = 0;
    for (int i = 0; i < K; i++) ans+=fruits[i];
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1712
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  if(a==b){
    cout<<2*a;
  }else{
    cout<<2*max(a,b)-1;
  }
}

Measured memory_bytes: 256
#define P(x) cout << #x" = " << x << endl
#define PP(x, y) cout << "("#x", "#y") = (" << x << ", " << y << ")" << endl
#define PPP(x, y, z) cout << "("#x", "#y", "#z") = (" << x << ", " << y << ", " << z << ")" << endl

#include <iostream>
#include <vector>
#include <set>
using namespace std;

int n, k;
set<int> d;
int main(){
    cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        int di;
        cin >> di;
        d.insert(di);
    }
    while(true){
        int tmp = n;
        bool ok = true;
        while (tmp != 0) {
            if (d.count(tmp % 10) != 0) {
                ok = false;
                break;
            }
            tmp /= 10;
        }
        if (ok) break;
        n++;
    }
    cout << n << endl;
}


Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  cout << S[0] << S[1] << S[2] << endl;
  return 0;
}


Measured memory_bytes: 3640
use strict;
use warnings;
use utf8;
use v5.18;

package UnionFind {

    sub new {
        my $class = shift;
        my %param = @_;

        my @parent = map { $_ } ( 0 .. $param{N} - 1 );
        my @rank = map { 0 } ( 0 .. $param{N} - 1 );

        my $self = bless {
            N      => $param{N},
            parent => \@parent,
            rank   => \@rank
          },
          $class;
        return $self;
    }

    sub find {
        my ( $self, $x ) = @_;

        # warn "debug: $self->{parent}->[$x], $x";
        return $x if $self->{parent}->[$x] == $x;

        $self->{parent}->[$x] = $self->find( $self->{parent}->[$x] );
        $self->{parent}->[$x];
    }

    sub unite {
        my ( $self, $x, $y ) = @_;
        $x = $self->find($x);
        $y = $self->find($y);
        return if $x == $y;

        my $rank   = $self->{rank};
        my $parent = $self->{parent};

        if ( $rank->[$x] < $rank->[$y] ) {
            $parent->[$x] = $y;
        }
        else {
            $parent->[$y] = $x;
            if ( $rank->[$x] == $rank->[$y] ) {
                $rank->[$x]++;
            }
        }
    }

    sub same {
        my ( $self, $x, $y ) = @_;
        $self->find($x) == $self->find($y);
    }
}

my ( $N, $M ) = split( / /, <STDIN> );
my @p = map { $_ - 1 } split( / /, <STDIN> );
my @x;
my @y;
for ( 1 .. $M ) {
    my ( $a, $b ) = split( / /, <STDIN> );
    push @x => $a - 1;
    push @y => $b - 1;
}

my $uf = UnionFind->new( N => $N );
for ( 0 .. $M - 1 ) {
    $uf->unite( $x[$_], $y[$_] );
}

my $ans = 0;
for ( 0 .. $N - 1 ) {
    $ans++ if $_ == $p[$_] or $uf->same( $_, $p[$_] );
}

print "$ans\n";


Measured memory_bytes: 29900
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a;
  cin>>a;
  ll b=1;
  char c;
  cin>>c;
  for(ll i=1;i<a;i++){
    char d;
    cin>>d;
    if(c!=d){
      b+=1;
      c=d;
    }
  }
  cout<<b<<endl;
  return 0;
  
      
                        
                        
}


Measured memory_bytes: 3584
#include <stdio.h>

typedef struct {
	int key, id;
} data;

typedef struct {
	data obj[200001];
	int size;
} max_heap;

void push(data x, max_heap* h)
{
	int i = h->size;
	data tmp;
	h->obj[(h->size)++] = x;
	while (1) {
		if (i == 0) break;
		else if (h->obj[i].key > h->obj[(i-1)/2].key) {
			tmp = h->obj[(i-1)/2];
			h->obj[(i-1)/2] = h->obj[i];
			h->obj[i] = tmp;
			i = (i - 1) / 2;
		} else break;
	}
}

data pop(max_heap* h)
{
	int i = 0, j;
	data output = h->obj[0], tmp;
	h->obj[0] = h->obj[--(h->size)];
	while (1) {
		if (i * 2 + 1 >= h->size) break;
		else if (i * 2 + 2 >= h->size) j = i * 2 + 1;
		else if (h->obj[i*2+1].key > h->obj[i*2+2].key) j = i * 2 + 1;
		else j = i * 2 + 2;
		if (h->obj[j].key > h->obj[i].key) {
			tmp = h->obj[j];
			h->obj[j] = h->obj[i];
			h->obj[i] = tmp;
			i = j;
		} else break;
	}
	return output;
}

int main()
{
	int i, N, a[300001];
	scanf("%d", &N);
	for (i = 1; i <= N * 3; i++) scanf("%d", &(a[i]));
	
	long long sum[2][100001];
	data d;
	max_heap h;
	h.size = 0;
	for (i = 1, sum[0][0] = 0; i <= N; i++) {
		d.key = -a[i];
		push(d, &h);
		sum[0][0] += a[i];
	}
	for (i = 1; i <= N; i++) {
		d.key = -a[i+N];
		push(d, &h);
		d = pop(&h);
		sum[0][i] = sum[0][i-1] + a[i+N] + d.key;
	}
	
	h.size = 0;
	for (i = N, sum[1][0] = 0; i >= 1; i--) {
		d.key = a[i+N*2];
		push(d, &h);
		sum[1][0] += a[i+N*2];
	}
	for (i = N; i >= 1; i--) {
		d.key = a[i+N];
		push(d, &h);
		d = pop(&h);
		sum[1][N-i+1] = sum[1][N-i] + a[i+N] - d.key;
	}
	
	long long ans = sum[0][0] - sum[1][N];
	for (i = 1; i <= N; i++) if (sum[0][i] - sum[1][N-i] > ans) ans = sum[0][i] - sum[1][N-i];
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
map<ll,bool> x;
int main()
{
	ll n,m,a;
	cin >> n >> m;
	while(m--){
		cin >> a;
		x[a]=true;
	}
	ll p=n,q=n;
	bool find=false;
	while(!find){
		if(!x[p] or !x[q]){
			cout << ((!x[p])? p : q) << endl;
			find=true;
		}
		p--;
		q++;
	}
}

Measured memory_bytes: 3608
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

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

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/
vector<ll> modulo(201900);
void solve()
{
    string s;
    cin>>s;

    ll n=s.size();

    ll a[n],ans=0;
    f(i,n) a[i]=s[i]-'0';

    vector<ll> dp(2019);
    dp[a[0]]=1;

    for(ll i=1;i<n;i++)
    {
        vector<ll> temp(2019);
        temp[a[i]]=1;
        f(j,2019)
        {
            ll rem=(j*10)+a[i];
            rem=modulo[rem];
            temp[rem]+=dp[j];
        }
        ans+=temp[0];
        dp=temp;
    }
    cout<<ans<<"\n";

    return;
}

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

    f(i,201900)
    {
        modulo[i]=i%2019;
    }
    ll t=1;
    //cin>>t;
    clock_t launch=clock();

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

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 6776
import java.util.HashMap;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        HashMap<String,String> map = new HashMap<String, String>();
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for(int i=0;i < n;i++){
            String resister = scan.next();
            map.put(resister, resister);
        }
        int m = scan.nextInt();
        boolean flag = false;
        for(int i=0;i < m;i++){
            String id = scan.next();
            if(map.containsKey(id)){
                if(flag){
                    System.out.println("Closed by " + id);
                } else{
                    System.out.println("Opened by " + id);
                }
                flag = !flag;
            } else{
                System.out.println("Unknown " + id);
            }
        }
    }
}

Measured memory_bytes: 20584
#include<bits/stdc++.h>
using namespace std;
#define N 800000
int n,x,y,tot,S,T,xb,cnt,head[N],q[N],mx[N],num[N],a[N];
bool vis[N];
struct edge {
	int v,nxt;
} e[N];
void add(int x,int y) {
	e[++tot].v=y;
	e[tot].nxt=head[x];
	head[x]=tot;
}
void bfs() {
	memset(vis,0,sizeof vis);
	int tt=0,ww=0;
	q[++ww]=S;
	vis[S]=1;
	while (tt<ww) {
		int u=q[++tt];
		for (int i=head[u],v; i; i=e[i].nxt)
			if (!vis[v=e[i].v]) {
				vis[v]=1;
				q[++ww]=v;
			}
	}
	T=q[ww];
}
void dfs(int u,int fa) {
	int tmp=0;
	mx[u]=0;
	for (int i=head[u],v; i; i=e[i].nxt)
		if ((v=e[i].v)!=fa) {
			dfs(v,u);
			mx[u]=max(mx[u],mx[v]);
			if (mx[v]>1) ++tmp;
			else if (v!=T) ++num[u];
		}
	if (tmp>1) {
		puts("-1");
		exit(0);
	}
	++mx[u];
	if (u!=S&&u!=T&&mx[u]>1) a[++xb]=num[u];
}
void print(int u,int fa) {
	int t=++cnt;
	for (int i=head[u],v; i; i=e[i].nxt)
		if ((v=e[i].v)!=fa&&mx[v]==1&&v!=T)
			printf("%d ",++cnt);
	printf("%d ",t);
	for (int i=head[u],v; i; i=e[i].nxt)
		if ((v=e[i].v)!=fa&&(mx[v]>1||v==T))
			print(v,u);
}
int main() {
	scanf("%d",&n);
	for (int i=1; i<n; ++i) {
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	S=1;
	bfs();
	S=T;
	bfs();
	dfs(S,0);
	/*cout<<S<<endl;
	for(int i=1; i<=n; i++) {
		printf("%d %c",mx[i],i==n?'\n':' ');
	}
	for(int i=1; i<=n; i++) {
		printf("%d %c",num[i],i==n?'\n':' ');
	}
	for(int i=1; i<=xb; i++) {
		printf("%d %c",a[i],i==xb?'\n':' ');
	}*/
	reverse(a+1,a+xb+1);
	bool fl=1;
	for (int i=1; i<=xb; ++i) {
		if (a[i]<a[xb-i+1]) {
			fl=1;
			break;
		}
		if (a[i]>a[xb-i+1]) {
			fl=0;
			break;
		}
	}
	xb=0;
	if (fl) print(S,0);
	else {
		swap(S,T);
		dfs(S,0);
		print(S,0);
	}
	return 0;
}

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

int main(void){
    using namespace std;
    int n;

    cin >> n;

    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n-1);
    for (int i = 0; i < n;i++)
        cin >> a[i];

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

    for (int i = 0; i < n-1;i++)
        cin >> c[i];

    int ret = 0;
    int prev = -2;
    for (int i = 0; i < n;i++){
        int current = a[i];
        ret += b[current-1];

        if(prev + 1 == current)
            ret += c[prev-1];

        prev = current;
    }

    std::cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
for i in range(min(n, k) + 1):
    for j in range(min(n, k) + 1 - i):
        if i == 0 and j == 0:
            continue
        if j == 0:
            vv = v[:i]
        else:
            vv = v[:i] + v[-j:]
        num = sum(vv)
        vv.sort()
        for l in range(min(len(vv), k - i - j)):
            if vv[l] < 0:
                num -= vv[l]
            else:
                break
        ans = max(ans, num)
print(ans)

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

int main() {
  int n,m;
  cin >> n >> m;
  int ac=0;
  int pen=0;
  vector<int>a(n);
  vector<bool>b(n);
  rep(i,n) b[i]=false;
  rep(i,m){
    int p;
    string s;
    cin >> p >> s;
    p--;
    if(s=="AC"){
      if(!b[p]){
        ac++;
        pen+=a[p];
        b[p]=true;
      }
    }
    else{
      if(!b[p])a[p]++;
    }
  }
  cout << ac <<" "<<pen << endl;
  
  
  
}


Measured memory_bytes: 640
#include <iostream>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>

using namespace std;

int main() {
  long long n,k,m,l;
  cin>>n>>k;
  m=n%k;
  l=abs(m-k);
  if(m<l){
    cout<<m;
  }else{
    cout<<l;
  }
  cout<<endl;
}


Measured memory_bytes: 256
# C

X,N=map(int,input().split())
p=list(map(int,input().split()))
q=[]
for i in range(0,102):
    if i not in p:
        q.append(i)
R=len(q)
M= [ [ q[i],abs(q[i]-X)] for i in range(R)]
#print(M)
M.sort(key=lambda x:x[0])
M.sort(key=lambda x:x[1])
print(M[0][0])

Measured memory_bytes: 9144
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod = 1e9 + 7;
long long INF = 1e7;
double EPS = 1e-12;
typedef long long int lld;
long double tick(){static clock_t oldt; clock_t newt=clock();
    long double diff=1.0L*(newt-oldt)/CLOCKS_PER_SEC; oldt = newt; return diff; }
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
inline lld sc() { lld a; scanf("%lld", &a); return a; }
inline int scd() { int a; scanf("%d", &a); return a; }
inline double scf() { double a; scanf("%lf",&a); return a; }
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) (c).begin(), (c).end()
#define sz(a) ((int)a.size())
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }
#define errorpair(a) cout<<#a<<" = ( "<<((a).first)<<" , "<<((a).second)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll

typedef pair<lld,lld> PA;

lld powP(lld x, lld y) {
    lld ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}
 
bool bitSet(lld n, lld bit){
    if((n & (1LL << bit)) != 0) return true;
    else return false;
}
 
lld findGcd(lld a, lld b){
    while(a != 0) { lld temp = b % a; b = a; a = temp; }
    return b;
}

#define lim 300010
#define lim2 200010
#define qqqqqq 210
// Ab :)
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

// vector<lld> G[lim];
// string S[lim];
// lld A[lim],B[lim],C[lim];

int main(){
    lld curr = 100;
    lld x = sc();
    lld ans = 0;
    while(curr < x) {
        curr += curr / 100;
        ans++;
    }
    prL(ans);
    return 0;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------



int main() {
   ll n;
   cin>>n;
   vll a(10001,0);
   rep2(i,1,100){
       rep2(j,1,100){
           rep2(k,1,100){
               ll ans=i*i+j*j+k*k+i*j+j*k+k*i;
               if(ans<10001)a.at(ans)++;
           }
       }
   }
   rep2(i,1,n+1)cout<<a.at(i)<<endl;
   
}



Measured memory_bytes: 3700
import java.util.*;
public class Main {	
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new AOJ0015();
	}
	
	class AOJ0015{
		public AOJ0015() {
			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			for(int s=0;s<n;s++){
				String a = in.next(),c="";
				String b = in.next(),d="";
				for(int i=a.length()-1;i>=0;i--)c+=a.charAt(i);
				for(int i=b.length()-1;i>=0;i--)d+=b.charAt(i);
				String result = "";
				int save = 0;//余った数字
				for(int i=0;i<Math.max(a.length(), b.length());i++){
					if(c.length()>i&&d.length()>i){
						int num1=Integer.parseInt(c.charAt(i)+"");
						int num2=Integer.parseInt(d.charAt(i)+"");
						int sum = num1+num2;
						if(i!=0)sum+=save;
						save=0;
						if(sum>9){
							save = 1;
							sum-=10;
						}
						result+=Integer.toString(sum);
					}else if(c.length()>i&&d.length()<=i){
						int sum=Integer.parseInt(c.charAt(i)+"");
						if(i!=0)sum+=save;
						save=0;
						if(sum>9){
							save = 1;
							sum-=10;
						}
						result+=Integer.toString(sum);
					}else if(d.length()>i&&c.length()<=i){
						int sum=Integer.parseInt(d.charAt(i)+"");
						if(i!=0)sum+=save;
						save=0;
						if(sum>9){
							save = 1;
							sum-=10;
						}
						result+=Integer.toString(sum);
					}
				}
				if(save==1)result+="1";
				if(result.length()>80)System.out.println("overflow");
				else{
					for(int k=result.length()-1;k>=0;k--)System.out.print(result.charAt(k));
					System.out.println();
				}
			}
			
			
			
			
		}
	}
	
	class AOJ0036{
		char doIt(int y,int x){
			if(hyou[y+1][x] && hyou[y][x+1] && hyou[y+1][x+1] ){
				return 'A';
			}else if( hyou[y+1][x] && hyou[y+2][x] && hyou[y+3][x] ){
				return 'B';
			}else if( hyou[y][x+1] && hyou[y][x+2] && hyou[y][x+3] ){
				return 'C';
			}else if( hyou[y][x+1] && hyou[y+1][x+1] && hyou[y+1][x+2] ){
				return 'E';
			}else if( hyou[y+1][x] && hyou[y+1][x+1] && hyou[y+2][x+1] ){
				return 'F';
			}else if( hyou[y][x+1] && hyou[y+1][x] && hyou[y+1][x-1] ){
				return 'G';
			}else if( hyou[y+2][x-1] && hyou[y+1][x] && hyou[y+1][x-1] ){
				return 'D';
			}
			return ' ';
		}
		boolean[][] hyou = new boolean[10][10];
		public AOJ0036() {
			Scanner in = new Scanner(System.in);
			while(in.hasNext()){
				for(int s=0;s<8;s++){
					String a = in.next();
					for(int i=0;i<a.length();i++)hyou[s][i]=a.charAt(i)=='1'? true:false;
				}
				for(int s=0;s<8;s++){
					boolean a=false;
					for(int i=0;i<8;i++)
						if(hyou[s][i]){
							System.out.println(doIt(s, i));
							a = true;
							break;
						}
					if(a)break;
				}
			}
		}
	}
	
	class AOJ0034{
		int[] kyori = new int[11];
		int speed1,speed2;
		public AOJ0034() {
			Scanner in = new Scanner(System.in);
			while(in.hasNext()){
				String input[] = in.next().split(",");
				int sum=0;
				for(int i=1;i<=10;i++){
					kyori[i] = Integer.parseInt(input[i-1]);
					sum+=kyori[i];
				}
				speed1 = Integer.parseInt(input[10]);
				speed2 = Integer.parseInt(input[11]);
//				double one,two;
//				for(int s=1;s<=10;s++){//終点駅まで
//					
//				}
				
				
				
			}
			
			
			
			
		}
		
		
	}
}

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


using namespace std;


using ll = long long;


int main()
{
    ll N, M;
    cin >> N >> M;
    vector<pair<ll, ll>> shops;

    for (ll i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        shops.push_back(make_pair(a, b));
    }

    sort(shops.begin(), shops.end(), [](auto &l, auto &r) { return l.first < r.first; });

    ll now = 0;
    ll ans = 0;
    for (auto it = shops.begin(); it != shops.end() && now < M; ++it) {
        if (now + it->second >= M) {
            ans += (M - now) * it->first;
            now += (M - now);
        } else {
            ans += it->first * it->second;
            now += it->second;
        }
    }

    cout << ans << endl;
}


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

using namespace std;

int main(){
	while(true){
		int n; cin >> n;
		if(n == 0 ) break;
		vector<vector<bool> > m(21,vector<bool>(21,false));
		for(int i = 0; i < n; ++i){
			int x,y; cin >> x >> y;
			m[x][y] = true;
		}
		int nx = 10, ny = 10;
		int q; cin >> q;
		for(int i = 0; i < q; ++i){
			char d;
			int dis; cin >> d >> dis;
			int dx = 0,dy = 0;
			switch(d){
				case 'S':
					dy = -1;
					break;
				case 'N':
					dy = 1;
					break;
				case 'W':
					dx = -1;
					break;
				case 'E':
					dx = 1;
					break;
			}
			for(int j = 0; j < dis; ++j){
				nx += dx;
				ny += dy;
				m[nx][ny] = false;
			}
		}
		bool flag = true;
		for(int i = 0; i < 21; ++i)for(int j = 0; j < 21; ++j){
			if(m[i][j]){
				flag = false;
				break;
			}
		}
		if(flag)cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3056
// cout << "Case #" << test << ": ";
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
ll modpow(ll a, ll n, ll mod = MOD) {
    ll res = 1;
    while(n > 0) {
        if(n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n + 1), rui(n + 2, 0);
    for(int i = 0; i <= n; i++) {
        a[i] = i;
        rui[i + 1] = rui[i] + a[i];
    }
    ll ans = 0;
    for(int i = k; i <= n + 1; i++) {
        ll m = rui[i];
        ll M = rui[n + 1] - rui[n + 1 - i];
        // cout << m << ":" << M << endl;
        ans += (M - m + 1);
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6352
import java.io.*;
import java.lang.*;
import java.util.*;

 public class Main{
  
 public static void main(String args[]){
   
  Scanner s = new Scanner(System.in);
   
  int n=s.nextInt();
     int a[]=new int[n];
     for(int i=0;i<n;i++)
         a[i]=s.nextInt();
     
     Arrays.sort(a);
     
     Queue<Integer> qq = new LinkedList<Integer>();
     if(n==1){
      System.out.println("0");   
     }else if(n==2){
      System.out.println(a[1]);   
     }else{
         qq.add(a[n-2]);
         qq.add(a[n-2]);
         long sum=0;
         sum+=a[n-1];
         for(int i=n-3;i>=0;i--){
             
             sum+=qq.remove();
             qq.add(a[i]);
             qq.add(a[i]);
             
         }
         System.out.println(sum);
     }
 }
  
}

Measured memory_bytes: 65940
main :: IO ()
main = do
    dice <- fmap words getLine
    coms <- getLine
    putStrLn . head $ foldl role dice coms

role :: [String] -> Char -> [String]
role [a,b,c,d,e,f] com
    | com == 'E' = [d,b,a,f,e,c]
    | com == 'N' = [b,f,c,d,a,e]
    | com == 'S' = [e,a,c,d,f,b]
    | com == 'W' = [c,b,f,a,e,d]


Measured memory_bytes: 3572
#include<iostream>
using namespace std;
typedef long long ll;

ll time_seq[200005];

int main() {
    ll N, T, oyu_sum = 0;
    cin >> N >> T;
    for (int i = 0; i < N; i++) cin >> time_seq[i];
    for (int i = 0; i < N - 1; i++) {
        if (time_seq[i + 1] - time_seq[i] < T) oyu_sum += time_seq[i + 1] - time_seq[i];
        else oyu_sum += T;
    }
    oyu_sum += T;
    cout << oyu_sum << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

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

    vector<int> nums;
    int cnt = 0;
    int now = 1;
    rep(i,n){
        if (s[i] == '0'+now) cnt++;
        else {
            nums.push_back(cnt);
            now ^= 1;
            cnt = 1;
        }
    }
    nums.push_back(cnt);

    if (nums.size() % 2 == 0) nums.push_back(0);

    int left = 0, right = 0, add = 2 * k + 1;
    int tmp = 0;
    int ans = 0;
    for(int i = 0; i < nums.size(); i+=2){
        int nextLeft = i;
        int nextRight = min(i + add, (int)nums.size());

        while(left < nextLeft){
            tmp -= nums[left];
            left++;
        }

        while(right < nextRight){
            tmp += nums[right];
            right++;
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4024
//  AtCoder Beginner Contest 134 
//  ドタバタしてるけど頑張るぞー
#include <stdio.h>
int main(void){
    int i,j;    //ループ用変数
    int d,n,count;
    char box[256] = {};
    char box2[256] = {};
    count = 0;
    
    // INFO //
    // n 木の本数
    // d 監視員が他に見れる本数    
    //  入力
    scanf("%d %d",&n,&d);
    
    // n = 5 5hon
    // d = 3 
    //  処理
    for (i = 1; i < 21; i++){
        count = count + d * 2 + 1;
        if (n <= count){
            break;
        }
    }
    
    //  出力
    printf("%d",i);
}


Measured memory_bytes: 128
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define _D(p) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p)<<std::endl;
#define _D2(p,q) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p) << ", " #q " = "<<(q)<<std::endl;
#define _DN(v) std::cout<<"L"<<__LINE__<<" : " #v " = ["; rep(i,(v).size()) {std::cout<<v[i]<<(i==v.size()-1?"":", ");}std::cout<<"]"<<std::endl;
#define _DNN(v) std::cout<<"L"<<__LINE__<<" : " #v " = [" << std::endl; rep(i,(v).size()) {std::cout<<"    [";rep(j,(v)[0].size()){std::cout<<v[i][j]<<(j==v[0].size()-1?"":", ");}std::cout<<"],"<<std::endl;}std::cout<<"]"<<std::endl;
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int main(int argc, char const *argv[]) {
    ll x;
    cin >> x;
    //6,5,6,5,6,5,...,
    //11,11,11, 
    cout << ((x - 1) / 11) * 2 + ((x % 11) >= 7) + ((x % 11) == 0) + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
B = [0 for _ in range(N)]
for i in range(Q):
    B[A[i]-1] += 1
for i in range(N):
    if K + B[i] - Q<= 0 :
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 8640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<string, pi> P;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int H,W;
int dy[]={-1,-1,-1,0,1,1,1,0}, dx[]={-1,0,1,1,1,0,-1,-1};
char pat[16][32];
int vis[16][32];


string solve(){
  string res = "0";
  set<string>s;

  rep(i,H) rep(j,W){
    int sy=i,sx=j;
    rep(d,8){
      int ny=i,nx=j;
      string str="";
      str += pat[ny][nx];
      while(1){
	ny=(ny+dy[d]+H)%H, nx=(nx+dx[d]+W)%W;
	if(ny==sy&&nx==sx) break;
	str += pat[ny][nx];
	if(s.find(str) == s.end()){
	  s.insert(str);
	}else{
	  if(res.size() < str.size()) res = str;
	  else if(res.size() == str.size() && res > str) res = str;
	}
      }
    }
  }

  return res;
}

int main(){
  while(cin >> H >> W && H && W){
    rep(i,H) cin >> pat[i];
    cout << solve() << endl;
  }
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    string s,t; cin>>s>>t;
    ll ans=0;
    rep(i,s.size()) ans+= s[i]!=t[i];
    cout<<ans<<endl;
    return 0;
}


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

int main(){
  string S,T;
  cin >> S >> T;
  sort(S.begin(),S.end());
  sort(T.rbegin(),T.rend());
  if(S<T){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
    
    
  

Measured memory_bytes: 3528
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;


int main(){
    ll n;
    cin >> n;
    vector<ll> x(n),y(n),p(n),q(n);
    rep(i,n){
        cin >> x[i] >> y[i];
        p[i]=x[i]-y[i];
        q[i]=x[i]+y[i];
    }
    sort(p.begin(),p.end());
    sort(q.begin(),q.end());
    ll d1=p[n-1]-p[0];
    ll d2=q[n-1]-q[0];
    cout << max(d1,d2) << endl;
    return 0;
}

Measured memory_bytes: 9536
/*input
60 3
5 8
1 3
10 15
*/
/**
    Author: Kristopher Paul
    Date Created: 08-09-2020
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
//#define MOD 1000000007
#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

//Uncomment for File I/O
//ifstream fin("input.in")

//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n,k;
    cin >> n >> k;
    int l[k],r[k];
    FOR(i,0,k){
        cin >> l[i] >> r[i];
    }
    int dp[n] = {};
    dp[0] = 1;
    int pre[n] = {};
    pre[0] = 1;
    FOR(i,1,n){
        FOR(j,0,k){
            int rpos = i-l[j];
            int lpos = i-r[j];
            if(rpos < 0){
                continue;
            }
            remax(lpos,0LL);
            int ans = pre[rpos];
            if(lpos != 0){
                ans -= pre[lpos-1];
                while(ans < 0){
                    ans += MOD;
                }
            }
            ans %= MOD;
            dp[i] += ans;
            dp[i] %= MOD;
        }
        pre[i] += pre[i-1] + dp[i];
        pre[i] %= MOD;
    }
    cout << dp[n-1] << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 6760
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
map<ll,ll> a;
int main() {
  ll n,m;
  cin >> n >> m;
  ll tmp = 0;
  a[0]++;
  for(int i = 0; i < n; i++) {
    ll s;
    cin >> s;
    tmp += s;
    a[tmp % m]++;
  }

  ll ans = 0;
  for(auto itr = a.begin(); itr != a.end(); ++itr) {
    ll k = itr->second;
    ans += k * (k - 1) / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		// 入力値
		long a = sc.nextLong();
		long b = sc.nextLong();
		long k = sc.nextLong();
        sc.close();
        if(k>=a){
            k-=a;
            a=0;
            if(k>=b){
                k-=b;
                b=0;
            }else{
                b-=k;
            }
        }else{
            a-=k;
        }
		System.out.println(a+" "+b);
    }
}

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

int main(){
  int k;
  string s;
  cin>>k>>s;
  int n=s.size();
  if(n<=k) cout<<s<<endl;
  else{
    rep(i,k) cout<<s[i];
    cout<<"..."<<endl;
  }
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<sstream>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
typedef long long ll;
ll pow5(ll x)
{
    ll x2 = x * x;
    return x2 * x2 * x;
}

int main()
{
    ll x;
    cin >> x;
    ll sqrx = (ll)sqrt((double)x) + 2;
    for(ll p = 1; p <= sqrx; p++)
    {
        if(x % p == 0)
        {
            ll b = -(p / 2);
            while(1)
            {
                ll x2 = pow5(b + p) - pow5(b);
                if(x2 > x) break;
                if(x2 == x)
                {
                    cout << (b + p) << " " << b << endl;
                    return 0;
                }
                b++;
            }
        }   
    }
    return 0;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
int like[100];
int main()
{
    int ans=0;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int b;cin>>b;
        ans=__gcd(ans,b);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>

using namespace std;

typedef boost::multiprecision::cpp_int bigint;

int main()
{
        bigint N;
        cin >> N;
        for (int i = 1; i <= 3500; i++)
        {
            for (int j = 1; j <= 3500; j++)
            {
                bigint a = N * i *j;
                bigint b = 4 * i * j - N * i - N * j;
                if (b != 0 && a % b == 0 && b >= 1)
                {
                        bigint num = a / b;
                        cout << i << " " << j << " " << num << endl;
                        return 0;
                }
            }
        }
}

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

using namespace std;
typedef long long LL;

#define MAXN 200000
#define MOD 998244353
#define mp make_pair

int N;
int A[MAXN];

int main(int argc, char** argv) {
#ifdef OJ
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(false);

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] -= i + 1;
    }

    sort(A, A + N);
    int idx = N / 2;
    if (N % 2 == 0) idx--;

    LL ans = 0;
    for (int i = 0; i < N; i++) {
        ans += abs(A[idx] - A[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
N = int(input())
A = list(map(int,input().split()))
neg_num = 0
min_abs_a = float('inf')
sum_abs_A = 0
include_zero = False
for a in A:
  sum_abs_A += abs(a)
  min_abs_a = min(abs(a),min_abs_a)
  if a == 0: include_zero = True
  if a < 0 : neg_num += 1
print(sum_abs_A if neg_num%2==0 or include_zero is True else sum_abs_A - 2*min_abs_a)

Measured memory_bytes: 14412
s=input()
k=int(input())
chain_hajime=0
chain_owa=0
for i in range(len(s)):
    if s[0]==s[i]:
        chain_hajime+=1
    else: break
for i in range(len(s)):
    if s[-1]==s[-(i+1)]:
        chain_owa+=1
    else: break
#print(chain_hajime)
#print(chain_owa)
import re
def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """

    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]
a=list(nchars(s, 2))
b=0
for i in a:
    b+=len(i)//2


if len(set(s))==1:
    print(len(s)*k//2)
elif s[0]!=s[-1]:
    print(b*k)
else:
    print(b*k-(chain_hajime//2+chain_owa//2-(chain_hajime+chain_owa)//2)*(k-1))
    

Measured memory_bytes: 3188
#include<stdio.h>

int main(){
  int i;
  int N,M;
  double P;
  int X[1001];
  int num;

  while(1){
    num=0;
    scanf("%d %d %lf",&N,&M,&P);
    if(N==0&&M==0&&P==0) break;

    for(i=0;i<1001;i++){
      X[i]=0;
    }

    for(i=1;i<=N;i++){
      scanf("%d",&X[i]);
      num+=100*X[i];
    }

    num-=num*(P/100);

    if(X[M]==0) printf("0\n");
    else printf("%d\n",num/X[M]);
  }

  return 0;
}

Measured memory_bytes: 632
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <iostream>
#include <queue>

using namespace std;

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64; // 9e18
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

const double PI = 3.141592653589793238463;
const int MAXN = 1000500;
const int MAXVALUE = 1000000500;
const long double EPS = 1e-7;
const i64 INF = 1e18;
i64 mod = 1e9 + 7;


//i64 T, n, m, k;
//vector <i64> a;
//vector <i64> b;
//vector <i64> dp;
//i64 nx = 100000;
string s;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(16);

    long double a, b, h, m;
    cin >> a >> b >> h >> m;

    long double am = PI*m / 30;
    long double ah = PI*h / 6 + PI*m/360;

    long double ar = max(am, ah) - min(am, ah);
    if (ar == 0.0) {
        cout << fabs(a - b);
    }
    else {
        cout << sqrt(a*a + b*b - 2 * a*b*cos(ar));
    }



    return 0;
}

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

int main() {
    double pi = 3.14159265358979323;
    double a, b, x;
    cin >> a >> b >> x;
    if(x > a*a*b/2.0){
        cout << setprecision(14) << atan(2.0*(a*a*b-x)/(a*a*a)) * 180.0 / pi;
    }else{
        cout << setprecision(14) << 90.0 - atan(2.0*x/(a*b*b)) * 180.0 / pi;
    }
}

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

const int N = 1e5 + 5;

int32_t main()
{
	IOS;
	string a, b;
	cin >> a >> b;
	string s = b.substr(0, a.size());
	if(a == s)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 3672
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    w = input()
    dic = {}
    
    for i in w:
        if i in dic:
            dic[i] += 1
        else:
            dic[i] = 1
            
    for i in dic.values():
        if i % 2 == 1:
            print("No")
            sys.exit()
            
    print("Yes")
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 39280
#include <stdio.h>

int power(int n) {
  int i, p = 1;
  for (i = 0; i < n; i++) {
    p *= 10;
  }
  return p;
}

int main(void) {
  char str[100];
  int i, j, sum, len, slen;
  for (i = 0; i < 100; i++) {
    str[i] = '\0';
  }
  sum = 0;
  len = 0;
  while (scanf("%s", str) != EOF) {
    for (i = 0; i < 100; i++) {
      if (str[i] == '\0') break;
    }
    slen = i;
    
    for (i = 0; i < slen + 1; i++) {
      if ('0' <= str[i] && str[i] <= '9') {
	len++;
      } else if (len > 0) {
	for (j = i - len; j < i; j++) {
	  sum += (str[j] - '0') * power(i - j - 1);
	}
	len = 0;
      }
    }

    for (i = 0; i < 100; i++) {
      str[i] = '\0';
    }
  }
  printf("%d\n", sum);

  return 0;
}

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

int main() {
  int N;
  vector<double>a(109);
  //vector<double>b(109);
  cin >> N;
  for(int i=0; i<N; i++) {
	cin >> a.at(i);
  }
  double sum;
  for(int i=0; i<N; i++) {
    sum += 1/a.at(i);
  }
  double ans = 1/sum;
  cout << fixed << setprecision(16);
  cout << 1/sum << endl;
}


Measured memory_bytes: 256
import sys

s, k = sys.stdin.read().split()
k = int(k)

def main():
    cand = set()
    for j in range(1, k + 1):
        for i in range(len(s) - j + 1):
            cand.add(s[i:i+j])
    print(sorted(cand)[k-1])

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprev(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

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

    vector<int> arr(N);
    rep(i, N)
    {
        cin >> arr[i];
    }
    double sum = accumulate(arr.begin(), arr.end(), 0.0);
    int average = round(sum / arr.size());

    //cout << average << endl;
    ll r = 0;
    rep(i, N)
    {
        //cout << arr[i] << endl;
        int k = abs(arr[i] - average);
        r += k * k;
    }

    cout << r << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define sep(i,b,a) for(ll i=b-1;i>=a;i--)
#define hell (int)(1e9+7)
//#define int long int

using namespace std;

void solve(){
    string s;
    cin>>s;
    int i,j;
    i=0;
    j=s.length()-1;
    int ans=0;
    while(i<j){
        if(s[i++]!=s[j--])
            ans++;
    }
    cout<<ans;
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


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

using namespace std;

int main()
{
  vector<int>a;
  
  int j,n,m;
  cin>>j;
  for(int i=1;i<=j;i++)
  {
  	cin>>n;
  	if(n==0)
	  {cin>>m;a.push_back(m);}
	if(n==1)
	  {cin>>m;cout<<a.at(m)<<endl;}
	if(n==2)
	  {a.pop_back();}
  }	
  //cout<<endl;
	
	
	
	
		return 0;
}


Measured memory_bytes: 3920
#include<iostream>
#include<cstdio>
using namespace std;
struct data{
	int x,y;
}t[6001];
int n,m,x,y,cnt,h[3001],f[3001],k[3001];
void add(int a,int b){
	cnt++;
	t[cnt].x=b;
	t[cnt].y=h[a];
	h[a]=cnt;
}
bool check(int a,int fa){
	if(fa&&f[a]>=f[fa])return 1;
	int sz=0;
	for(int i=h[a];i;i=t[i].y){
		if(t[i].x==fa)continue;
		sz++;
		if(!check(t[i].x,a))return 1;
	}
	if(sz==0)if(f[a]<f[fa])return 0;
	return 0;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&f[i]);
	for(int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	for(int i=1;i<=n;i++)if(check(i,0))printf("%d ",i);
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    ll l = 1e9, r = 0;
    REP(i, s.size()) {
        if (s[i] == 'A') l = min(l, i);
        if (s[i] == 'Z') r = max(r, i);
    }
    cout << (r-l+1) << endl;
}


Measured memory_bytes: 720
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n, m;
    cin >> n >> m;
    if (m % n == 0)
    {
        cout << m / n << endl;
    }
    else
    {
        int cd = 0;
        repi(i, m / n + 1, 1)
        {
            if (m % i == 0)
            {
                cd = i;
            }
        }
        cout << cd << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define SIZE 6

int bi1[SIZE], bi2[SIZE];
const int disit[SIZE + 1] = {1, 2, 4, 8, 16, 32, 64};

void de_bi1(int de){
  int i;
  for(i = SIZE-1; i >= 0; i--){
    bi1[i] = de / disit[i];
    de %= disit[i];
  }
  return;
}

void de_bi2(int de){
  int i;
  for(i = SIZE-1; i >= 0; i--){
    bi2[i] = de / disit[i];
    de %= disit[i];
  }
  return;
}

int main(void){
  int row, col, n, sum = 0, ans = 0, i, j, k, l;
  char bw[SIZE][SIZE];
  scanf("%d %d %d", &row, &col, &n);
  
  for(i = 0; i < row; i++){
    for(j = 0; j < col; j++){
      scanf(" %c", &bw[i][j]);
    }
  }
  
  for(i = 0; i < disit[row]; i++){
    de_bi1(i);
    for(j = 0; j < disit[col]; j++){
      de_bi2(j);
      for(k = 0; k < row; k++){
        if(bi1[k] == 1){
          for(l = 0; l < col; l++){
            if(bi2[l] == 1){
              if(bw[k][l] == '#')
                sum++;
            }
          }
        }
      }
      if(sum == n)ans++;
      sum = 0;
    }
  }
  
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
bool bs(const vector<int> &a, int target)
{
    int l = 0;
    int r = a.size();
    while (l < r)
    {
        int m = (l + r) / 2;
        if (target == a[m])
            return true;
        if (target < a[m])
            r = m;
        else
            l = m + 1;
    }
    return false;
}
int main()
{
    int n;
    cin >> n;
    vector<int> S(n);
    for (int i = 0; i < n; i++)
    {
        cin >> S[i];
    }
    int c = 0;
    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int t;
        cin >> t;
        c += bs(S, t);
    }
    cout << c << endl;
}


Measured memory_bytes: 3132
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    a, b = rl()
    ab = a*int(b)
    ba = b*int(a)
    ans = sorted([ab, ba])[0]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940