akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ABC095D
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            cin = new Scanner();
            int N = cin.nextInt();
            long C = cin.nextLong();
            long[] X = new long[N];
            int[] V = new int[N];
            for (int i = 0; i < N; i++)
            {
                X[i] = cin.nextLong();
                V[i] = cin.nextInt();
            }
            long[] sum = new long[N + 1], sum0 = new long[N + 1], sum2 = new long[N + 1], sumr = new long[N + 1], sumr0 = new long[N + 1], sumr2 = new long[N + 1], max = new long[N + 1], maxr = new long[N + 1], max2 = new long[N + 1], maxr2 = new long[N + 1];
            for (int i = 0; i < N; i++)
            {
                sum0[i+1] = sum0[i] + V[i % N];
                sum[i + 1] = sum0[i + 1] - X[i];
                sum2[i + 1] = sum[i + 1] - X[i];
                sumr0[i + 1] = sumr0[i] + V[N - i - 1];
                sumr[i + 1] = sumr0[i + 1] - C + X[N - i - 1];
                sumr2[i + 1] = sumr[i + 1] - C + X[N - i - 1];
                max[i + 1] = Math.Max(max[i], sum[i + 1]);
                maxr[i + 1] = Math.Max(maxr[i], sumr[i + 1]);
                max2[i + 1] = Math.Max(max2[i], sum2[i + 1]);
                maxr2[i + 1] = Math.Max(maxr2[i], sumr2[i + 1]);
            }
            long ans = 0;
            for (int i = 0; i <= N; i++)
            {
                ans = Math.Max(ans, Math.Max(max[i] + maxr2[N - i], maxr[i] + max2[N - i]));
            }
            Console.WriteLine($"{ans}");
        }
        static Scanner cin;
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }
    }
}

Measured memory_bytes: 26188
#include <bits/stdc++.h>
#define lli long long int
#define inf 2147483647
#define infll LLONG_MAX
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
module mod_que
    type queue
        integer,pointer:: v(:)
        integer(4):: i=0
    end type
contains
    subroutine que_init(q)
        type(queue):: q
        allocate(q%v(1))
    end subroutine

    subroutine que(q,num)
        type(queue):: q
        integer(4):: num

        q%i=q%i+1
        if (q%i > size(q%v)) call add(q)
        q%v(q%i) = num
    end subroutine

    subroutine add(q)
        type(queue):: q
        integer(4),pointer:: tmp(:)
        integer(4):: l

        l = size(q%v)
        allocate(tmp(l))
        tmp(1:l) = q%v(1:l)
        deallocate(q%v)
        allocate(q%v(2*l))
        q%v(1:l) = tmp(1:l)
        deallocate(tmp)
    end subroutine

    function deque(q) result(ret)
        type(queue):: q
        integer(4):: ret

        ret = q%v(1)
        q%i=q%i-1
        q%v(1:q%i) = q%v(2:q%i+1)
    end function
end module mod_que


program name
    use mod_que
    implicit none
    integer(4):: h,w
    integer(4),allocatable:: dtc(:,:)
    integer(4):: i,j, nx,ny, dx,dy
    integer(4):: black_num
    character(1),allocatable:: c(:,:)
    character(:),allocatable:: inpt_c
    type(queue):: x,y
    call que_init(x)
    call que_init(y)
    read*, h,w

    allocate(dtc(w,h), c(0:w+1,0:h+1))
    allocate(character(w):: inpt_c)
    black_num = 0
    do i=1,h
        read*, inpt_c(:)
        do j=1,w
            c(j,i) = inpt_c(j:j)
            if (c(j,i) == '#') black_num=black_num+1
        end do
    end do

    c(:,0) = '#'
    c(:,h+1) = '#'
    c(0,:) = '#'
    c(w+1,:) = '#'

    call que(x,1)
    call que(y,1)
    dtc(:,:) = -1
    dtc(1,1) = 1

    do while(x%i > 0)
        nx = deque(x)
        ny = deque(y)
        do dx=-1,1
            do dy=-1,1
                if (abs(dx) == abs(dy)) cycle
                if (c(nx+dx,ny+dy) == '#') cycle
                if (dtc(nx+dx, ny+dy) == -1) then
                    call que(x,nx+dx)
                    call que(y,ny+dy)
                    dtc(nx+dx,ny+dy) = dtc(nx,ny)+1
                else if (dtc(nx+dx,ny+dy) > dtc(nx,ny)+1) then
                    call que(x,nx+dx)
                    call que(y,ny+dy)
                    dtc(nx+dx,ny+dy) = dtc(nx,ny)+1
                end if
            end do
        end do
    end do

    if (dtc(w,h) == -1) then
        print*, -1
    else
        print*, w*h - dtc(w,h) - black_num
    end if
