akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>
#include <functional>

using namespace std;


#define int long long 

const int LIM = 2e6 + 7;
const int N = 500;

int pr[LIM];
vector<int> primes;

int lcm(int a, int b) {
    #ifdef LOCAL
    return a / (gcd(a, b)) * b;
    #else
    return a / (__gcd(a, b)) * b;
    #endif
}

void init() {
    fill(pr, pr + LIM, 1);
    for (int i = 2; i < LIM; i++) {
        if (pr[i]) {
            primes.push_back(i);
            for (int j = 2 * i; j < LIM; j += i) {
                pr[j] = 0;
            }
        }
    }
}

int ans[N][N];

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

    init();
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            ans[i][j] = 1;
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i + j) & 1) {
                ans[i][j] *= primes[(i + j) / 2];
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i - j) % 2 != 0) {
                ans[i][j] *= primes[(i - j) + 2 * N];
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i + j) % 2 == 0) {
                if (i > 0) {
                    ans[i][j] = lcm(ans[i][j], ans[i - 1][j]);
                }
                if (j > 0) {
                    ans[i][j] = lcm(ans[i][j], ans[i][j - 1]);
                }
                if (i + 1 < N) {
                    ans[i][j] = lcm(ans[i][j], ans[i + 1][j]);
                }
                if (j + 1 < N) {
                    ans[i][j] = lcm(ans[i][j], ans[i][j + 1]);
                }
                ans[i][j]++;
                // cerr << ans[i][j] << '\n';
            }
        }
    }
    {
        set<int> s;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                s.insert(ans[i][j]);
            }
        }
        assert(s.size() == N * N);
        // cerr << *s.rbegin() << endl;
        assert(*s.rbegin() <= 1e15);
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << ans[i][j] << ' ';
        }
        cout << '\n';
    }
}   


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

