akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <vector>

typedef long long ll;

int main(int argc, char* argv[])
{
  ll N;
  std::cin >> N;

  std::vector< ll > va(N, 0);
  std::vector< ll >::iterator it;

  for (int i = 0; i < N; i++) {
    std::cin >> va[i];
  }

  ll ans = 0;
  for (it = va.begin(); it != va.end(); it++) {
    ans += *it - 1;
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
template <class T> inline bool chmax(T& a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
int main() {
  string S;
  cin >> S;
  vector<ll> nums(S.size() + 1, 0);
  for(int i = 0; i < S.size(); ++i) {
    if(S[i] == '<') {
      chmax(nums[i + 1], nums[i] + 1);
    }
  }

  for(int i = S.size() - 1; i >= 0; --i) {
    if(S[i] == '>') {
      chmax(nums[i], nums[i + 1] + 1);
    }
  }

  ll total = accumulate(nums.begin(), nums.end(), 0LL);
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 4740
//In the name of God
//SMani24
#include<bits/stdc++.h>
using namespace std;
 
const int N = 40;
 
int ans = -1;
int h, w;
int d[N * N];
int add[] = {1, -1, 0};
bool mark[N * N];
queue<int> bfsq;
vector<int> adj[N * N];
string s[N];
 
void bfs(int v) {
	bfsq.push(v);
	while (bfsq.size()) {
		v = bfsq.front();
		ans = max(ans, d[v]);
		bfsq.pop();
		for (int u : adj[v])
			if (mark[u])
				continue;
			else {
				d[u] = d[v] + 1;
				mark[u] = 1;
				bfsq.push(u);
			}
	}
}
bool check(int i, int j) {
	return (i < h && 0 <= i && j < w && 0 <= j);
}
void set_adj() {
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#')
				continue;
			for (int ai : add)
				for (int aj : add) {
					if (ai != 0 && aj != 0)
						continue;
					int hi = i + ai, hj = j + aj;
					if (check(hi, hj)) {
						if (s[hi][hj] == '#')
							continue;
						int v = i * w + j;
						int u = hi * w + hj;
						adj[v].push_back(u);
						adj[u].push_back(v);
					}
				}
		}
}
void vitex() {
	for (int i = 0; i < h * w; i++)
		mark[i] = 0;
}
int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++)
		cin >> s[i];
	set_adj();
	for (int i = 0; i < h * w; i++)
		d[i] = 0, bfs(i), vitex();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
# coding:utf-8

import sys
from bisect import bisect_left

INF = 10 ** 18
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


a, b, q = LI()
A = [-INF] + [II() for _ in range(a)] + [INF]
B = [-INF] + [II() for _ in range(b)] + [INF]

for _ in range(q):
    x = II()
    s = bisect_left(A, x)
    t = bisect_left(B, x)

    res = INF
    for aa in [A[s - 1], A[s]]:
        for bb in [B[t - 1], B[t]]:
            d1 = abs(x - aa) + abs(aa - bb)
            d2 = abs(x - bb) + abs(bb - aa)
            res = min(res, d1, d2)

    print(res)


Measured memory_bytes: 12812
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

template<typename T> string to_string(const T& v) {
  string str;
  for (const auto& i : const_cast<T&>(v)) str += ' ' + to_string(i);
  return str.substr(min(1, int(str.size())));
}

template<> string to_string<string>(const string& v) {return v;}

#ifdef __MINGW32__

template<> string to_string<int>(const int& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<int64_t>(const int64_t& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned int>(const unsigned int& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned int64_t>(const unsigned int64_t& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<float>(const float& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<double>(const double& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long double>(const long double& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

#endif

template<typename T> string join(const T &v, char delim = ' ') {
  string res;
  for (const auto& s : v) res += delim + to_string(s);
  return res.substr(1);
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  deque<int> b;
  cin >> a;
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0) b.emplace_back(a[i]);
    else b.emplace_front(a[i]);
  }
  if (n % 2) reverse(b.begin(), b.end());
  cout << join(b) << endl;
}



Measured memory_bytes: 5892
class BIT: #0-indexed
    __slots__ = ["size", "tree","depth","n0"]
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)
        self.depth = n.bit_length()
        self.n0 = 1<<self.depth

    def get_sum(self, i): #a_0 + ... + a_{i} #閉区間
        s = 0; i += 1
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def range_sum(self,l,r): #a_l + ... + a_r 閉区間
        return self.get_sum(r) - self.get_sum(l-1) 

    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def bisect_left(self,w):
        #和が w 以上になる最小の index
        #w が存在しない場合 self.size を返す
        if w <= 0: return 0
        x,k = 0,self.n0
        for _ in range(self.depth):
            k >>= 1
            if x+k <= self.size and self.tree[x+k] < w:
                w -= self.tree[x+k]
                x += k
        return x
    
###########################################
import sys
readline = sys.stdin.readline

n,q = map(int, readline().split())
*a, = map(int, readline().split())

b = BIT(n)
for i in range(n):
    b.add(i,a[i])

for _ in range(q):
    v,p,x = map(int, readline().split())
    if v==0:
        b.add(p,x)
    else:
        print(b.range_sum(p,x-1))



Measured memory_bytes: 143268
//
//  main.cpp
//  Atcoder1
//
//  Created by Hamske on 2020/09/17.
//  Copyright © 2020 Author. All rights reserved.
//

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;

//#define pb push_back
//#define mp make_pair
//
//#define F first
//#define S second

typedef long long ll;

#define rept(_i,iv,n,type) for(type _i=(type)(iv);_i<(type)(n);++_i)
//#define repi(_i,iv,n) rept(_i,iv,n,int)
//#define repl(_i,iv,n) rept(_i,iv,n,ll)

#define rept0(_i,n,type) rept(_i,0,n,type)
#define repi0(_i,n) rept(_i,0,n,int)
#define repl0(_i,n) rept(_i,0,n,ll)

//#define repst(_i,iv,n,type) for(type _i=iv;_i<=(type)(n);++_i)
//#define repsi1(_i,n) repst(_i,1,n,int)

#define REPT(_i,iv,_l,n,type) for(type _i=(type)(iv),_l=(type)(n);_i<_l;++_i)
//#define REPI(_i,iv,_l,n) REPT(_i,iv,_l,n,int)
//#define REPL(_i,iv,_l,n) REPT(_i,iv,_l,n,ll)
//
#define REPT0(_i,_l,n,type) REPT(_i,0,_l,n,type)
#define REPI0(_i,_l,n) REPT(_i,0,_l,n,int)
#define REPL0(_i,_l,n) REPT(_i,0,_l,n,ll)


//#define rrept(_i,x,e,type) for(type _i=((type)(x)-1);_i>=e;--_i)
//
//#define rrept0(_i,x,type) rrept(_i,x,0,type)
//
//#define RREPT(_i,x,_e,e,type) for(type _i=((type)(x)-1),_e=(type)(e);_i>=_e;--_i)
//
//#define RREPT0(_i,x,_e,type) RREPT(_i,x,_e,0,type)
//
//#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

//#define all(x) (x).begin(),(x).end()
#define REPV(v,_itr,_end) for(auto _itr=(v).begin(),_end=(v).end();_itr!=_end;++_itr)
#define REPVC(v,_itr,_end) for(auto _itr=(v).cbegin(),_end=(v).cend();_itr!=_end;++_itr)

#define td typedef
//#define tds(stl,type,name) typedef stl<type > name;
#define tdv(type,name) typedef vector<type > name;


typedef vector<bool> vb;
typedef vector<vb > vvb;
typedef vector<int> vi;
typedef vector<vi > vvi;
typedef vector<ll> vll;
//typedef vector<vll > vvll;
tdv(string, vs)

int main(int argc, const char * argv[]) {
    int N;
    cin>>N;
    
    vi x(N),y(N),P(N);
    double num=N;
    repi0(i, N){
        if(i!=0){
            num*=i;
        }
        P[i]=i;
        cin>>x[i]>>y[i];
    }
    double sum=0;
    do{
        double len=0;
        repi0(i, N-1){
            int dx=x[P[i]]-x[P[i+1]],dy=y[P[i]]-y[P[i+1]];
            len+=sqrt(dx*dx+dy*dy);
        }
        sum+=len;
    }while (next_permutation(P.begin(), P.end()));
    cout<<fixed<<setprecision(10)<<sum/num<<endl;
    
    return 0;
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  vector<string> S(N);
  vector<int> A(N,0);
  int K=0;
  for(int i=0; i<N; i++){
    cin>>S.at(i);
    A[i]+=(S[i].size()-1);
  }
  for(int i=0; i<N-1; i++){
    if(S[i].at(A[i])!=S[i+1].at(0))
      K++;
    else continue;
  }
  sort(S.begin(),S.end());
  for(int i=0; i<N-1; i++){
    if(S[i]==S[i+1])
      K++;
    else continue;
  }
  if(K==0)
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;
void solve(){
  int x; cin >> x;
  if(x < 1200) cout << "ABC\n";
  else cout << "ARC\n";
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

void solve(){
	int n,d;
	cin >> n >> d;
	int ans = 0;
	while(n--){
		lli x,y;
		cin >> x >> y;
		if(x * x + y * y <= (lli)d * d) ++ans;
	}
	cout << ans << newl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator

#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second

#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));

#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2

#define INF ((1ll<<60)-233)
#define sqr(x) ((x)*(x))
#define debug puts("wzpkking")
using namespace std;

const int mo=1000000007;
const int N=100005;
int a[N],nxt[N][3];
int ans,f[N];
char s[N];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1),fl=0;
	For(i,1,n-1) if (s[i]==s[i+1]) fl=1;
	if (!fl) return puts("1"),0;
	For(i,1,n) a[i]='c'-s[i];
	For(i,1,n+1) a[i]+=a[i-1],a[i]%=3;
	For(i,0,2) nxt[n+1][i]=n+1;
	Rep(i,n,0){
		For(j,0,2) nxt[i][j]=nxt[i+1][j];
		nxt[i][a[i]]=i;
	}
	f[1]=1;
	For(i,1,n+1){
		if (nxt[i][(a[i-1]+1)%3]!=n+1)
			(f[nxt[i][(a[i-1]+1)%3]+1]+=f[i])%=mo;
		if (nxt[i][(a[i-1]+2)%3]!=n+1)
			(f[nxt[i][(a[i-1]+2)%3]+1]+=f[i])%=mo;
		if (a[i-1]==a[n]&&i!=1) (ans+=f[i])%=mo;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 2304
#!/usr/bin/perl

sub main() {
  my $S=<>;
  chomp($S);
  my $T=<>;
  chomp($T);
  my $ans = prob($S,$T);
  print $ans;
}

sub prob() {
  my($S,$T) = @_;
  my @s = split(//, $S);
  my @t = split(//, $T);
  my $ans = 0;
  for my $i(0..2){
    if($s[$i] eq $t[$i]) {
      $ans++;
    }
  }
  return $ans;
}

&main();

Measured memory_bytes: 640
#![allow(unused_imports)]
#![allow(non_snake_case)]

use procon::*;
use std::cmp::{max, min};
use std::collections::*;
use std::ops::*;
use std::*;

pub fn main() {
    let N = read_line().parse::<usize>().unwrap();
    let S = read_line().chars().collect::<Vec<char>>();

    let mut ek = vec![0; N];
    let mut wk = vec![0; N];
    for i in 0..N {
        wk[i] = (if i >= 1 { wk[i - 1] } else { 0 }) + (if S[i] == 'W' { 1 } else { 0 });
    }

    for i in (0..N).rev() {
        ek[i] = (if i + 1 < N { ek[i + 1] } else { 0 }) + (if S[i] == 'E' { 1 } else { 0 });
    }

    let mut m = N;
    for i in 0..N {
        let l = if i >= 1 { wk[i - 1] } else { 0 };
        let r = if i + 1 < N { ek[i + 1] } else { 0 };
        m = min(m, l + r);
    }

    println!("{}", m);

    return;
}

pub mod procon {
    use std;
    use std::collections::*;
    use std::io;
    use std::mem;
    use std::str::FromStr;

    pub fn read_line() -> String {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        buf.trim_right().to_owned()
    }

    pub fn read_words<T>() -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        buf.split_whitespace()
            .map(|word| T::from_str(word).unwrap())
            .collect()
    }

    pub fn read_vec(len: usize) -> Vec<String> {
        let mut vec = Vec::new();
        while vec.len() < len {
            let line = read_line();
            for word in line.split_whitespace() {
                vec.push(word.to_owned());
            }
        }
        assert!(vec.len() == len);
        vec
    }
}


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

using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

/* [💭] [💡] [🎈] */

int parent[100001];

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

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

    vector<vector<int>> graph(n + 1);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        graph[u].emplace_back(v);
        graph[v].emplace_back(u);
    }

    bitset<100001> visit;

    queue<int> q;
    q.emplace(1);
    visit[1] = true;
    while (q.size()) {
        int u = q.front();
        q.pop();
        for (int v:graph[u]) {
            if (visit[v])continue;
            visit[v] = true;
            parent[v] = u;
            q.emplace(v);
        }
    }

    cout << "Yes\n";
    for (int i = 2; i <= n; i++) cout << parent[i] << '\n';

    return 0;
}

Measured memory_bytes: 10200
#include <iostream>
#include <vector>
using namespace std;
void shortest_paths (int cost[10][10]) {
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (cost[i][j] > cost[i][k] + cost[k][j])
					cost[i][j] = cost[i][k] + cost[k][j];
			}
		}
	}
}


int main (void) {
	int h, w; cin >> h >> w;
	int cost[10][10];
	for (int i = 0; i < 10; i++) 
		for (int j = 0;j < 10; j++) 
			cin >> cost[i][j];
	
	int A[h][w];
	
	for (int i = 0; i < h; i++) 
		for (int j = 0;j < w; j++) 
			cin >> A[i][j];
	shortest_paths(cost);

	int sum = 0;
	for (int i = 0; i < h; i++) 
		for (int j = 0;j < w; j++)  {
			if (A[i][j] == -1)
				continue;
			sum += cost[A[i][j]][1];
		}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 512
def resolve():
    '''
    code here
    '''
    from collections import deque

    H, W = [int(item) for item in input().split()]
    Ch, Cw = [int(item)-1 for item in input().split()]
    Dh, Dw = [int(item)-1 for item in input().split()]
    grid = [input() for _ in range(H)]
    max_num = 10**6
    fp = [[max_num] * W for _ in range(H)]

    que = deque([[Ch, Cw, 0]])
    fp[Ch][Cw] = 0

    walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
    warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

    while que:
        y, x, w_num = que.popleft()

        for dy, dx in walk:
            ny = y + dy
            nx = x + dx

            if 0 <= ny <= H-1 and 0 <= nx <= W-1 and grid[ny][nx] == '.' and fp[ny][nx] > w_num:
                que.appendleft([ny, nx, w_num])
                fp[ny][nx] = w_num

        for dy, dx in warp:
            ny = y + dy
            nx = x + dx
            nw = w_num +1

            if 0 <= ny <= H-1 and 0 <= nx <= W-1 and grid[ny][nx] == '.' and fp[ny][nx] > nw:
                que.append([ny, nx, nw])
                fp[ny][nx] = nw

    if fp[Dh][Dw] != max_num:
        print(fp[Dh][Dw])
    else:
        print(-1)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 98008
N, x = map(int, input().split())
*A, = map(int, input().split())
A.sort()
sun = 0
cnt = 0
for a in A:
    if sun + a > x:
        break
    sun += a
    cnt += 1
else:
    if sun < x:
        cnt = max(0, cnt-1)
print(cnt)


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

int main(){
  int n, m;

  while(cin >> n >> m){
    int maxSolvedCount = 0;

    for(int i = 0; i < n; i++){
      int solvedCount = 0;

      for(int j = 0; j < m; j++){
        int solvedFlg = false;
        cin >> solvedFlg;
        solvedCount += solvedFlg;
      }

      maxSolvedCount = max(maxSolvedCount, solvedCount);
    }

    cout << maxSolvedCount << endl;
  }
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int s=0,n,n1;
	scanf("%d",&n1);
	n=n1;
	while(n!=0)
	{
		s+=n%10;
		n/=10;	
	}
	if(n1%s==0)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a: i64 = input();
    let b: i64 = input();
    let c: i64 = input();
    println!("{}", if b - a == c - b { "YES" } else { "NO" });
}


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

using namespace std;

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

	string in;
	cin >> in;
	if(in.find('7') == string::npos)
	{
		cout << "No\n";
	}
	else
	{
		cout << "Yes\n";
	}

	return 0;
}

Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    int d,n;
    cin>>d>>n;
    string s;
    if(n!=100) s+=to_string(n);
    else s+="101";
    rep(i,d){
        s+="00";
    }
    cout<<s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

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


//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}


////////////////////////////////////////////////////////////////////
vector<int> vec[300016]{};
queue<P> que{};
int dp[300016];

void bfs(ll u){
que.push(make_pair(u, 0));
while(que.size()){
	P p=que.front();
	int s=p.first;
	int d=p.second;
	que.pop();
if(dp[s]!=-3){}
else{
	dp[s]=d;
	for(int i=0;i<vec[s].size();i++){
    que.push(make_pair(vec[s][i], d+1));
	}
}

	}

}





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

rep(i,m){
	int p,q;
	cin>>p>>q;
	vec[p].push_back(q+n);
	vec[p+n].push_back(q+n+n);
	vec[p+n+n].push_back(q);
}

int s,g;
cin>>s>>g;

rep(i, 3*n){
	dp[i]=-3;
}



bfs(s);

cout<<dp[g]/3<<"\n";
return 0;


}




Measured memory_bytes: 19840
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;

int main(){
    ll n,m,r; cin>>n>>m>>r;
    vector<ll> v(r);
    REP(i,r)cin>>v[i], v[i]--;
    vector<vector<ll>> g(n,vector<ll> (n, 1e15));
    REP(i,n)g[i][i]=0;
    REP(i,m){
        ll a,b,c; cin>>a>>b>>c;
        a--; b--;
        g[a][b]=c;
        g[b][a]=c;
    }
    REP(k,n)REP(i,n)REP(j,n){
        g[i][j]=min(g[i][j], g[i][k]+g[k][j]);
    }
    ll ans=1e16;
    sort(ALL(v));
    do {
        ll preans=0;
        FOR(i,1,r){
            preans+=g[v[i-1]][v[i]];
        }
        ans=min(preans, ans);
    }while(next_permutation(ALL(v)));
    cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 3900
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL H, W;
	in >> H >> W;
	std::vector<std::string>S(H);
	rep(i, H) in >> S[i];

	std::vector<std::vector<LL>>blockX(W), blockY(H);
	rep(i, H)
	{
		rep(j, W)
		{
			if (S[i][j] == '#')
			{
				blockX[j].push_back(i);
				blockY[i].push_back(j);
			}
		}
	}
	rep(i, W)
	{
		blockX[i].push_back(-1);
		blockX[i].push_back(H);
	}
	rep(i, H)
	{
		blockY[i].push_back(-1);
		blockY[i].push_back(W);
	}
	rep(i, W) std::sort(blockX[i].begin(), blockX[i].end());
	rep(i, H) std::sort(blockY[i].begin(), blockY[i].end());

	LL ans = 0;
	rep(i, H)
	{
		rep(j, W)
		{
			if (S[i][j] == '.')
			{
				auto itX = std::lower_bound(blockX[j].begin(), blockX[j].end(), i);
				auto itY = std::lower_bound(blockY[i].begin(), blockY[i].end(), j);
				LL res = 0;
				if (itX != blockX[j].begin()) res += i - *(itX - 1) - 1;
				if (itX != blockX[j].end()) res += *itX - i - 1;
				if (itY != blockY[i].begin()) res += j - *(itY - 1) - 1;
				if (itY != blockY[i].end()) res += *itY - j - 1;
				res += 1;
				ans = std::max(ans, res);
			}
		}
	}

	out << ans << std::endl;
}


Measured memory_bytes: 71040
#include <bits/stdc++.h>
using namespace std;
string xx[]={"7","5","3"};
int n,ans;
int main(){
	cin >> n;
	set<string> t;
	t.insert("");
	while(1){
		set<string> p;
		if(t.size()==0)break;
		for (auto y:t){
			if(y.size()<9){
				for(auto s:xx){
					string k = y+s;
					if(k.find('7')!=k.find('0'))
					if(k.find('5')!=k.find('0'))
					if(k.find('3')!=k.find('0'))
					if(stoi(y+s)<=n)ans++;
					p.insert(y+s);
				}
			}
		}
		t = p;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n=sc.nextInt();
	    int m=sc.nextInt();
	    int l=sc.nextInt();
	    long A[][]=new long[n][m];
	    long B[][]=new long[m][l];
	    long C[][]=new long[n][l];
	    
	    for(int i=0;i<n;i++){
	        for(int j=0;j<m;j++){
	            A[i][j]=sc.nextInt();
	        }
	    }
	    
	    
	    for(int i=0;i<m;i++){
	        for(int j=0;j<l;j++){
	            B[i][j]=sc.nextInt();
	        }
	    }
	    
	    for(int i=0;i<n;i++){
	        for(int j=0;j<l;j++){
	            for(int k=0;k<m;k++){
	                C[i][j] += A[i][k]*B[k][j];
	            }
	        }
	    }
	    
	    for(int i=0;i<n;i++){
	        for(int j=0;j<l-1;j++){
	            System.out.print(C[i][j]+" ");
	        }
	        System.out.println(C[i][l-1]);
	    }
	    
	    sc.close();
	}
}


Measured memory_bytes: 54616
from collections import defaultdict
N = int(input())
dp = [defaultdict(int) for _ in range(N+1)]
MOD = 10**9 + 7
dp[0]['TTT'] = 1


def ok(last4):
    for i in range(4):
        l = list(last4)
        if i >= 1:
            l[i-1], l[i] = l[i], l[i-1]
        if 'AGC' in ''.join(l):
            return False
    return True


for n in range(N):
    for s, cnt in dp[n].items():
        for c in 'AGCT':
            ns = s+c
            if ok(ns):
                dp[n+1][ns[-3:]] = (dp[n+1][ns[-3:]]+cnt) % MOD

print(sum(dp[N].values()) % MOD)


Measured memory_bytes: 42588
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cerr<<elem;}cerr<<endl;}

int main(){//解説参考. 数列Aの講義単調減少数列の最長を求める.
	int n;
	cin>>n;
	
	vi v;
	REP(i,n){
		int a;
		cin>>a;
		
		auto p=upper_bound(ALL(v),-a);
		if(p==v.end()) v.push_back(-a);
		else *p=-a;
	}
	
	cout<<v.size()<<endl;
}

Measured memory_bytes: 3904
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val S = sc.next()
        var ans = 0
        var n = 0
        for (i in 0 until 3) {
            if (S[i] == 'R') {
                n++
                if (ans < n) ans = n
            } else {
                n = 0
            }
        }
        pw.println(ans)
    }
}