end program name

Measured memory_bytes: 384
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 2e5+9;
// const ll m = 1e9 + 7;
// const ll inf= 1e14;
const ll mod =163577857;
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main()
{   
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif     
    ll T= 1;
    // cin >> T;
    while(T--){
        ll n;cin>>n;
        ll a[n];
        map<ll,ll> ind;
        for(int i = 0;i<n;i++){
            cin>>a[i];
            ind[a[i]] = i;
        }
        sort(a,a+n);
        ll ans =0 ;
        for(int i =0 ;i<n;i++){
            ll in = ind[a[i]];
            if(i%2!= in%2){
                ans++;
            }
        }
        cout<<ans/2<<'\n';
    }
   
}   

Measured memory_bytes: 10672
#include <iostream>
#include <string>

using namespace std;

int main(void){
  int n;

  while(cin >> n && n){
    int l;
    int pos=0;
    int cnt=0;
    int ret=0;
    string str;
    cin >> l;
    cin >> str;
    while(pos < l-2){
      if(str[pos] == 'O'){
	pos++;
      }else{
	if(str[pos+1] == 'O' && str[pos+2] == 'I'){
	  pos += 2;
	  cnt++;
	}else{
	  if(cnt > 0){
	    if(cnt >= n){
	      ret += cnt-n+1;
	    }
	  }
	  cnt = 0;
	  pos++;
	}
      }
    }
    if(cnt > 0){
      if(cnt >= n){
	ret += cnt-n+1;
      }
    }
    cout << ret << endl;
  }
}

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

#define MAX 25
#define NIL -1

struct node{
  int parent, left, right;
};

node T[MAX];
int  n, D[MAX], H[MAX];

void insert(){
  int i;
  
  for(i=0; i<n; i++) T[i].parent=T[i].left=T[i].right=NIL;

  for(i=0; i<n; i++){
    int id;
    scanf("%d", &id);
    scanf("%d %d", &T[id].left, &T[id].right);

    T[T[id].right].parent=T[T[id].left].parent=id;
  }
}

void Preorder(int i){
  printf(" %d", i);
  if(T[i].left != NIL) Preorder(T[i].left);
  if(T[i].right != NIL) Preorder(T[i].right);
}

void Inorder(int i){
  if(T[i].left != NIL) Inorder(T[i].left);
  printf(" %d", i);
  if(T[i].right != NIL) Inorder(T[i].right);
}

void Postorder(int i){
  if(T[i].left != NIL) Postorder(T[i].left);
  if(T[i].right != NIL) Postorder(T[i].right);
  printf(" %d", i);
}

int main(void){
  int i, root;
  
  scanf("%d", &n);
  insert();
  for(i=0; i<n; i++){
    if(T[i].parent == NIL){
      root=i;
      break;
    }
  }

  printf("Preorder\n");
  Preorder(root);
  printf("\nInorder\n");
  Inorder(root);
  printf("\nPostorder\n");
  Postorder(root);
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 3228
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {

    	Scanner s = new Scanner(System.in);
    	int n = s.nextInt(), m = s.nextInt();
    	int r = n * (n - 1) /2 + m * (m - 1) /2;
    	System.out.println(r);
    	}
    

    }


Measured memory_bytes: 23764
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n;i>s;i--)
#define repe_r(i,s,n)for(ll i=n;i>=s;i--)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 62;