int main() {
  int m = 2019;
  string s;
  cin >> s;
  int n = s.size();
  reverse(s.begin(),s.end());
  int x = 1,tot = 0;
  vector<int>cnt(m);
  ll ans = 0;
  rep(i,0,n){
    cnt[tot]++;
    tot += (s[i]-'0')*x;
    tot %= m;
    ans += cnt[tot];
    x = x*10%m;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
//cout<<fixed;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

int main() {
// #ifdef _DEBUG
// 	fast;
// 	freopen("input.txt", "r", stdin);
//     // g++ tmp.c
//     // ./a.out < input.txt > out.txt
// #endif
	
	fast;
	int t;
	cin >> t;
    int k;
    cin>>k;
    int i=0;
    vector<int> v(t); 
	while (i<t) {
		cin>>v[i];
        i++;		
	}
    vector<long long> ans(t,INT_MAX);
    ans[0]=0;
    for(int i=1;i<t;i++){ 
        long long mini=INT_MAX;
        for(int j=i-1;j>=0&&j>=i-k;j--){
            mini=min(abs(v[j]-v[i])+ans[j],mini);
        }
        ans[i]=mini;
    }
    // for(int i=0;i<t;i++){ 
    //     cout<<ans[i]<<" ";
    // }
    cout<<ans[t-1]<<endl;	
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d=5,e=7,f=5;
	cin>>a>>b>>c;
		if(a==e) {e=0; a=0;}
		if(a==d) {d=0; a=0;}
		if(b==e&&b!=0){e=0;b=0;}
		if(b==d&&b!=0){d=0;b=0;}
		if(b==f&&b!=0){f=0;b=0;}
		if(c==d&&c!=0){d=0;c=0;}
		if(c==e&&c!=0){e=0;c=0;}
		if(c==f&&c!=0){f=0;c=0;}
		if(d==0&&e==0&&f==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
		


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>

int main() {
    long long A;
    string B;
    cin >> A >> B;
    long long B100 = (B[0]-'0')*100 + (B[2]-'0')*10 + (B[3]-'0');
    cout << A * B100 / 100 << endl;
}

Measured memory_bytes: 3156
import queue


n, m = map(int, input().split())
to_room = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    to_room[a].append(b)
    to_room[b].append(a)
visited = [False for i in range(n+1)]
visited[0] = True
ans = [0 for i in range(n+1)]

q = queue.Queue()

def putting(t):
    global q
    for i in to_room[t]:
        if visited[i] == False:
            q.put((t, i))
            visited[i] = True

putting(1)
visited[1] == True
while not q.empty():
    prog = q.get()
    ans[prog[1]] = prog[0]
    putting(prog[1])


if all(visited):
    print("Yes")
    for i in range(n+1):
        if not (i == 0 or i == 1):
            print(ans[i])
else:
    print("No")


Measured memory_bytes: 39276
A,B,C,X,Y = map(int,input().split())
ans = float('inf')
for i in range(max(X,Y)+1):
  if X - i > 0 and Y - i > 0:
    price = A * (X - i) + B * (Y - i ) + C * i * 2
  elif X - i <= 0 and Y - i > 0:
    price = B * (Y - i ) + C * i * 2
  elif X - i > 0 and Y - i <= 0:
    price = A * (X - i) + C * i * 2
  else:
    price = C * i * 2
  if ans > price:
    ans = price

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector <int> a1(n+1,0);
    vector <int> a2(n+1,0);
    for(int i = 1; i <= n; i++){
        cin >> a1[i];
        a1[i]+=a1[i-1];
    }
    for(int i = 1; i <= n; i++){
        cin >> a2[i];
        a2[i]+=a2[i-1];
    }
    long ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max((long)a1[i]+a2[n]-a2[i-1],ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0)
		cout << (a + b) / 2 << endl;
	else
		cout << "IMPOSSIBLE" << endl;

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
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);
        AMultiplication1 solver = new AMultiplication1();
        solver.solve(1, in, out);
        out.close();
    }

    static class AMultiplication1 {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            w.println(s.nextInt() * s.nextInt());
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  
  vector<int> ans(3);
  
  ans.at(0) = X*A + Y*B;
  
  if(X >= Y){
    ans.at(1) = 2*X*C;
    ans.at(2) = 2*Y*C + (X-Y)*A;
  }
  else{
    ans.at(1) = 2*Y*C;
    ans.at(2) = 2*X*C + (Y-X)*B;
  }
  
  sort(ans.begin(), ans.end());
  
  cout << ans.at(0) << endl;
}

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

int main() {
  int s;
  cin >> s;
  bool check=false;
  while(!check){
    if(s>4){
      int count = 0;
      for(int i=2;i<sqrt(s);i++){
        if(s%i==0){
          count++;
         }
      }
      if(count==0){
        check=true;
      }
    }else{
      check=true;
    }
    s++;
  }
  
  cout << s-1 << endl;
}



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

int main() {
	ll n;
	cin >> n;
	ll m = n;
	ll ans = 0;
	for (ll i = 2; i *i<= m; i++) {
		if (n % i == 0) {
			int count = 0;
			ll j = i;
			while (n % j == 0) {
				count++;
				n /= j;
				j *= i;
			}
			while (n % i == 0) {
				n /= i;
			}
			ans += count;
		}

	}
	if (n != 1) {
		ans += 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int n,i,j,a,b,c,m,M,r;
int main(){
  cin>>n;
  vector<int> col(8,0);
  for(;i<n;i++){
    cin>>r;
    if(r<400)col[0]++;
    else if(r<800)col[1]++;
    else if(r<1200)col[2]++;
    else if(r<1600)col[3]++;
    else if(r<2000)col[4]++;
    else if(r<2400)col[5]++;
    else if(r<2800)col[6]++;
    else if(r<3200)col[7]++;
    else c++;
  }
  for(i=0;i<8;i++)if(col[i]!=0)m++;
  if(m==0)m=1,M=c;
  else M=m+c;
  cout<<m<<" "<<M;
}

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

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

using lint = long long;
constexpr lint INF = 1LL << 60;

void solve() {
    int n;
    std::cin >> n;

    int m = (n % 2 == 0 ? 1 : 2);

    auto dp = vec(m + 1, vec(n + 2, -INF));
    dp[0][0] = 0;

    for (int i = 0; i <= n; ++i) {
        lint x;
        if (i >= n) {
            x = 0;
        } else {
            std::cin >> x;
        }

        for (int k = 0; k + 1 <= m; ++k) {
            dp[k + 1][i + 1] = std::max(dp[k + 1][i + 1], dp[k][i]);
        }
        if (i == n) break;

        for (int k = 0; k <= m; ++k) {
            dp[k][i + 2] = std::max(dp[k][i + 2], dp[k][i] + x);
        }
    }

    std::cout << dp[m][n + 1] << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 9520
N = gets.to_i
arrA = gets.chomp.split(" ").map(&:to_i);
arrB = gets.chomp.split(" ").map(&:to_i);
arrC = gets.chomp.split(" ").map(&:to_i);

#puts N
#puts arrA
#puts arrB
#puts arrC

arrA.sort!
arrB.sort!
arrC.sort!

res = 0

for i in 0...N do
    
    index1 = arrA.bsearch_index { |x| x >= arrB[i] }
    index2 = arrC.bsearch_index { |x| x > arrB[i] }
    if index1.nil?
        index1 = N
    end
    if index2.nil?
        index2 = N
    end
    res += (index1)*(N - index2)

end

puts res


Measured memory_bytes: 26772
N = int(input())
dic = {}
for i in range(10 ** 5):
    dic[i] = 0
dic[-1] = 0
dic[10 ** 5] = 0

A = list(map(int,input().split()))
for a in A:
    dic[a] += 1
    dic[a-1] += 1
    dic[a+1] += 1

ans = 0
for v in dic.values():
    ans = max(ans, v)
print(ans)

Measured memory_bytes: 23524
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
long long  n,m;
int main() {
	IO
	long long n;
	cin>>n;
	char a[27];
	char c='a';
	for(int i=0;i<26;i++)
    {
        a[i]=c;
        c++;
    }
	string s="";
	while(n!=0)
    {
        n--;
        int d = n%26;
        n/=26;
        s.push_back(a[d]);
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

    static Scanner in = new Scanner(System.in);

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        int t = 0;
        boolean f = true;
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            if(i == 0) t= a[i];
            if(f && t != a[i]) f = false;
        }
        if(f) {
            System.out.println(0);
            return;
        }

        int ans = Integer.MAX_VALUE;
        for(int i = -100; i <= 100; i++) {
            int sum = 0;
            for(int j : a) {
                sum += Math.pow(j - i, 2);
            }
            ans = Math.min(ans, sum);
        }
        System.out.println(ans);
    }

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


Measured memory_bytes: 22996
//---------------------------
// AOJ???????????¬???
// made by Kevin
// 2015/6/19
//---------------------------
 
#include <stdio.h>
 
int main(void)
{
    int in_second;//??\??????????????????S
    int out_hour, out_minute, out_second;//?????????h:m:s
 
    //??\???
    scanf("%d", &in_second);
 
    //?????????????¨????
    out_second = in_second % 60;
    out_minute = (in_second /60) % 60;
    out_hour = (in_second / 60) /60;
 
    //??????
    printf("%d:%d:%d\n", out_hour, out_minute, out_second);
 
    return 0;
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
int a,b,c,ab[30],ac[30][30],e=0;
signed main()
{
	cin>>a>>b>>c;
	rep(i,b){
		cin>>ab[i];
	}
	rep(i,a){
		rep(j,b){
			cin>>ac[i][j];
		}
	}
	rep(i,a){
		int d=0;
		rep(j,b){
			d+=(ab[j]*ac[i][j]);
		}
		if(d+c>0){
			e++;
		}
	}
	cout<<e;
}

Measured memory_bytes: 256
import math

a, b, x = map(int, input().split(' '))

base = a * a * b /2

if int(base) == x:
    print(math.degrees(math.atan(b/a)))
elif base > x:
    ah = 2 * x / (a * b)
    print(math.degrees(math.atan(b/ah)))
else:
    bh = 2 * x / a ** 2 - b
    c = b - bh
    print(math.degrees(math.atan(c/a)))


Measured memory_bytes: 3188
import math
import sys

N = int(input())
ans = N

for k in range(2, int(math.sqrt(N)) + 1):
        if N % k == 0:
            if N//k + k < ans:
                ans = N//k + k
            #print(k-1 + N//k-1)
            #print(k,N/k)
            #sys.exit()
if ans == N:
    print(N-1)
else:
    print(ans-2)

Measured memory_bytes: 3060
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;



public class Main{

        static final Scanner sc=new Scanner(System.in);






        public static void main(String[]args){
                int N=sc.nextInt();
                int x=sc.nextInt();
                int[]a=new int[N];
                for(int i=0;i<N;i++){
                        a[i]=sc.nextInt();
                }
                Arrays.sort(a);
                int sum=0;
                for(int i=0;i<N;i++){
                        if(i==N-1){
                                if(x==a[i]){
                                        sum++;
                                }
                        }
                        else if(x>=a[i]){
                        x-=a[i];
                        sum++;
                }
                        else{
                                break;
                        }
                }
                System.out.println(sum);



                



        }








        
        private static int gcd(int m, int n) {
                if(m < n) return gcd(n, m);
                if(n == 0) return m;
                return gcd(n, m % n);
            }






}


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

int main()
{
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    string ans = "Yay!";
    if (e - a > k)
    {
        ans = ":(";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::cmp;

#[allow(dead_code)]
fn getline() -> Vec<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s.split(' ').map(|x| x.trim().to_string()).collect::<Vec<String>>()
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>(s: &String) -> T {
    s.parse().ok().unwrap()
}

fn main() {
    let _ = getline();
    let aa = getline();
    let mut aa: Vec<i32> = aa.iter().map(get).collect();
    aa.sort();
    let mut k = 0;
    let mut prev = -1;
    for x in aa {
        if x != prev {
            k += 1;
            prev = x;
        }
    }
    if k % 2 == 0 {
        k -= 1;
    }
    println!("{}", k);
}


Measured memory_bytes: 10492
import collections
N = int(input())
s = []
for i in range(N):
    s.append(input())
M = int(input())
t = []
for i in range(M):
    t.append(input())
t = collections.Counter(t)
s = collections.Counter(s)
s = s.most_common()

ans = 0
for i in range(len(s)):
    ans = max(s[i][1] - t[str(s[i][0])], ans)
print(ans)


Measured memory_bytes: 3316
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let mut iter = input.split("\n");

    let (n, m) = {
        let l = iter.next()
            .unwrap()
            .split_whitespace()
            .map(|x| x.parse::<usize>().unwrap())
            .collect::<Vec<_>>();
        (l[0], l[1])
    };

    let list = iter.map(|x| {
        let l = x.split_whitespace()
            .map(|x| x.parse::<usize>().unwrap())
            .collect::<Vec<_>>();
        (l[0] - 1, l[1] - 1)
    }).collect::<Vec<_>>();

    let mut count = 0;
    //一個ずつ外していく
    for i in 0..list.len() {
        let list = {
            //辺削除
            let mut list = list.clone();
            list.remove(i);

            //逆向きの辺を貼る
            list.into_iter()
                .flat_map(|(a, b)| vec![(a, b), (b, a)])
                .collect::<Vec<_>>()
        };

        //検索しやすいような形にする
        let mut nodes = Vec::new();
        for _ in 0..n {
            nodes.push((false, Vec::new()));
        }
        for (a, b) in list {
            nodes[a].1.push(b);
        }

        //連結判定
        fn f(nodes: &mut Vec<(bool, Vec<usize>)>, now: usize) {
            if nodes[now].0 {
                return;
            }
            nodes[now].0 = true;
            for x in nodes[now].1.clone() {
                f(nodes, x);
            }
        }

        f(&mut nodes, 0);

        if !nodes.into_iter().all(|x| x.0) {
            count += 1;
        }
    }

    count.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!(super::run($input.to_string()), $output.to_string());
                }
            )*
        }
    }
}

tests! {
    test1: "7 7
1 3
2 7
3 4
4 5
4 6
5 6
6 7" => "4",
    test2: "3 3
1 2
1 3
2 3" => "0",
test3:"6 5
1 2
2 3
3 4
4 5
5 6"=>"5",
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}


class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int a = tmp[0], b = tmp[1];
        int ans = (a - 1) * (b - 1);
        WriteLine(ans);
    }
}


Measured memory_bytes: 11220
N = int(input())
A = [0] + list(map(int, input().split())) + [0]
S = sum(abs(A[i]-A[i+1]) for i in range(N+1))
for i in range(1, N+1):
  print(S-(abs(A[i]-A[i-1])+abs(A[i+1]-A[i]))+abs(A[i+1]-A[i-1]))

Measured memory_bytes: 20464
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce
from operator import xor
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


def main():
    H, W = map(int, input().split())

    dp = [[0] * 10 for _ in range(10)]
    for i in range(10):
        line = input().split()
        for j, c in enumerate(line):
            dp[i][j] = int(c)

    for i in range(10):
        dp[i][i] = 0

    for m in range(10):
        for s in range(10):
            for e in range(10):
                if dp[s][m] != INF and dp[m][e] != INF:
                    dist = dp[s][m] + dp[m][e]
                    if dist < dp[s][e]:
                        dp[s][e] = dist
    ans = 0
    for _ in range(H):
        line = input().split()
        for x in range(W):
            n = int(line[x])
            if n != -1:
                ans += dp[n][1]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4204
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main(){
	IOS;
	int x,y,z,k;
	cin >> x >> y >> z >> k;
	vector<ll> a(x),b(y),c(z);
	rep(i,x) cin >> a[i];
	rep(i,y) cin >> b[i];
	rep(i,z) cin >> c[i];
	vector<ll> v1,v2;
	for(int i = 0; i < x; i++){
		for(int j = 0; j < y; j++){
			v1.push_back(a[i]+b[j]);
		}
	}
	sort(all(v1)); reverse(all(v1));
	for(int i = 0; i < min(k,x*y); i++){
		for(int j = 0; j < z; j++){
			v2.push_back(v1[i]+c[j]);
		}
	}
	sort(all(v2)); reverse(all(v2));
	for(int i = 0; i < k; i++) cout << v2[i] << endl;

	return 0;
}

Measured memory_bytes: 43368
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    r = {}
    for i in range(N):
        s, p = i2s().split()
        p = int(p)
        if s in r.keys():
            r[s] += [(p, i)]
        else:
            r[s] = [(p, i)]

    rname = list(r.keys())
    rname.sort()
    # print(rname)
    for n in rname:
        out = [x[1] for x in sorted(r[n], reverse=True)]
        for m in out:
            print(m + 1)

main()


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

int n,Z,W,arr[2002];
int dp[2002][2],vis[2002][2];

inline int _abs(int a) {
    return a<0 ? -a : a;
}
int DP(int idx,int f) {
    int &ret=dp[idx][f];
    if(vis[idx][f]) return ret;

    vis[idx][f]=1;
    ret = _abs(arr[idx]-arr[0]);
    for(int i=1;i<idx;i++) {
        if(!f) ret = max(ret, DP(i,f^1));
        else ret = min(ret, DP(i,f^1));
    }
    return ret;
}
int main() {
    scanf("%d%d%d",&n,&Z,&W);
    for(int i=0;i<n;i++) scanf("%d",arr+i);
    reverse(arr,arr+n);
    arr[n]=W;

    printf("%d\n",DP(n,0));
    
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Map<BigInteger, Integer> memo;
    static boolean[][] vis;
    static List<List<Integer>> adj;
    static List<Integer> vertices;

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

        Set<String> set = new HashSet<>();
        int n = sc.nextInt();
        while (n-- > 0) {
            String word = sc.next();
            set.add(word);
        }
        System.out.println(set.size());
    }


    static int lowerBound(int[] arr, int element) {

        int low = 0, high = arr.length - 1, ans = 0;
        while (low <= high) {
            int mid = low + (high - low) / 2;
            if (arr[mid] <= element) {
                low = mid + 1;
                ans = mid;
            } else
                high = mid - 1;

        }

        return high;
    }

    static boolean isPalindrome(String word) {
        int i = 0, j = word.length() - 1;

        while (i <= j) {
            if (word.charAt(i++) != word.charAt(j--))
                return false;
        }

        return true;
    }

    static String longestPalindrome(String[] words, String word, int i) {
        if (i >= words.length) {
            if (isPalindrome(word))
                return word;

            return "";
        }

        if (word.length() > 0 && isPalindrome(word))
            return word;
        String left = longestPalindrome(words, word + words[i], i + 1);
        String right = longestPalindrome(words, word, i + 1);

        if (left.length() > 0)
            return left;
        return right;
    }


    static int solve(int[] arr, int i, int j, int k) {
        if (i == j && arr[i] <= k)
            return 1;

        int left = 0, right = 0;
        if (arr[i] <= k)
            left = solve(arr, i + 1, j, k) + 1;

        else if (arr[j] <= k)
            right = solve(arr, i, j - 1, k) + 1;

        return left + right;
    }

    static int minMove(BigInteger bg, int count) {
        if (bg.equals(BigInteger.ONE))
            return count;

        int first = Integer.MAX_VALUE, sec = Integer.MAX_VALUE, last = Integer.MAX_VALUE;
        if (bg.mod(BigInteger.valueOf(2)).compareTo(BigInteger.ZERO) == 0)
            first = minMove(bg.divide(BigInteger.valueOf(2)), count + 1);

        else if (bg.mod(BigInteger.valueOf(3)).compareTo(BigInteger.ZERO) == 0)
            sec = minMove(bg.multiply(BigInteger.valueOf(2)).divide(BigInteger.valueOf(3)), count + 1);

        else if (bg.mod(BigInteger.valueOf(5)).compareTo(BigInteger.ZERO) == 0)
            last = minMove(bg.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)), count + 1);

        if (memo.containsKey(bg))
            return memo.get(bg);

        memo.put(bg, Math.min(first, Math.min(sec, last)));

        return Math.min(first, Math.min(sec, last));
    }
}


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