Measured memory_bytes: 36448
class Unionfind():
    def __init__(self,N,weighted=False):
        self.root = list(range(N))
        self.depth = [1 for _ in range(N)]
        self.weighted = False
        if weighted:
            self.weighted = True
            self.weight = [0 for _ in range(N)]
    def find(self,x):
        if self.root[x] == x:
            return x
        else:
            r = self.find(self.root[x])
            if self.weighted:
                self.weight[x] += self.weight[self.root[x]]
            self.root[x] = r
            return r
    def unite(self,a,b,x=0):
        A = self.find(a)
        B = self.find(b)
        if self.weighted:
            wa = self.weight[a]
            wb = self.weight[b]
        if A == B:
            return
        elif self.depth[A] > self.depth[B]:
            self.root[B] = A
            self.depth[A] += self.depth[B]
            if self.weighted:
                self.weight[B] = wa -wb + d
        else:
            self.root[A] = B
            self.depth[B] += self.depth[A]
            if self.weighted:
                self.weight[A] = wb - wa - d
N,M = map(int,input().split())
uf = Unionfind(N)
for _ in range(M):
    x,y,_ = map(int,input().split())
    uf.unite(x-1,y-1)
root_set = set()
for i in range(N):
    root_set.add(uf.find(i))
print(len(root_set))