int main() {
	ll n; cin >> n;
	if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	ll k = 0;
	ll m = 0;
	repe(i, 1, n / 2 + 1) {
		ll sum = i * (i + 1) / 2;
		if (n <= sum) {
			k = sum - n;
			m = i;
			break;
		}
	}
	repe(i, 1, m) {
		if (i != k) {
			cout << i << endl;
		}
	}

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<ll> A(N), B(N), C(N);
    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; i++) {
        cin >> C[i];
    }

    sort(A.begin(), A.end());
    sort(C.begin(), C.end());
    ll ans = 0;
    for(int  i = 0; i < N; i++) {
        auto Iter1 = lower_bound(A.begin(), A.end(), B[i]);
        
        auto Iter2 = upper_bound(C.begin(), C.end(), B[i]);
        ans += (C.end() - Iter2) * (Iter1 - A.begin());
        
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5640
N = int(input())
Alist = list(map(int,input().split()))
p = [0 for i in range(N)]
for i in range(len(Alist)):
    p[Alist[i]-1] = p[Alist[i]-1] + 1
q = 0
for i in range(len(p)):
    q = q + p[i]*(p[i]-1)/2
for i in range(N):
    print(int(q-p[Alist[i]-1]+1))

Measured memory_bytes: 26268
#include<bits/stdc++.h>
using ll= long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int N;
	cin>>N;
	ll ans;
	cin>>ans;
	REP(i,N-1){
		ll t; cin>>t;
		ans=lcm(ans,t);
	}
	cout<<ans<<endl;

	



	

		return 0;
}


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

using namespace std;

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

    if ( N % 10 == 2 ||
         N % 10 == 4 ||
         N % 10 == 5 ||
         N % 10 == 7 ||
         N % 10 == 9 )
        cout << "hon" << endl;
    if ( N % 10 == 0 ||
         N % 10 == 1 ||
         N % 10 == 6 ||
         N % 10 == 8 )
        cout << "pon" << endl;
    if ( N % 10 == 3 )
        cout << "bon" << endl;

    return 0;
}


Measured memory_bytes: 3620
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char
import Data.Array.IO

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete



main = do
    arr <- newArray (1, 100) 0 :: IO (IOUArray Int Int)
    map readInt . lines <$> getContents >>= mapM_ (\a -> (+1) <$> readArray arr a >>= writeArray arr a)
    list <- getAssocs arr
    let maxv = maximum $ map snd list
    mapM_ print $ map fst $ filter ((==maxv) . snd) list
    return ()

Measured memory_bytes: 4060
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	string S;
	int N;
	cin >> S;
	N = S.length();
	
	string T = S;
	int g = 0;
	int p = 0;
	int maxdiff = 0;
	int lastp = -1;
	for(int i=0;i<N;i++){
		if(S[i] == 'g') g++;
		if(S[i] == 'p'){
			p++;
			lastp = i;
			maxdiff = g - p;
		}
	}
	
	int w = maxdiff / 2;
	int rest = N - 1 - lastp + maxdiff % 2;
	w += (rest / 2);
	
	cout << w << endl;
	
	
	
	
    return 0;
}

Measured memory_bytes: 512
n = gets.chomp.to_i

suits = "SHCD"
lost_cards = Array.new(4){Array.new(13, true)}
n.times{
    suit, rank = gets.chomp.split
    lost_cards[suits.index(suit)][rank.to_i - 1] = false
}

(0..3).each{|suit_no|
    (0..12).each{|rank|
        puts "#{suits[suit_no]} #{rank + 1}" if lost_cards[suit_no][rank]
    }
}

Measured memory_bytes: 8712
#pragma GCC optimize "03"
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N];
vector<int> g[N];

void dfs(int u, int p){
	for(auto i: g[u]){
		if(i == p)	continue;
		a[i] += a[u];
		dfs(i, u);
	}
}

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	IOS;
	int n, q;	cin >> n >> q;
	for(int i = 1; i <= n-1; i++){
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}	
	while(q--){
		int p, x;
		cin >> p >> x;
		a[p] += x;
	}
	dfs(1, 0);
	for(int i = 1; i <= n; i++)
		cout << a[i] << " ";
	return 0;
}

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

using namespace std;