int main() {
  int N, r, f = 0;
  cin >> N;
  r = N;

  for (int i = 0; i < 8; i ++) {
    f += r - r/10*10;
    r /= 10;
    if (r == 0)
      break;
  }
  
  if (N%f == 0)
    cout << "Yes" << endl;
  else
    cout<< "No" << endl;
}

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

int main(){
    int n, m, p;
    cin >> n >> m >> p;
    
    vector<int> d(m);
    for(int i = 0; i < m; i++){
        cin >> d[i];
        d[i] = (d[i] - p + n)%n;
    }

    sort(d.begin(), d.end());
    
    int ans = min(n-d[0], d[m-1]);

    for(int i = 0; i < m-1; i++){
        ans = min(ans, min(2*d[i] + n-d[i+1], 2*(n-d[i+1]) + d[i]));
    }
    
    cout << ans*100 << endl;

    return 0;
}


Measured memory_bytes: 3148
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef vector<int> VI;


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



int main() {
	int n, c, k;
	cin >> n >> c >> k;

	VI v(n);
	REP(i, n) {
		cin >> v[i];
	}

	SORT(v);

	int i = 0;
	int current_bus=v[0];
	int current_passengers = 0;;
	int sum = 1;
	while (i<n)
	{
		

		if (v[i] - current_bus <= k && current_passengers < c) {
			current_passengers++;
			if (current_passengers == c && i + 1<n) {
				current_bus = v[i + 1];
				current_passengers = 0;
				sum++;
			}
		}
		else {
			current_bus = v[i];
			sum++;
			current_passengers = 1;
		}	
		i++;
	}

	ANS(sum);


	return 0;
}



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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  string s, t;
  std::cin >> s >> t;
  string ans = "~";
  REP(i, s.size() - t.size() + 1) {
    int cnt = 0;
    bool ok = true;
    string s2 = s;
    REP(j, t.size()) {
      if (s[i + j] != t[j] && s[i + j] != '?') {
        ok = false;
        break;
      }
      s2[i + j] = t[j];
    }
    if (!ok)
      continue;
    replace(ALL(s2), '?', 'a');
    chmin(ans, s2);
  }
  if (ans == "~")
    std::cout << "UNRESTORABLE" << std::endl;
  else
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  string S;
  cin>>N>>S;

  Int x = 0, y = 0;
  for(Int i=0;i<N;i++){
    char ch = S[i];
    if('A' <= ch && ch <= 'M') y++;
    if('N' <= ch && ch <= 'Z') y--;
    if('a' <= ch && ch <= 'm') x++;
    if('n' <= ch && ch <= 'z') x--;
  }

  string ans;
  if(y > 0) ans += string(y, 'A');
  if(y < 0) ans += string(-y, 'N');
  if(x > 0) ans += string(x, 'a');
  if(x < 0) ans += string(-x, 'n');

  cout<<ans.size()<<endl;
  cout<<ans<<endl;

  return 0;
}



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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int x,y,z;
	cin >> x >> y >> z;
	cout << (x + y + z < 22?"win":"bust") << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <stack>
