akhauriyash/Code-Regression huggingface dataset:
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp = [[0] * 3 for _ in range(N)]
dp[0] = [a[0], b[0], c[0]]
for i in range(N - 1):
	dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1])
	dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1], dp[i][2] + b[i + 1])
	dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1])
print(max(dp[N - 1]))


Measured memory_bytes: 34616
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int masu[14][14] = {0};
	int x, y, s, i, j, n = 0, cut = 0;
	int num[100] = {0};

	while(scanf("%d,%d,%d", &x, &y, &s) != EOF){
		x = x + 2;
		y = y + 2;
		masu[x][y] ++;
		if(s == 1){
			masu[x][y-1] += 1, masu[x][y+1] += 1, masu[x-1][y] += 1, masu[x+1][y] += 1;
		}
		else if(s == 2){
			masu[x][y-1] += 1, masu[x][y+1] += 1, masu[x-1][y] += 1, masu[x+1][y] += 1;
			masu[x+1][y-1] += 1, masu[x+1][y+1] += 1, masu[x-1][y-1] += 1, masu[x-1][y+1] += 1;
		}
		else{
			masu[x][y-1] += 1, masu[x][y+1] += 1, masu[x-1][y] += 1, masu[x+1][y] += 1;
			masu[x+1][y-1] += 1, masu[x+1][y+1] += 1, masu[x-1][y-1] += 1, masu[x-1][y+1] += 1;
			masu[x+2][y] += 1, masu[x-2][y] += 1, masu[x][y+2] +=1, masu[x][y-2] += 1;
		}
		
	}

	for(i = 2; i < 12; i ++){
		for(j = 2; j < 12; j ++){
			num[n] = masu[i][j];
			n ++;
		}
	}

	sort(num, num+100);

	for(i =0; i < 100; i ++){
		if(num[i] == 0) cut ++;
		else break;
	}

	cout << cut << endl << num[99] << endl;

	return 0;    
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

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

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

lint num_digits(lint n) {
    lint ans = 0;
    while (n) {
        ans += 1;
        n /= 10;
    }
    return ans;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    lint N;
    cin >> N;
    lint min_f = 1LL << 61;
    for (lint i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            lint j = N / i;
            min_f = min(min_f, max(num_digits(i), num_digits(j)));
        }
    }
    cout << min_f << "\n";
}

Measured memory_bytes: 256
/*
ЗАПУСКАЕМ ВЫСОКОГО
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░ 
 */
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
   
    
    
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }  
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228


int n, a, b;


int main() {    
    cin >> n >> a >> b;
    if (a > b) {
        cout << 0 << endl;
        return 0;
    }
    if (n == 1) {
        if (a == b) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
        return 0;
    }
    cout << 1LL * (n - 2) * b - 1LL * (n - 2) * a + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}


macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"a"# => r#"b"#,
r#"c"# => r#"d"#,
}

fn solve(src: &str) -> String {
    let mut disp:String;
    
    input! {
        source = src,
        a: chars,
        b: chars,
    }
    let mut ab:Vec<char> = Vec::new();
    ab.extend(a);
    ab.extend(b);
    let n:f64 = ab.into_iter().collect::<String>().parse().unwrap();
    let s = n.sqrt() as i64;

    if s * s == n as i64 {
        disp = "Yes".to_string();
    } else {
        disp = "No".to_string();
    }

    disp.to_string()
}

Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
using namespace std;