int main()
{
    string n;
    cin >> n;
    int sum = 0;
    for(char ch : n){
        int num = ch - '0';
        sum += num;
    }
    if(sum % 9 == 0)
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 3700
H, W, A, B = map(int, open(0).read().split())
MOD = 10**9+7
 
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
 
for i in range(H + W):
    factorials[i+1] = factorials[i] * (i + 1) % MOD

for i in range(H + W):
    inv_factorials[i+1] = inv_factorials[i] * pow(i + 1, MOD - 2, MOD) % MOD

def modcomb(m, n, mod):
    return factorials[m] * inv_factorials[n] % MOD * inv_factorials[m - n] % MOD
 
# total = modcomb(H + W - 2, W - 1, MOD)
total = 0
 
# for i in range(B):
for i in range(B, W):
    total += modcomb(H - A - 1 + i, i, MOD) * modcomb(A - 1 + W - 1 - i, W - 1 - i, MOD) % MOD
    total %= MOD

print(total)

Measured memory_bytes: 73692
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Closeable;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HBonsai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AEatingSymbolsEasy solver = new AEatingSymbolsEasy();
        solver.solve(1, in, out);
        out.close();
    }

    static class AEatingSymbolsEasy {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();
            int ans = 0;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == '+') ans++;
                else ans--;
            }
            out.println(ans);
        }

    }

    static class FastScanner implements Closeable {
        private final InputStream in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public void close() {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}



Measured memory_bytes: 23380
#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main(){
    ll A,B;
    ll a,b;
    ll t1,t2;
    while( cin>>a>>b ){
        A=a;B=b;
        if(a<b)swap(a,b);
        while(1){
            t1=b;
            t2=a%b;
            a=t1,b=t2;
            if(b==0){
                cout<<a<<" "<<A*B/a<<endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 1156
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d, x1=0, x2=0;
    cin>>a>>b>>c>>d;
    while(99==99)
    {
        if(c>0)
        {
            c-=b;
        }
        else
        {
            x1=1;
            break;
        }
        if(a>0)
        {
            a-=d;
        }
        else
        {
            x2=1;
            break;
        }
    }
    if(x1==1&&x2==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3504
use proconio::{input,fastout};

fn f(x: usize, y: usize, z: usize) -> usize {
    x*x + y*y + z*z + x*y + y*z + z*x
}

#[fastout]
fn main() {
    input! {
        n: usize
    }
    let mut v = vec![0; n];
    for i in 1..n {
        if i*i > n { break; }
        for j in 1..n {
            if j*j > n { break; }
            for k in 1..n {
                if k*k > n { break; }
                let m = f(i,j,k);
                if m <= n { v[m-1] += 1; }
                else { break; }
            }
        }
    }
    for &x in &v { println!("{}", x) }
}


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

int main() {
	long double a,b,c;
	string result;
	cin >> a >> b >> c;
	if ( 4*a*b < pow(c - a - b,2) && c-a-b > 0) {
		result="Yes";
	}
	else {
		result="No";
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	int t;
  cin>>t;
  if(t>=30)
  {
    cout<<"Yes";
}
  else
  {
    cout<<"No";
  }
}


Measured memory_bytes: 3628
def chmin(a,b):
    if a>b:
        a=b
        return a
    else:
        return a


N=int(input())
H=list(map(int,input().split()))
dp=[1000000000]*N
dp[0]=0
for i in range(1,N):
    dp[i]=chmin(dp[i],dp[i-1]+abs(H[i]-H[i-1]))
    
    if i>1:
        dp[i]=chmin(dp[i],dp[i-2]+abs(H[i]-H[i-2]))
print(dp[i])

Measured memory_bytes: 13976
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int count[] = new int[N];
    boolean flag[] = new boolean[N];
    for (int i = 0; i < N; i++) {
      count[i] = i + 1;
      flag[i] = false;
    }
    
    int sumElement = 0;
    
    for (int i = 0; i < N; i++) {
      int ai = Integer.parseInt(sc.next());
      if (ai <= N && !flag[ai - 1]) {
        count[ai - 1]--;
        if (count[ai - 1] == 0) {
          flag[ai - 1] = true;
          sumElement += ai;
        }
      }
    }
    System.out.println(N - sumElement);
    
  }
}

Measured memory_bytes: 48240
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int ret = 700;
    for(size_t i = 0; i < 3; i++)
    {
        if(s[i]=='o')
            ret += 100;
    }
    cout << ret << endl;
    
 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i, x, n) for(int i = (x);i < (n);i ++)
#define reps(i, x, n) for(int i = (x);i <= (n);i ++)
#define lol long long
#define SUM(n) (((n)+1)*(n)/2) //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) ((a+b-1)/b) //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

//最大公約数
lol gcd(lol x, lol y){ return (y != 0 ? gcd(y, x % y) : x); }
//最小公倍数
lol lcm(lol x, lol y){ return ((x * y) / gcd(max(x, y), min(x, y))); }

int c[15][15], memo;
vector<int> cost(15, INF);

void DFS(int now, int sum, int bit){
  if(now == 1){
    cost[memo] = min(sum, cost[memo]);
    return;
  } else {
    reps(i, 0, 9){
      if(!(bit & (1 << i))){
	DFS(i, sum + c[now][i], bit | (1 << i));
      }
    }
    return;
  }
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  int a[205][205];
  reps(i, 0, 9){
    reps(j, 0, 9){
      cin >> c[i][j];
    }
  }
  reps(i, 0, 9){
    memo = i;
    DFS(i, 0, (1 << i));
  }
  lol ans = 0;
  reps(i, 1, h){
    reps(j, 1, w){
      cin >> a[i][j];
      if(a[i][j] != -1){
	ans += cost[a[i][j]];
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3796
n = int(input())
s = [list(input()) for _ in range(n)]

from collections import Counter
ans = Counter(s[0])

for i in range(1,n):
    can = Counter(s[i])
    for j in ans.keys():
        ans[j]= min(ans[j],can[j])

ans = sorted(ans.items(),key=lambda x:x[0])

ls = []
for i in range(len(ans)):
    if ans[i][1]!=0:
        l = [ans[i][0] for _ in range(ans[i][1])]
        ls += l

print("".join(ls))

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

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<vector<int> > a(n,vector<int>(3));
	vector<vector<int> > dp(n,vector<int>(3));
	for(int i = 0; i < n; i++){
		cin >> a[i][0] >> a[i][1] >> a[i][2];
		if(i==0) dp[i] = a[i]; 
	}
	for(int i = 1; i < n; i++){
		dp[i][0] = max(dp[i-1][1],dp[i-1][2])+ a[i][0];
		dp[i][1] = max(dp[i-1][0],dp[i-1][2])+ a[i][1];
		dp[i][2] = max(dp[i-1][0],dp[i-1][1])+ a[i][2];
		
	}
	int ans = *max_element(dp[n-1].begin(),dp[n-1].end());
	cout << ans << endl;
	return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)

struct Edge {
    int src, dst, capacity;
    Edge(int src, int dst, int capacity): src(src), dst(dst), capacity(capacity) {}
};
using Vertex = vector<Edge>;
using Graph = vector<Vertex>;

void add_edge(Graph& graph, int src, int dst, int capacity) {
    graph[src].emplace_back(src, dst, capacity);
    graph[dst].emplace_back(dst, src, 0);
}

int edmonds_karp(Graph& graph, int source, int sink) {
    vector<vector<int>> flow(graph.size(), vector<int>(graph.size()));
    Edge dummy(-1, -1, -1);
    int total = 0;
    for (;;) {
        // find path
        queue<int> Q; Q.push(source);
        vector<Edge*> prev(graph.size()); prev[source] = &dummy;
        while (!Q.empty() && prev[sink] == nullptr) {
            int u = Q.front(); Q.pop();
            for (auto& e : graph[u]) {
                if (prev[e.dst] == nullptr && e.capacity - flow[e.src][e.dst] > 0) {
                    prev[e.dst] = &e;
                    Q.push(e.dst);
                }
            }
        }
        if (prev[sink] == nullptr) return total;

        // augment flow
        int f = INT_MAX;
        for (int u = sink; prev[u] != &dummy; u = prev[u]->src) {
            Edge* e = prev[u];
            f = min(f, e->capacity - flow[e->src][e->dst]);
        }
        for (int u = sink; prev[u] != &dummy; u = prev[u]->src) {
            Edge* e = prev[u];
            flow[e->src][e->dst] += f;
            flow[e->dst][e->src] -= f;
        }
        total += f;
    }
}

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

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

    int m, n;
    while (cin>>m>>n, m|n) {
        vector<int> blue(m), red(n);
        REP(i, m) cin >> blue[i];
        REP(i, n) cin >> red[i];

        Graph graph(m+n+2);
        REP(i, m) REP(j, n) {
            if (gcd(blue[i], red[j]) > 1)
                add_edge(graph, i, m+j, 1);
        }
        REP(i, m) add_edge(graph, m+n, i, 1);
        REP(j, n) add_edge(graph, m+j, m+n+1, 1);

        cout << edmonds_karp(graph, m+n, m+n+1) << '\n';
    }
}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=int(a);i<int(b);++i)
#define RFOR(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)

int main() {
    int a,b,N;
    string h,t;
    cin >> N;
    a = b = 0;
    REP(i,N) {
        cin >> h >> t;
        if (h==t) ++a,++b;
        else if (h>t) a+=3;
        else b+=3;
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 3176
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=list(map(int,input().split()))
K=sum(A)/n
ans=(inf,0)
for i ,ai in enumerate(A):
    if ans[0]>abs(K-ai):
        ans=(abs(K-ai),i)
print(ans[1])

Measured memory_bytes: 38256
#include<iostream>
int main() {
	int a, b;
	std::cin >> a >> b;
	if (a < b) {
		std::cout << "a < b" << std::endl;
	}
	else if (a > b) {
		std::cout << "a > b" << std::endl;
	}
	else {
		std::cout << "a == b" << std::endl;
	}
}

Measured memory_bytes: 1156
import math
a,b = map(int,input().split())
i = 0
ans = []
while i<=1000:
    i += 1
    if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
        ans.append(i)
    if ans == []:
        ans.append(-1)

#print(ans)
if len(ans)==1:
    print(-1)
else:
    ans.remove(-1)
    print(min(ans))

Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int N,K;
  cin>>N>>K;
  if(N>=2*K-1) cout<<"YES";
  else cout<<"NO";
return 0;}


Measured memory_bytes: 3616
import math

X = int(input())

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

l = callIsPrime(100004)

for i in range(len(l)):
    if l[i] >= X:
        print(l[i])
        break

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
    string s;
    cin >> s;

    cout << ((s > "2019/04/30") ? "TBD" : "Heisei") << '\n';
    return 0;
}


Measured memory_bytes: 3628
n,d = gets.chomp.split(" ").map(&:to_i);
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_f)
end

answer = 0
for i in 0..(lines.length - 1) do
	if (lines[i][0] * lines[i][0] + lines[i][1] * lines[i][1])** 0.5 <= d then
		answer += 1
	end
end
puts answer


Measured memory_bytes: 29496
#include<iostream>
#include<string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <cstdlib>
using namespace std;
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}

int main() {
	vector<vector<int> > M(100,vector<int>(100,0));
	int N, U, K, V;
	cin >> N;
	int i, j;
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			M.at(i).at(j)=0;
		}
	}
	for (i = 0; i < N; i++) {
		cin >> U >> K;
		U--;
		for (j = 0; j < K; j++) {
			cin >> V;
			V--;
			M.at(U).at(V) = 1;
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			if (j) {
				cout << " ";
			}
			cout << M.at(i).at(j);
		}
		cout << endl;
	}
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int h, w;
  cin >> h >> w;

  int c[10][10];
  rep (i, 10) rep (j, 10) cin >> c[i][j];

  rep (k, 10) rep (i, 10) rep (j, 10) c[i][j] = min(c[i][j], c[i][k] + c[k][j]);

  int ans = 0;
  rep (i, h) rep (j, w) {
    int a;
    cin >> a;
    if (a != -1) ans += c[a][1];
  }

  cout << ans << endl;
}


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