#include <string>
#include <cstring>
#include <sstream>
#include <cstdlib>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	string str;
	while(getline(cin, str)) {
		stack<double> s;
		stringstream ss;
		ss << str;
		while(ss >> str) {
			if(str[0] >= '0' && str[0] <= '9' || str.length() > 1) {
				s.push(atoi(str.c_str()));
			} else {
				double a = s.top(); s.pop();
				double b = s.top(); s.pop();
				double c;
				if(str[0] == '+') c = a + b;
				else if(str[0] == '-') c = b - a;
				else if(str[0] == '*') c = a * b;
				else c = b / a;						
				s.push(c);
			}
		}
		printf("%.6lf\n", s.top());
	}
	return 0;
}

Measured memory_bytes: 1268
def solve(N):
    d = 10 ** 7
    index = d // 2
    while True:
        k1 = index * (index - 1) // 2
        k2 = index * (index + 1) // 2
        if k1 < N <= k2:
            break
        elif k1 <= N:
            index = (index + d) // 2
        else:
            d = index
            index = index // 2

    d = k2 - N
    return "\n".join([str(i) for i in range(1, index + 1) if i != d])


if __name__ == "__main__":
    N = int(input())
    print(solve(N))


Measured memory_bytes: 39280
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)1e9+7;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};