int main(){
    int a[3][3];
    int n;
    int b[100];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> a[i][j];
        }
    }
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> b[i];
    }

    int counter = 0;
    while(counter < n){
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(b[counter] == a[i][j]) a[i][j] = -1;
            }
        }
        counter++;
    }

    // 横とたて　
    for(int i=0;i<3;i++){
        if(a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) {
            cout << "Yes" << endl;
            return 0;
        }
        if(a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1){
            cout << "Yes" << endl;
            return 0;
        }
    }

    if((a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) 
        || (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1)){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << 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;
using P = pair<int, int>;

int main() {
  vector<vector <int>> A(3, vector<int>(3));
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) {
      cin >> A.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  vector<vector <int>> bingo(3, vector<int>(3));

  for (int k=0; k<N; k++) {
    cin >> b.at(k);
    for (int i=0; i<3; i++) {
      for (int j=0; j<3; j++) {
        if (b.at(k) == A.at(i).at(j))
        bingo.at(i).at(j) = 1;
      }
    }
  }

  // cout << "======" << endl;
  // for (int i=0; i<3; i++) {
  //   for (int j=0; j<3; j++) {
  //     cout << bingo.at(i).at(j) << " ";
  //   }
  //   cout << endl;
  // }

  
  // vertical
  bool cond1 = (bingo.at(0).at(0) && bingo.at(0).at(1) && bingo.at(0).at(2)); 
  bool cond2 = (bingo.at(1).at(0) && bingo.at(1).at(1) && bingo.at(1).at(2)); 
  bool cond3  = (bingo.at(2).at(0) && bingo.at(2).at(1) && bingo.at(2).at(2)); 

  // horizontal
  bool cond4 = (bingo.at(0).at(0) && bingo.at(1).at(0) && bingo.at(2).at(0)); 
  bool cond5 = (bingo.at(0).at(1) && bingo.at(1).at(1) && bingo.at(2).at(1)); 
  bool cond6 = (bingo.at(0).at(2) && bingo.at(1).at(2) && bingo.at(2).at(2)); 

  // cross
  bool cond7 = (bingo.at(0).at(0) && bingo.at(1).at(1) && bingo.at(2).at(2)); 
  bool cond8 = (bingo.at(0).at(2) && bingo.at(1).at(1) && bingo.at(2).at(0)); 

  if (cond1 || cond2 || cond3 || cond4 || cond5 || cond6 || cond7 || cond8) cout << "Yes" << endl;
  else cout << "No" << endl;



}

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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 100005;
int n;
ll cn[MX];
string s[MX], res; 
map<string, set<int>> mp;

char com (string &a, string &b) {
	assert(a != b);
	for (char x : a)
		for (char y : b)
			if (x == y)
				return x;
	assert(0);
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> cn['A'] >> cn['B'] >> cn['C'];

	forn (i, n) {
		cin >> s[i];
		if (s[i] != "AB") mp["AB"].insert(i);
		if (s[i] != "AC") mp["AC"].insert(i);
		if (s[i] != "BC") mp["BC"].insert(i);
	}

	forn (i, n) {
		char sig;
		auto it = mp[s[i]].upper_bound(i);

		if (it == mp[s[i]].end()) sig = s[i][0];
		else sig = com(s[i], s[*it]);

		if (!cn[s[i][0]] && !cn[s[i][1]]) {
			cout << "No" << endl;
			return 0;
		}

		if (!cn[s[i][0]]) {
			res.pb(s[i][0]);
			cn[s[i][0]]++;
			cn[s[i][1]]--;
			continue;
		}

		if (!cn[s[i][1]]) {
			res.pb(s[i][1]);
			cn[s[i][0]]--;
			cn[s[i][1]]++;
			continue;
		}

		if (s[i][0] == sig) {
			res.pb(s[i][0]);
			cn[s[i][0]]++;
			cn[s[i][1]]--;
			continue;
		} else {
			res.pb(s[i][1]);
			cn[s[i][0]]--;
			cn[s[i][1]]++;
			continue;
		}
	}

	cout << "Yes" << endl;
	for (char c : res)
		cout << c << endl;

	return 0;
}


Measured memory_bytes: 16308
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
vector<pair<int,int>> G[100010];
int ans[100010];
void dfs(int s, int p,int c){
	int col = 1;
	if(col==c) col++;
	for(auto v:G[s]){
		if(v.first==p) continue;
		ans[v.second] = col;
		dfs(v.first,s,col);
		col++;
		if(col==c) col++;
	}
}

int main(){
	int i,n;
	cin >> n;
	for(i=0;i<n - 1;i++){
		int a,b; cin >> a >> b;
		a--; b--;
		G[a].push_back({b,i});
		G[b].push_back({a,i});
	}
	int root = -1,mx = -1;
	for(i=0;i<n;i++){
		if((int)G[i].size()>mx){
			mx = G[i].size();
			root = i;
		}
	}
	cout << mx << endl;
	dfs(root,-1,-1);
	for(i=0;i<n - 1;i++){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 8448
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  int n; cin >> n;
  vector<int> v(n);
  for(int i = 0; i < n; i++){
    cin >> v[i];
  }
  vector<int> v2(1000000, 0), v3(1000000, 0);
  int x, y, max2 = 0, max3 = 0;
  for(int i = 0; i < v.size(); i++){
    if(i % 2 == 0){
      v2[v[i]]++;
      if(v2[v[i]] > max2){
        x = v[i];
        max2 = v2[v[i]];
      }
    }
    else{
      v3[v[i]]++;
      if(v3[v[i]] > max3){
        y = v[i];
        max3 = v3[v[i]];
      }
    }
  }
  sort(v2.begin(), v2.end());
  sort(v3.begin(), v3.end());
  reverse(v2.begin(), v2.end());
  reverse(v3.begin(), v3.end());
  int a = v2[0], b = v3[0];
  if(x == y){
    if(v2[1] > v3[1]) a = v2[1];
    else b = v3[1];
  }
  cout << n - a - b << endl;
  return;
}

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


Measured memory_bytes: 8448
#!/usr/bin/python3
# vim: set fileencoding=utf-8:
import sys
import math
input = sys.stdin.readline


def round(x): return (x*2+1)//2

"""
H = int(input())
h = [int(ele) for ele in input().split()]
h = [0] + h
"""


def main():
    a, b = map(int, input().split())
    avg = (a + b)/2
    print(int(round(avg)))


if __name__ == "__main__":
    main()


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

using ll = long long;
const ll MOD = 998244353;

int t = 1, k[100], v[100][100], d[100], f[100];

void dfs(int x) {
    d[x] = t;
    t++;
    rep(i, k[x]) {
        int y = v[x][i];
        if (d[y] > 0) continue;
        dfs(y);
    }
    f[x] = t;
    t++;
}

int main() {
    int n, u;
    cin >> n;
    rep(i, n) {
        cin >> u;
        cin >> k[u - 1];
        rep(j, k[u - 1]) {
            cin >> v[u - 1][j];
            v[u - 1][j]--;
        }
    }
    rep(i, n) d[i] = 0;
    rep(i, n) if (d[i] == 0) dfs(i);
    rep(i, n) {
        cout << i + 1 << " " << d[i] << " " << f[i] << "\n";
    }
}


Measured memory_bytes: 3112
import sys

N = int(sys.stdin.readline())
X = list(map(int, sys.stdin.readline().split()))

sort = sorted(X)
first = sort[N//2 - 1]
second = sort[N//2]

for i in range(N):
    if X[i] <= first:
        print(second)
    else:
        print(first)

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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
template<class T> void sort3a(T& a,T& b,T& c) {if (a>b) swap(a,b); if (b>c) swap(b,c); if (a>b) swap(a,b);}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    string S; cin >>S;

    cout << (S.find("YAKI") == 0 ? "Yes" : "No") <<endl;
}


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

int main() {
    string s; cin >> s;
    int ans = 1000000000;
    for (int i = 0; i < s.size() - 2; i++) {
        int n = (s[i] - '0') * 100 + (s[i+1] - '0') * 10 + (s[i+2] - '0');
        ans = min(ans, abs(n - 753));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

//↑template↑





int main() {

	int a, b;
	cin >> a >> b;
	if (a < b) { cout << 0 << endl; }
	else { cout << 10 << endl; }





}

Measured memory_bytes: 256
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e15)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int dst[305][305];
void calc(int n,map<pii,int> d){
	For(i,0,304) For(j,0,304){
		if(i==j) dst[i][j]=0;
		else dst[i][j]=INF;
		if(d.count({i,j})) dst[i][j]=min(dst[i][j],d[{i,j}]);
	}
	For(k,0,n-1) For(i,0,n-1) For(j,0,n-1){
		dst[i][j]=min(dst[i][j],dst[i][k]+dst[k][j]);
	}
}

void dist(int n,set<pii> c){
	For(i,0,304) For(j,0,304){
		if(i==j) dst[i][j]=0;
		else dst[i][j]=INF;
		if(c.count({i,j})) dst[i][j]=1;
	}
	For(k,0,n-1) For(i,0,n-1) For(j,0,n-1){
		dst[i][j]=min(dst[i][j],dst[i][k]+dst[k][j]);
	}
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n,m,l; cin>>n>>m>>l;
	map<pii,int> d;
	int s,t,w;
	For(i,0,m-1){
		cin>>s>>t>>w;
		s--; t--;
		d[{s,t}]=w;
		d[{t,s}]=w;
	}
	calc(n,d);
	set<pii> st;
	For(i,0,n-1) For(j,0,n-1){
		if(i!=j && dst[i][j]<=l){
			st.emplace(i,j);
			st.emplace(j,i);
		}
	}
	dist(n,st);
	int q; cin>>q;
	while(q--){
		cin>>s>>t;
		s--; t--;
		int ans=dst[s][t];
		if(ans==INF) cout<<"-1\n";
		else cout<<ans-1<<"\n";
	}
	return 0;
}

Measured memory_bytes: 17920
S = input()
N = len(S)

if S != S[::-1]:
    print('No')
    exit(0)


cond_1 = S[:int((N-1)/2)]
cond_1_r = cond_1[::-1]

if cond_1 != cond_1_r:
    print('No')
    exit(0)

cond_2 = S[int((N+3)/2-1):]
cond_2_r = cond_2[::-1]

if cond_2 != cond_2_r:
    print('No')
    exit(0)

print('Yes')


Measured memory_bytes: 3064
n, x = gets.split(' ')
n = n.to_i
x = x.to_i
m = []
(0...n).each {
  m << gets.to_i
}

m.sort!
count = 0
m.each do |i|
  count += 1
  x -= i
end
count += x / m[0]
puts count


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

int main(){
    int n;
    cin>>n;
    vector<int> v;
    for(int i=0;i<n;i++){
        int num;
        cin>>num;
        v.push_back(num);
    }
    sort(v.begin(),v.end());
    bool isdiff=true;
    int tmp=v[0];
    for(long long i=1;i<v.size();i++){
        if(tmp==v[i]){
            isdiff=false;
            break;
        }
        tmp=v[i];
    }

    if(isdiff)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;

}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    long long x,y,z;cin>>x>>y>>z;
    int k; cin>>k;
    long long a[x];
    long long b[y];
    long long c[z];
    vector<long long> ko;
    for(int i = 0;i<x;i++) cin >>a[i];
    for(int i = 0;i<y;i++) cin >>b[i];
    for(int i = 0;i<z;i++) cin >>c[i];
    sort(a,a+x,greater<long long>());
    sort(b,b+y,greater<long long>());
    sort(c,c+z,greater<long long>());
    for(int i = 0;i<x;i++){
     for(int j = 0;j<y;j++){
       for(int h = 0;h<z;h++){
           if((i+1)*(j+1)*(h+1)<=k){
              ko.push_back(a[i]+b[j]+c[h]);
           }
           else break;
       }
     } 
    }
    sort(ko.begin(),ko.end(),std::greater<long long>());
    for(int i = 0;i<k;i++){
      cout<<ko[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int H, W;

int main() {
    cin >> H >> W;
    vector<vector<int>> a(H + 1, vector<int>(W + 1));
    for(int i = 0; i < W + 1; i++){
        a.at(H).at(i) = 0;
    }
    for(int j = 0; j < H; j++){
        string str;
        cin >> str;
        a.at(j).at(W) = 0;
        for(int i = 0; i < W; i++){
            if(str.at(i) == '.')
                a.at(j).at(i) = 1;
            else
                a.at(j).at(i) = 0;
        }
    }

    //横方向
    for(int j = 0; j < H; j++){
        int prev = 0;
        int start = 0;
        for(int i = 0; i < W + 1; i++){
            if (a.at(j).at(i) > 0){
                if(prev == 0){
                    start = i;
                    prev = 1;
                }
            }else{
                if(prev == 1){
                    int num = i - start;
                    for(int k = start; k < i; k++){
                        a.at(j).at(k) = num;
                    }
                    prev = 0;
                }
            }
        }
    }

    //縦方向
    for(int i = 0; i < W; i++){
        int prev = 1;
        int start = 0;
        for(int j = 0; j < H + 1; j++){
            if (a.at(j).at(i) > 0){
                if(prev == 0){
                    start = j;
                    prev = 1;
                }
            }else{
                if(prev == 1){
                    int num = j - start;
                    for(int k = start; k < j; k++){
                        a.at(k).at(i) += num - 1;
                    }
                    prev = 0;
                }
            }
        }
    }

    int ans = 0;
    for(int j = 0; j < H; j++){
        int m1 = *max_element(a.at(j).begin(), a.at(j).end());
        ans = max(ans, m1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 16000
n=int(input())
c=[[0 for j in range(10)] for i in range(10)]

for i in range(1,n+1):
    p=len(str(i))
    x=i//(10**(p-1))
    y=i%10
    c[x][y]+=1

ans=0
for i in range(1,10):
    for j in  range(1,10):
        ans+=c[i][j]*c[j][i]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MOD 1000000007
#define rep(i,x,n) for(int i=x; i<n; i++)
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int N, M;
	cin>>N>>M;
	vector<int> D(N+1);
	rep(i, 0, M) {
		int x;
		cin>>x;
		D[x]=-1;
	}
	D[0]++, D[1]++;
	rep(i, 2, N+1) D[i]=~D[i] ? (D[i-1]+D[i-2])%MOD : 0;
	cout<<D[N];
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,0,n)cin >> v[i];
	sort(all(v));
	bool valid = true;
	rep(i,0,n-1){
		valid &= v[i] != v[i+1];
	}
	cout << (valid?"YES":"NO") << '\n';
}


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

int main() {
  string S;
  cin >> S;
  int ff=1, l=0;
  for (int i=S.size()-3; i>=0; i-=2) {
    ff=1;
    for (int j=0; j<(i+1)/2; j++) {
      if (S[j]!=S[j+(i+1)/2]) {
        ff=0;
      }
    }
    if (ff==1) {
      l=i+1;
      break;
    }
  }
  cout << l << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s.length()>3)
  {
    for(int i=0;i<3;i++)
    {
      cout<<s[i];
    }
    cout<<endl;
  }
  else
  {
    cout<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

const int M = 1e5 + 1;

int main(void)
{
    ll N, K;
    cin >> N >> K;

    vector<ll> list(M, 0);
    int value, cnt;
    for (int i = 0; i < N; i++)
    {
        cin >> value >> cnt;
        list[value] += cnt;
    }

    int ans;
    for (int i = 0; i <= M; i++)
    {
        if (list[i] > 0)
        {
            K -= list[i];
            if (K <= 0)
            {
                ans = i;
                break;
            }
        }
        // if (K <= list[i])
        // {
        //     cout << i << endl;
        //     return (0);
        // }
        // K -= list[i];
    }
    cout << ans << "\n";
    return (0);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    if (a == b && b == c) {
        cout << -1 << endl;
        return 0;
    }
    int cnt = 0;
    while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
        int ha = a / 2;
        int hb = b / 2;
        int hc = c / 2;
        a = ha + hb;
        b = ha + hc;
        c = hb + hc;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] v = new int[n];
        int[] c = new int[n];
		int result = 0;
      
        for (int i = 0; i < n; i++) {
          v[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
          c[i] = sc.nextInt();
        }
      
      	for (int i = 0; i<n; i++) {
            if (v[i] - c[i] > 0) {
              result += v[i] - c[i];
            }
        }
        System.out.println(result);
        sc.close();
    }
 
}

Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll unsigned long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  int n, p;
  cin >> n >> p;
  int even = 0;
  int odd = 0;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    if(x % 2 == 0)even++;
    else odd++;
  }
  ll res = ((ll)1 << even);
  if(odd == 0){
    if(p == 0)cout << res << endl;
    else cout << 0 << endl;
  }else{
    res = res * ((ll)1 << (odd - 1));
    cout << res << endl;
  }
	return 0;
}


Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
struct sl{
	int sz;
	char zf;
};
int main()
{
	int n,m,i,j;
	sl gz[105][105];
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>gz[i][j].zf;
			if(gz[i][j].zf=='#')
			{
				gz[i][j].sz=-100;
				continue;
			}
			gz[i][j].sz=0;
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(gz[i][j].zf=='.')
			{
				continue;
			}
			gz[i-1][j-1].sz++;
			gz[i-1][j].sz++;
			gz[i-1][j+1].sz++;
			gz[i][j-1].sz++;
			gz[i][j+1].sz++;
			gz[i+1][j-1].sz++;
			gz[i+1][j].sz++;
			gz[i+1][j+1].sz++;
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(gz[i][j].zf=='.')
			{
				cout<<gz[i][j].sz;
			}
			else
			{
				cout<<"#";
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define N 10000001

vector< pair<int, int> > v[100001];
int color[100001];

void dfs(int g, int par, int sm) {
        if (sm & 1) color[g] = 0;
        else color[g] = 1;
        for (int i = 0; i < v[g].size(); i++) {
                if (v[g][i].first != par) {
                        dfs(v[g][i].first, g, sm + v[g][i].second);
                }
        }
}

int main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int n; cin >> n;
        for (int i = 0; i < n-1; i++) {
                int u, v1, w; cin >> u>> v1>> w;
                v[u].push_back({v1, w});
                v[v1].push_back({u, w});
        }
        dfs(1, -1, 0);
        for (int i = 1; i <= n; i++) {
                cout << color[i]<<'\n';
        }
return 0;
}


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

int main(){
  int N, sum=0;
  cin >> N;
  vector<int> B(N-1);
  for (int i = 0; i < N-1; i++) {
  	cin >> B.at(i);
  }
  for(int i = 0; i< N-2; i++){
  	sum += min(B.at(i),B.at(i+1));
  }
  cout << sum + B.at(0) + B.at(N-2) << endl;
}

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

using namespace std;

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

    if(a < c && c < b){
        cout << "Yes" << endl;
    } else if (b < c && c < a) {
        cout << "Yes" << endl;
    } else {
        cout << "No" <<endl;
    }
    return 0;
}

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

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

using namespace std;


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

    int N;
    vector<int> A(3);
    cin >> N;
    REP(i, 3) cin >> A[i];
    vector<int> x(N);
    REP(i, N) {
        string s;
        cin >> s;
        if (s == "AB") {
            x[i] = 0;
        } else if (s == "BC") {
            x[i] = 1;
        } else if (s == "AC") {
            x[i] = 2;
        }
    }

    bool is_solvable = true;
    vector<int> ops(N);

    REP(i, N) {
        int j0 = x[i];
        int j1 = (j0 + 1) % 3;
        if (A[j0] < A[j1]) {
            ++A[j0];
            --A[j1];
            ops[i] = j0;
        } else if (A[j0] > A[j1]) {
            --A[j0];
            ++A[j1];
            ops[i] = j1;
        } else if (A[j0] > 0) {
            if (i + 1 < N) {
                int k0 = x[i + 1];
                int k1 = (k0 + 1) % 3;
                if (j0 == k0 || j0 == k1) {
                    ++A[j0];
                    --A[j1];
                    ops[i] = j0;
                } else if (j1 == k0 || j1 == k1) {
                    --A[j0];
                    ++A[j1];
                    ops[i] = j1;
                } else {
                    throw runtime_error("");
                }
            } else {
                ++A[j0];
                --A[j1];
                ops[i] = j0;
            }
        } else {
            assert(A[j0] == 0 && A[j1] == 0);
            is_solvable = false;
            break;
        }
    }

    if (is_solvable) {
        cout << "Yes\n";
        REP(i, N) {
            cout << char('A' + ops[i]) << '\n';
        }
    } else {
        cout << "No\n";
    }
    cout << flush;

    return 0;
}


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

int main(void){
  int n, temp;
  cin >> n;
  int a[n];
  long long sum = 0;  
  for(int i = 0; i < n; i++){
    cin >> temp;
    sum += temp;
    a[i] = temp;
  }
  long long su, ara;
  long long ans = 100000000000000;
  su = 0;
  ara = sum;
  for(int i = 0; i < n - 1; i++){
    su += a[i];
    ara = sum - su;
    ans = min(ans, abs(su - ara));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n = int(input())
xy = [[] for _ in range(n)]
f1 = []
f2 = []
for i in range(n):
    x, y = map(int, input().split())
    f1.append(x + y)
    f2.append(x - y)
    xy[i].append(x + y)
    xy[i].append(abs(-x - y))

print(max(max(f1) - min(f1), max(f2) - min(f2)))

Measured memory_bytes: 112188
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <cctype>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

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

    if ((b - a) == (c - b)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    } 
    
    return 0;
}




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

void output (vector<int> &A,int N){
  for(int i=0;i<N;i++){
    cout << A.at(i);
    if(i!=N-1){
      cout << " ";
    }
    else{
      cout << endl;
    }
  }
  return;
}

void intentionsort(vector<int> &A,int N){
  for(int i=1;i<N;i++){
    int V=A.at(i);
    int j=i-1;
    while(j>=0 && A.at(j)>V){
      A.at(j+1)=A.at(j);
      j--;
    }
    A.at(j+1)=V;
    output(A,N);
  }
  return;
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    cout << A.at(i);
    if(i!=N-1){
      cout << " ";
    }
    else{
      cout << endl;
    }
  }
  intentionsort(A,N);
  
}


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

#define mod 998244353

// F_mod 上でのべき乗, 蟻本p115
ll modPow(ll x, ll n) {
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    vector<int>D(N);
    for (int i = 0; i < N; ++i) {
        cin >> D[i];
    }
    if(D[0] != 0) {
        cout << 0 << "\n";
        return 0;
    }

    vector<int>cnt(N+1, 0);
    for (int i = 1; i < N; ++i) {
        cnt[D[i]]++;
    }

    if(cnt[0]){
        cout << 0 << "\n";
        return 0;
    }

    cnt[0]++;

    ll ans = 1;
    int sum = 1;
    for (int i = 0; i < N-1; ++i) {
        if(cnt[i+1] == 0){
            cout << 0 << "\n";
            return 0;
        }
        ans *= modPow(cnt[i], cnt[i+1]);
        ans %= mod;
        sum += cnt[i+1];
        if(sum == N) {
            break;
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 1024
def solve(n):
    ret = ""
    i = 0  # n%2が元の何ビット目にあたるか
    while True:
        if i % 2 == 1 and n % 2 == 1:  # 奇数ビットが1のとき
            n += 2
        ret += str(n % 2)
        n //= 2  # 1ビット右にずらす
        i += 1
        if n == 0:
            break
    return ret[-1::-1]  # 逆順に結合されているので反転


n = int(input())
if n == 0:
    print(0)
elif n < 0:  # 負数は左ビットシフト、一文字落として表示
    n *= -2
    print(solve(n)[:-1])
else:
    print(solve(n))

Measured memory_bytes: 38512
#include <iostream>
#include <cmath>
     
int main() {
    int n;
    std::cin >> n;
    while(n--){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		int ix1 = round(x1*100000), iy1 = round(y1*100000),
			ix2 = round(x2*100000), iy2 = round(y2*100000),
			ix3 = round(x3*100000), iy3 = round(y3*100000),
			ix4 = round(x4*100000), iy4 = round(y4*100000);
		int a = iy1 - iy2, b = ix2 - ix1, c = iy3 - iy4, d = ix4 - ix3;
		if(!((long long int)a*d - (long long int)b*c))
			std::cout << "YES" << std::endl;
		else
			std::cout << "NO" << std::endl;
		}
    return 0;
}

Measured memory_bytes: 1236
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int n = Math.min(a, b);
		int ans = 0;
		sc.close();
		
		for(int i = n; i >= 1; i--){
			if(a % i == 0 && b % i == 0) {
				k--;
				ans = i;
				
				if(k == 0) {
					break;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
  int s;
  scanf("%d",&s);
  int a[1000001];
  memset(a,0,sizeof(a));
  a[s]=1;
  
  int n=s;
  int i=1;
  while(i<1000000)
  {
    i++;
    int fn;
    if(n%2==0)
    fn=n/2;
    else
      fn=3*n+1;
      n=fn;
      
    if(a[fn]==1)
    {
      printf("%d",i);
      break;
    }
    else
      a[fn]=1;
  }
    
  
}

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

int main(void) {
  int N, A, is_denied=0;
  cin >> N;
  
  for(int i=0; i<N; i++){
	cin >> A;
	if(!(A%2) && (A%3 && A%5))
      is_denied=1;
  }
  
  if(is_denied)
  	printf("DENIED");
  else
  	printf("APPROVED");
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR (int x) {
	if (x ==1)
		return false;
	if (x == 2)
		return true;
	if (x%2==0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}

using namespace std;
#pragma endregion
signed main() {
	int n,h,w, x = 0,A,B;
	cin >> n >> h >> w;
	rep(i, n) {
		cin >> A >> B;
		if (A >= h && B >= w)
			x++;
	}
	cout << x <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int A,B,N,count=0,sum,dig=0;
    scanf("%d %d %d",&N,&A,&B);
    //printf("%d%d%d",N,A,B);
    for(int i=1;i<=N;i++)
    {
        sum = 0;
        int j = i;
        while(j)
        {
            dig = j % 10;
            sum = sum + dig;
            j = j / 10;
        }
        if(A<=sum && sum<=B)
        {
            count = count + i;
            //printf("%d %d\n",sum,i);
        }
    }
     printf("%d",count);  
}

Measured memory_bytes: 128
//AtCoder ABC127 
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

int main() {
    int A,B;
    cin>>A>>B;
    int ans;
    if(A>=13){
		ans = B;
	} else if (A>=6&&A<=12){
        ans = B/2;
    } else {
        ans=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int ans,n,s;

void dfs(int i,int sum,int m){
	if(i==0){
		if(sum==s){
			ans++; //o(m);
		}
		return;
	}
	rep(j,m,10){
		dfs(i-1,sum+j,j+1);
	}
}

int main(){
	while(1){
		cin>>n>>s;
		if(n==0 && s==0) break;
		ans=0;
		dfs(n,0,0);
		o(ans);
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[300005];
int t[4*300005];
void build(int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = 0;
        return;
    } else {
        int tm = (tl + tr) / 2;
        build(v*2, tl, tm);
        build(v*2+1, tm+1, tr);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}
void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr && tl==pos) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}
int getMax(int v, int tl, int tr, int l, int r) {
    if (l > r)
        return INT_MIN;
    if (l == tl && r == tr)
        return t[v];
    int tm = (tl + tr) / 2;
    return max(getMax(v*2, tl, tm, l, min(r, tm)),
                   getMax(v*2+1, tm+1, tr, max(l, tm+1), r));
}
int main()
{
	int n,k;
	cin>>n>>k;
	int mxValue = 0;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		mxValue = max(mxValue,arr[i]);
	}
	vector<int>dp(n,0);
	mxValue+=1;
	build(1,0,mxValue);
	int ans = 0;
	for(int i=0; i<n; i++)
    {
        int l = max(0,arr[i]-k);
        int r = min(mxValue,arr[i]+k);
        //cout << l << " " << r << " ";
        int mx = getMax(1,0,mxValue,l,r);
        //cout << mx << endl;
        dp[i] = mx + 1;
        update(1,0,mxValue,arr[i],dp[i]);
    }
    for(int x: dp)ans = max(ans,x);
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9596
n=int(input())
dp=[0]*100010

for i in range(1,100010):
  dp[i]=float('inf')
  
for i in range(1,100010):
  power6=1
  while power6<=i:
    dp[i]=min(dp[i-power6]+1,dp[i])
    power6*=6
  power9=1
  while power9<=i:
    dp[i]=min(dp[i-power9]+1,dp[i])
    power9*=9

print(dp[n])

Measured memory_bytes: 47564
from collections import Counter

N = int(input())

A, B = ['a'], []
for i in range(1, N):
  for a in A:
    for c in 'abcdefghij'[:len(set(a))+1]:
      B.append(a + c)
  A, B = B, []

for a in A:
  print(a)

Measured memory_bytes: 13260
#include "bits/stdc++.h"
using namespace std;

// fundamental
using ll = long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define FOR(i,s,n) for (ll i = (s); i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(x) ((ll)1e##x)
#define MAXC(c,x) (c = max(c, x))
#define MINC(c,x) (c = min(c, x))
const ll mod = TEN(9) + 7;

// vector
using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>;
template<class T, size_t N, class A = size_t> auto mdv(A size = 0) -> typename enable_if<N==1, vector<T>>::type { return vector<T>(size); }
template<class T, size_t N, class A = size_t> auto mdv(A size = 0) -> vector<decltype(mdv<T, N - 1>())> { return vector<decltype(mdv<T, N - 1>())>(size); }
template<class T, size_t N, class A, class... B> auto mdv(A size, B... rest) -> typename enable_if<N!=1, vector<decltype(mdv<T, N - 1>(rest...))>>::type { return vector<decltype(mdv<T, N - 1>(rest...))>(size, mdv<T, N - 1>(rest...)); }
template<class T, class... A> auto mdv(A... size) -> decltype(mdv<T, sizeof...(size), A...>(size...)) { return mdv<T, sizeof...(size), A...>(size...); }
// template<size_t N, class A, class... B> auto mdvl(A size, B... rest) -> decltype(mdv<N, ll, A, B...>(size, rest...)) { return mdv<N, ll, A, B...>(size, rest...); }

// template<class T, class A> auto mdv(A size) -> vector<T> { return vector<T>(size); }
// template<class T, class A, class... B> auto mdv(A size, B... rest) -> vector<decltype(mdv<T>(rest...))> { return vector<decltype(mdv<T>(rest...))>(size, mdv<T>(rest...)); }

// io
template<class T> istream& operator >>(istream& is, vector<T>& vec){ for(T& x: vec) is >> x; return is; }
template<class T, class U> istream& operator >>(istream& is, pair<T, U>& p){ is >> p.first >> p.second; return is; }
template<class T> void input(T& t) { cin >> t; assert(cin); } template<class T, class... Ts> void input(T& t, Ts&... ts) { cin >> t; input(ts...); }
template<class T> void print(T&& t) { cout << t; } template<class T, class... Ts> void print(T&& t, Ts&&... ts) { cout << t; print(ts...); }
template<class T> void println(T&& t) { cout << t << endl; } template<class T, class... Ts> void println(T&& t, Ts&&... ts) { cout << t; println(ts...); }
template<class T> string join(const vector<T>& v, const string & sep) { stringstream ss; REP(i, v.size()) ss << (i != 0 ? sep : "") << v[i]; return ss.str(); }

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(50);
    ll n; cin >> n;
	ll x = sqrt(n);
	if (x * x == n) x--;

	ll ans = 0;
	FOR(i, 1, x + 1) if (n % i == 0 && n / i != i + 1) ans += n / i - 1;
	
	cout << ans << endl;
}


Measured memory_bytes: 256