using namespace std;

const int INF = 1e9 + 5;

int main(){
 	
  	int n;
  	
  	cin >> n;
  	
  	vector<int>h(n);
  
  	for(int i = 0; i < n; i++){
      	
      	cin >> h[i];
    }
  	vector<int>dp(n, INF);
  	
  	dp[0] = 0;
  	
  	for(int i = 0; i < n; i++){
      	
      	for(int j : {i + 1, i + 2}){
          
          	if(j < n){
              
              	dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }
    }
  	cout << dp[n - 1];
  
  	return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;

    if (8 < a || 8 < b) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int r; cin >> r;
  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}

Measured memory_bytes: 3552
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t N, M;

	scanf("%zu %zu", &N, &M);

	size_t commonDivisor = M / N;

	while (1 <= commonDivisor) {
		if (M%commonDivisor == 0) {
			break;
		}

		commonDivisor--;
	}

	printf("%zu\n", commonDivisor);

	return 0;
}


Measured memory_bytes: 128
//This disgusting code is wriiten by Juruo D0zingbear
//Please don't hack me! 0v0 <3
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}

// cf IO: I64d
// atcoder IO: £ì£ì£ä
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int Maxn=11;
int a[Maxn];
int b[Maxn];
int cnt;
int n;
void go(int lvl){
	if (lvl==n+1){
		bool flag=false;
		for (int i=1;i<=n;i++){
			if (b[i]%2==0) flag=true;
		}
		if (flag) cnt++; 
		return;
	}
	int i=lvl;
	b[i]=a[i]-1;
	go(lvl+1);
	b[i]=a[i];
	go(lvl+1);
	b[i]=a[i]+1;
	go(lvl+1);
}
int main(){

	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	} 
	go(1);
	printf("%d\n",cnt);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