void solve(){
	
	ll k;
	cin >> k;
	ll ans = 0;
	for(ll i = 1; i <= k; i ++){
		for(ll j = 1; j <= k; j++){
			for(ll x = 1; x <= k; x++){
				ans += (__gcd(i,__gcd(j,x)));
			}
		}
	}
	cout << ans;
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
   // cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <math.h>

int main(){
	int a;
	
	if(scanf("%d", &a))
	{
		printf("%s", a >= 30 ? "Yes" : "No");
	}
	return 0;
}




Measured memory_bytes: 1732
import java.util.*;

public class Main{
	  public static void main(String[] args) {
	      Scanner sc = new Scanner(System.in);
		  String s = sc.nextLine();
		  String a = s+s;
//		  System.out.println(a);	
		  String p = sc.nextLine();

				  if(a.contains(p)){
					  System.out.println("Yes");					  
				  }else{
					  System.out.println("No");	
				  }
	  }
}



Measured memory_bytes: 26140
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <functional>
#include <map>
#include <math.h>
#include <list>

using namespace std;
#define ll long long int


int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, k; cin >> n >> k;
	vector<int> a;
	
	int in;
	while (n--) {
		cin >> in;
		a.push_back(in);
	}
	sort(a.begin(), a.end());

	int sum = 0;
	for (int i = 0; i < k;i++) {
		sum += a[i];


	}

	cout << sum << endl;
	return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 100005;

int N, U, V, W;
vector<i_i> graph[MX];
// 0 Black, 1 White
int color[MX];
bool used[MX];

void dfs(int v, int c) {
	used[v] = true;
	color[v] = c;
	for (auto& u : graph[v]) {
		if (!used[u.first]) {
			if (u.second % 2) dfs(u.first, !c);
			else dfs(u.first, c);
		}
	}
}

void solve() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
		used[i] = false;
		cin >> U >> V >> W;
		graph[U].push_back({V, W});
		graph[V].push_back({U, W});
	}
	
	dfs(1, 0);
    for (int i = 1; i <= N; i++) cout << color[i] << "\n";
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 7680
import java.util.Scanner;

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

		Scanner s = new Scanner(System.in);
		while (true) {
			int n = s.nextInt();
			int a = s.nextInt();
			int b = s.nextInt();
			int c = s.nextInt();
			int x = s.nextInt();

			if (n == 0 && a == 0 && b == 0 && c == 0 && x == 0)
				break;

			int[] y = new int[n];
			for (int t = 0; t < n; t++) {
				y[t] = s.nextInt();
			}

			int frame = 0;
			int random = x;
			int check = 0;

			for (int i = 0; i < n; i++) {
				if (check != 0) {
					frame++;
					random = Random(a, b, c, random);
				}
				while (y[i] != random) {
					frame++;
					random = Random(a, b, c, random);
					if (frame > 10000)
						break;
				}
				check = 1;
				if (frame > 10000)
					break;
			}

			if (frame > 10000) {
				System.out.println(-1);
			} else {
				System.out.println(frame);
			}

		}
		s.close();
	}

	public static int Random(int a, int b, int c, int x) {
		return (a * x + b) % c;
	}
}

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