Measured memory_bytes: 76364
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000
	

int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<int> A(N,0);
	
	for(int i=0;i<N;i++)scanf("%d",&A[i]);
	
	for(int i=0;i<K;i++){
		vector<int> imos(N,0);
		for(int j=0;j<N;j++){
			imos[max(0,j-A[j])]++;
			int t = j+A[j]+1;
			if(t<=N-1)imos[min(N-1,j+A[j]+1)]--;
		}
		for(int j=1;j<N;j++)imos[j] += imos[j-1];
		bool f = true;
		for(int j=0;j<N;j++){
			A[j] = imos[j];
			if(A[j]!=N)f=false;
		}
		if(f)break;
		
	}
	
	for(int i=0;i<N;i++){
		if(i!=0)cout<<' ';
		cout<<A[i];
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 4912
//Link : https://atcoder.jp/contests/arc059/tasks/arc059_d

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 5005
#define mod 1000000007
int dp[N][N];
int add(int x,int y) {
  int ret = x+y;
  if(ret>=mod) {
    return ret-mod;
  } else if(ret<0) {
    return ret + mod;
  }
  return ret;
}

int mul(int x,int y) {
  return (ll)x*y%mod;
}
int mypow(int x,int c) {
  int ret = 1;
  while(c--) {
    ret = mul(ret,x);
  }
  return ret;
}

void solve() {
  int n;string s;
  cin>>n>>s;
  dp[0][0] = 1;
  for(int numChar=1;numChar<=n;++numChar) {
    for(int len=0;len<numChar;++len) {
      dp[numChar][len+1] = add(dp[numChar][len+1],mul(2,dp[numChar-1][len]));
      dp[numChar][max(len-1,0)] = add(dp[numChar][max(len-1,0)], dp[numChar-1][len]);
    }
  }
  int u = mod/2+1;
  printf("%d\n", mul(dp[n][s.size()], mypow(u,s.size())) );
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


Measured memory_bytes: 96384
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}




int main(){
    ll k;
    string s;
    cin>>k>>s;
    
    if(s.size() <= k){
        cout<<s<<endl;
    }
    else{
        string ans = s.substr(0,k);
        ans += "...";
        cout<<ans<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3616
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;

#define INF 1000000000
#define MAX 123456

// sieve of Eratosthenes (prime num)
bool p[MAX*2+1]; //prime number=false
void prime(int n){
  rep(i,n+1) p[i]=false;
  for(int i=2;i<=n;i++){
    if(!p[i]){
      for(int j=i*2; j<=n; j+=i){
	p[j]=true;
      }
    }
  }
}

int main(){
  prime(MAX*2+1);

  while(true){
    int n;
    scanf("%d", &n);
    if(n==0)break;

    int ans=0;
    for(int i=n+1;i<=2*n;i++){
      if(!p[i]) ans++;
    }
    cout << ans << endl;

  }
}

Measured memory_bytes: 1452
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.sql.Array;
import java.util.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }


    static class TaskD {
        public static long gcd(long a , long b){
            if (b == 0) return a;
            return gcd(b , a%b);
        }
        public static long primes(long a){
            long b = a;
            long ans = 0;
            long sq = (long)Math.sqrt(a);
            for (int i = 2; i <=sq ; i++) {
                if (b%i == 0)ans++;
                while (b%i==0){
                    b/=i;
                }
            }
            if (b>2) ans++;
            return ans+1;
        }
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();
            System.out.println(primes(gcd(a,b)));








        }



    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 23252
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,m,x,a[nmax],nr[nmax],tot[nmax],i,ans;
int main()
{
    //freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>m;
    for(i=1;i<=n;i++)cin>>x,nr[x]++,a[x%m]++;
    for(i=1;i<=100000;i++)tot[i%m]+=nr[i]/2;
    ans=a[0]/2;
    if(m%2==0)ans+=a[m/2]/2;
    for(i=1;i<=(m-1)/2;i++)
	{
	   if(a[i]<a[m-i])ans+=min((a[m-i]-a[i])/2,tot[m-i])+a[i];
	   else ans+=min((a[i]-a[m-i])/2,tot[i])+a[m-i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
 
 
int main(){
 
  ios_base :: sync_with_stdio(false);
  cin.tie(NULL);
 
  long long n;
  cin >> n;
  string ans = "";
 
  while(n){
    n--;
    int dig = n%26;
    n /= 26;
    ans += (dig + 'a');
  }
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3672
n, min, max = gets.chomp.split(' ').map(&:to_i)
answer_arry = []

def digit_sum(num)
  sum = 0
  while num > 0 do
    sum += num % 10
    num /= 10
  end
  sum
end

(0..n).each do |num|
  digit_sum = digit_sum(num)
  answer_arry << num if digit_sum >= min && digit_sum <= max
end

p answer_arry.sum


Measured memory_bytes: 14316
import Data.List

main :: IO ()
main = do
    [a,b,c,d] <- map read . words <$> getLine
    putStrLn $ colorfulTransceivers a b c d

colorfulTransceivers :: Int -> Int -> Int -> Int -> String
colorfulTransceivers a b c d = 
    if ( abs(a-c) <= d || abs (a-b) <= d && abs(b-c) <= d)
        then "Yes"
        else "No"
    where

Measured memory_bytes: 508
#include<stdio.h>
 int main(void) {  
int a,b;    
scanf("%d %d",&a,&b);    
if(a<b)  {  
 printf("a < b\n");  }  
if(a>b)  {   
printf("a > b\n");  }  
if(a==b)  {   
printf("a == b\n");  }    
return 0;   
}

Measured memory_bytes: 580
S=input()
L=len(S)
count=0
for i in range(L//2):
	if S[i] == S[-i-1]:
		count+=1
	else:
		print("No")
		exit()

Sa=S[:(L-1)//2]
Sb=S[(L+3)//2-1:(L+1)]
La=len(Sa)
Lb=len(Sb)

for j in range(La//2):
	if Sa[j] == Sa[-j-1]:
		count+=1
	else:
		print("No")
		exit()
        
for k in range(Lb//2):
	if Sb[k] == Sb[-k-1]:
		count+=1
	else:
		print("No")
		exit()
print("Yes")

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define N 200016

int a[N], f[N];

bool check(int n, ll m, ll k)
{
    for (int i = 0; i < n; ++i) {
        ll mx = m/f[i];
        k -= max(a[i]-mx, 0LL);
        retif(k < 0) false;
    }
    return true;
}

int main()
{
    canhazfast();

    int n;
    ll k;
    ll b = 0, e = 2e17;

    cin >> n >> k;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> f[i];
    sort(a, a+n, greater<int>());
    sort(f, f+n);
    while (b < e) {
        ll m = (b+e)/2;
        if (check(n, m, k)) e = m;
        else b = m+1;
    }
    cout << b << '\n';

    return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000


int main(){
  unsigned short *A, *B;
  
  int i, j, k;
  int C[VMAX+1];
  int n;
  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */

	for(i=1;i<=n;i++){
		scanf("%d",&A[i]);
	}
	
	k=A[0];
	
	for(i=1;i<=n;i++){
		if(A[i]>k){
			k=A[i];
		}
	}
	
	for(i=0;i<=k;i++){  //CountingSort start
		C[i]=0;
	}
	
	for(j=1;j<=n;j++){
		C[A[j]]++;
	}
	
	for(i=1;i<=k;i++){
		C[i]=C[i]+C[i-1];
	}
	
	for(j=n;j>=1;j--){
		B[C[A[j]]]=A[j];
		C[A[j]]--;
	}					//CountingSort finish
	
	for(i=1;i<=n;i++){
		printf("%d",B[i]);
		if(i!=n){
			printf(" ");
		}
	}
	
	printf("\n");
	
  return 0;
}




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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()

#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define uint64_t unsigned long long

#define int8_t signed char
#define int16_t signed short
#define int32_t signed int
#define int64_t signed long long

using namespace std;

int main(int argc, char const* argv[])
{
    int N = 0;
    cin >> N;
    vector<int> h;
    int h_tmp = 0;
    while (cin >> h_tmp) {
        h.push_back(h_tmp);
    }
//  REP(i, N) {cout << h[i] << endl;}

    int dp[N] = {};
    REP(i, N) {dp[i] = INT_MAX;}
//	REP(i, N) {cout << dp[i] << endl;}
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        if (i - 1 >= 0) {
            dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        }
        if (i - 2 >= 0) {
            dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}



Measured memory_bytes: 1144
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        // 整数の入力
        // final int a = sc.nextInt();
        // 文字列の入力
        // final String s1 = sc.next();
        int i = sc.nextInt();
        int j = sc.nextInt();
        sc.close();
        System.out.println(i * j);
    }
}

Measured memory_bytes: 35796
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n,m,p;
  std::cin>>n>>m>>p;
  
  struct Edge{ll from,to,cost;};

  std::vector<Edge> check(m),es;

  std::vector<bool> flag1(n,false),flag2(n,false);

  std::vector<ll> d(n);

  rep(i,0,m){
    ll a,b,c;
    std::cin>>a>>b>>c;
    a--;b--;
    check[i]=Edge{a,b,p-c};
  } 

  std::queue<ll> point;
  point.push(0);
  flag1[0]=true;

  while(point.size()){
    ll now=point.front();point.pop();
    rep(i,0,m){
      if(check[i].from==now&&!flag1[check[i].to]){
        point.push(check[i].to);
        flag1[check[i].to]=true;
      }
    }
  }

  point.push(n-1);
  flag2[n-1]=true;

  while(point.size()){
    ll now=point.front();point.pop();
    rep(i,0,m){
      if(check[i].to==now&&!flag2[check[i].from]){
        point.push(check[i].from);
        flag2[check[i].from]=true;
      }
    }
  }

  rep(i,0,n){
    flag1[i]=(flag1[i]&flag2[i]);
  }

  rep(i,0,m){
    Edge e=check[i];
    if(flag1[e.from]&&flag1[e.to])es.push_back(e);
  }

  m=es.size();

  rep(i,0,n)d[i]=LLONG_MAX;

  ll ans=0;

  d[0]=0;
  ll count=0;
  ll temp=0;
  while(1){
    count++;
    bool update=false;
    rep(i,0,m){
      Edge e=es[i];
      if(d[e.from]!= LLONG_MAX&&d[e.to]>d[e.from]+e.cost){
        d[e.to]=d[e.from]+e.cost;
        update=true;
      }
    }

    if(!update){
      break;
    }else if(count>=n){
      ans=-1;
      break;
    }
  }

  if(ans!=-1){
    std::cout<<std::max((ll)0,-d[n-1]);
  }else{
    std::cout<<-1;
  }

  return 0;
}


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

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

using namespace std;

int L,N,x[100],w[100];

int main() {
  cin >> L >> N;
  int l = 0, r = 0;
  rep(i,N) {
    cin >> x[i] >> w[i];
    if( x[i] == 0 ) continue;
    if( x[i] < 0 ) l += w[i] * (int)abs(x[i]);
    else           r += w[i] * x[i];
  }
  if( l == r ) {
    puts("0");
  } else if( l < r ) {
    int diff = r - l;
    cout << diff << endl;
    rep(i,diff) puts("-1 1");
  } else {
    int diff = l - r;
    cout << diff << endl;
    rep(i,diff) puts("1 1");
  }

  return 0;
}

Measured memory_bytes: 3068
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b;
	cin>>a>>b;
	cout<<max(0,a-b)<<endl;
}








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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; string s; cin>>n>>s;
	int ret=0;
	for (const char &ch : s)
		if(ch=='R') ret++;
		else ret--;
	cout<<(ret>0?"Yes":"No")<<"\n";
	return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == 5 || a == 7 || b == 5 || b == 7 || c == 5 || c == 7) {
    if (a + b + c == 17)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  } else {
    cout << "cNO" << endl;
  }
}


Measured memory_bytes: 256