//typedef __int128_t Int;
#define DBG 1
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define loop(n) rep(loop,(0),(n))
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
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; }

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(12);

  int D, N; cin >> D >> N;
  if(N==100)N++;

  cout<<(int)pow(100,D)*N<<endl;


    return 0;
}


Measured memory_bytes: 384
from numpy import*
N,M,*U= map(int,open(0).read().split())
T=array(U[N:])
p=ones(M+1)
for s in U[:N]:p[1:]=((p[:-1]*(s==T)).cumsum()+p[1:])%(10**9+7)
print(int(p[-1]))

Measured memory_bytes: 27560
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< pii > B(N);
	rep(i, N) cin >> B[i].second >> B[i].first;
	sort(B.begin(), B.end());
	string ans = "Yes";
	int t = 0;
	rep(i, N) {
		t += B[i].second;
		if (t > B[i].first) {
			ans = "No";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define int long long

void solve() {
    int n, k;
    cin >> n >> k;
    cout << min(n % k, (k - n % k));
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
typedef long long LL;

const int N=110;
const int K=1e5+10;
const LL M=1e9+7;
LL DP[N][K];
int T[N];
int n,k;

int min(int x, int y){return(y<x ? y : x);}

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&T[i]);
    }
    DP[0][0]=1;
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<=k; j++)
        {
            int c=min(T[i],j);
            if(j-1>=0)DP[i][j]=DP[i][j-1];
            DP[i][j]=(DP[i][j]+DP[i-1][j])%M;
            if(j-c-1>=0)DP[i][j]=(DP[i][j]-DP[i-1][j-c-1]+M)%M;
        }
    }
    printf("%lld",DP[n][k]%M);

    return 0;
}