int main(){
	int n,r;
	cin>>n>>r;
	if(n<10) cout<<r+(100*(10-n))<<endl;
	else cout<<r<<endl;
}

Measured memory_bytes: 3604
a,b,c = input().split(" ")
i = int(a)
r = int(b) + 1
x = 0
num = 0
for i in range(int(a),r):
    num = int(c) % i
    if num == 0:
        x = x + 1
        continue
    elif num != 0:
        continue
    elif i == int(b):
        break
print(x)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
#define TIME ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

    const ll N = 1e2 + 7;
    const ll mod = 1e9 + 7;
    const ll inf = 1e9;



void solve(){
    ll x , ans = 0;
    cin >> x;
    ll y = 100;
    while(y < x){
        ll k = y / 100;
        y += k;
        ++ ans;
    }
    cout << ans;
}

int main(){
    TIME
    int tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**

**/


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }
ll GetDigit(ll num) {
	ll digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}

using namespace std;
int main() {

	ll a, b, c;

	cin >> a >> b >> c;

	ll ans = 0;

	if (a == 1 && b == 1 && c == 1) {
		cout << 0 << endl;
		return 0;
	}

	if (a == b && b == c && c == a) {
		cout << -1 << endl;
		return 0;
	}

	ll ah, bh, ch;

	for (int i = 0; ; i++)
	{
		
		if (a % 2 != 0 || b % 2 != 0 || c % 2 != 0) {
			break;
		}
		ah = a / 2;
		bh = b / 2;
		ch = c / 2;

		a = bh + ch;
		b = ah + ch;
		c = bh + ah;

		ans++;

	}

	cout << ans << endl;
}

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

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	long double n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e;
	long double div = min({a,b,c,d,e});
	ll ans = 4 + ceil(n/div);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;


inline long long euc(long long a,
              long long b) {

  long long r = 1;
  if(a < b) {
    r = a;
    a = b;
    b = r;
    r = 1;
  }
  while(r!=0) {
    r = a % b;
    a = b;
    b = r;
  }

  return a;

}


int main() {

  int T;
  cin >> T;

  for(int t = 0; t < T; ++t) {

    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    bool is_yes = true;
    if(a < b) {
      is_yes = false;
    }
    else if(d < b) {
      is_yes = false;
    }
    else if(c+1 < b) {
      long long k = euc(b, d);
      long long a2 = a % b;
      long long q = (b-a2) / k;

      if(a2 + q*k == b) {
        if(a2 + (q-1)*k > c) is_yes = false;
      }
      else if(a2 + q*k > c) {
        is_yes = false;
      }
    }

    if(is_yes) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }

  }

}


Measured memory_bytes: 256
def keta(n, elements):
    results = elements
    for i in range(n - 1):
        results = [r * 10 + e for e in elements for r in results]
    return results

N = int(input())

num753 = set()
for i in range(3,10):
    n1 = keta(i, set([3, 5, 7]))
    n2 = keta(i, set([3, 5]))
    n3 = keta(i, set([5, 7]))
    n4 = keta(i, set([3, 7]))
    num753 |= set(n1) - set(n2) - set(n3) - set(n4)