Measured memory_bytes: 79232
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int sum(int n) {
  string s = to_string(n);
  int sum = 0;
  rep(i, s.size()) {
    sum += s[i] - '0';
  }
  return sum;
}

int main() {
  int n;
  cin >> n;
  
  int ans = 1e6;
  for (int a = 1; a < n; a++) {
    int b = n - a;
    int digits = sum(a) + sum(b);
    ans = min(ans, digits);
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll, ll, ll>>>;

// MOD確認

ll H,W,K;
char field[10][10];

int main(){
   cin >> H >> W >> K;
   rep(i,H) rep(j,W) cin >> field[i][j];
   ll ans = 0;
   rep(i,(1LL<<H)){
      rep(j,(1LL<<W)){
         ll cnt = 0;
         rep(k,H) rep(l,W){
            if(field[k][l] != '#') continue;
            if(!((i >> k) & 1) && !((j >> l) & 1)) cnt++;
         }
         if(cnt == K) ans++;
      }
   }  
   cout << ans << endl;
}

Measured memory_bytes: 3624
s = input()
n = int(input())

for _ in range(n):
    lis = input().split()
    if lis[0] == "replace":
        s = s[:int(lis[1])] + lis[3] + s[int(lis[2])+1:]
    elif lis[0] == "reverse":
        s = s[:int(lis[1])] + s[int(lis[1]):int(lis[2])+1][::-1] + s[int(lis[2])+1:]
    else:
        print(s[int(lis[1]):int(lis[2])+1])


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int dx[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1 };
const int dy[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 };
#define NN 8010000
#define TC int t;cin>>t;for(int T=1;T<=t;T++)
#define mod 1000000007
#define PI acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mem(a,n) memset(a,n,sizeof(a))
void AIA() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
//cout<<fixed<<setprecision(20);
// freopen("stand.in","r",stdin);
// freopen("stand.out","w",stdout);
bool isprime(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0)return 0;
	}
	return (n!=1);
}
ll gcd(ll x, ll y)
{
	return (y == 0 ? x : gcd(y, x % y));
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll rem(int x, int N){
	return (x % N + N) % N;
}
int main()
{
	//cout<<fixed<<setprecision(6);
	AIA();
	int x;
	cin>>x;
	cout<<!x;
	return 0;
}

Measured memory_bytes: 3624