num753 = sorted(num753)

ans = 0
for i in num753:
    if i <= N:
        ans += 1
print(ans)


Measured memory_bytes: 8008
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;

struct Edge{int to,from,cost;};

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int us[510][510];
int ne[510][510];
int usa[510][510];
int nek[510][510];
pint usag[1000100];
pint neko[1000100];
int n,u,v,m;

bool inside(pint p){
	return 0<=p.first&&p.first<n&&0<=p.second&&p.second<n;
}

int main() {
	cin>>n>>u>>v>>m;
	rep(i,1000100){
		usag[i].first=usag[i].second=-1;
		neko[i].first=neko[i].second=-1;
	}
	rep(i,n)rep(j,n){
		cin>>usa[i][j];
		usag[usa[i][j]].first=j;
		usag[usa[i][j]].second=i;
	}
	rep(i,n)rep(j,n){
		cin>>nek[i][j];
		neko[nek[i][j]].first=j;
		neko[nek[i][j]].second=i;
	}
	int uc=0,nc=0;
	rep(i,m){
		int a=in(),c;
		pint p;
		if(usag[a].first>=0){
			us[usag[a].second][usag[a].first]=1;
			if(n>1){
				rep(j,4){
					c=0;
					for(p=usag[a];inside(p);p.first+=dx[2*j],p.second+=dy[2*j]){
						if(us[p.second][p.first])++c;
						else break;
					}
					for(p=usag[a];inside(p);p.first+=dx[2*j+1],p.second+=dy[2*j+1]){
						if(us[p.second][p.first])++c;
						else break;
					}
					if(c>n)++uc;
				}
			}else{
				++uc;
			}
		}
		if(neko[a].first>=0){
			ne[neko[a].second][neko[a].first]=1;
			if(n>1){
				rep(j,4){
					c=0;
					for(p=neko[a];inside(p);p.first+=dx[2*j],p.second+=dy[2*j]){
						if(ne[p.second][p.first])++c;
						else break;
					}
					for(p=neko[a];inside(p);p.first+=dx[2*j+1],p.second+=dy[2*j+1]){
						if(ne[p.second][p.first])++c;
						else break;
					}
					if(c>n)++nc;
				}
			}else{
				++nc;
			}
		}
		if(uc>=u&&nc<v){
			cout<<"USAGI"<<endl;
			return 0;
		}
		if(uc<u&&nc>=v){
			cout<<"NEKO"<<endl;
			return 0;
		}
		if(uc>=u&&nc>=v)break;
	}
	cout<<"DRAW"<<endl;
	return 0;
}

Measured memory_bytes: 17000