akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// constexpr std::int64_t INF = 1ull << 50;
constexpr int INF = 1 << 20;

auto main() -> int {
  std::uint32_t N, M;
  std::cin >> N >> M;

  // <Pi, Yi, Idx>
  using city_type = std::tuple<std::uint32_t, std::uint64_t, std::uint32_t>;
  std::vector<city_type> Cs(M);
  std::vector<std::vector<std::vector<city_type>::iterator>> CRs(N);
  for (auto it = Cs.begin(); it < Cs.end(); ++it) {
    auto& Pi = std::get<0>(*it);
    auto& Yi = std::get<1>(*it);
    std::cin >> Pi >> Yi;

    CRs.at(Pi - 1).emplace_back(it);
  }

  for (auto& p : CRs) {
    std::sort(p.begin(), p.end(),
              [](auto& a, auto& b) { return std::get<1>(*a) < std::get<1>(*b); });
    std::uint32_t i = 1;
    for (auto& c : p) {
      std::get<2>(*c) = i++;
    }
  }

  for (const auto& c : Cs) {
    std::cout << std::setw(6) << std::setfill('0') << std::get<0>(c);
    std::cout << std::setw(6) << std::setfill('0') << std::get<2>(c) << '\n';
  }
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = int(2e5) + 7;
const int nAlpha = 'z' - 'a' + 1;

int f[N], nxt[N][nAlpha], n, trace[N];
string s;

int DP(int x) {
   if(x > n) return 0;
   if(f[x] != -1) return f[x];
   int& res = f[x];
   res = 2 * n;
   for(int i = 0; i < nAlpha; ++i) {
       if(res > DP(nxt[x][i]) + 1) {
          res = DP(nxt[x][i]) + 1;
          trace[x] = i;
       }
   }
   return res;
}

void Trace(int x) {
    if(x > n) return;
    cout << char(trace[x] + 'a');
    Trace(nxt[x][trace[x]]);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> s; n = int(s.size()); s = ' ' + s;
    fill_n(&nxt[0][0], N * nAlpha, 2 * n);
    for(int i = n - 1; i >= 0; --i) {
        for(int j = 0; j < nAlpha; ++j) nxt[i][j] = nxt[i + 1][j];
        nxt[i][s[i + 1] - 'a'] = i + 1;
    }
    memset(&f, -1, sizeof f);
    DP(0);
    Trace(0);
}


Measured memory_bytes: 22864
n = int(input())
l = []
i = 1
s = 0
for _ in range(n):
  l.append(int(input()))
#print(l)
while True:
  j = l[i-1]
  #print(j, i, l[i-1])
  s += 1
  if j == 2:
    print(s)
    exit()
  if s == n:
    print(-1)
    exit()
  i = j


Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    map<int,int> mp;
    cin >> n >> k;
    REP(i,n) {
    	int a;
    	cin >> a;
    	mp[a]++;
    }
    if ( mp.size()<=k ) {
    	puts("0");
    	return 0;
    } 
    vector<int> f;
    for ( auto &p:mp ) {
    	f.push_back(p.second);
    }
    sort(ALL(f));
    int ans=0;
    for ( int i=0; i<(int)f.size()-k; i++ ) {
    	ans+=f[i];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 10744
let rec gcd a b =
  if b = 0 then
    a
  else
    gcd b (a mod b)

let id x = x

let make_list f =
  let rec loop acc = function
    | 0 -> List.rev acc
    | n -> loop (f () :: acc) (n - 1)
  in
  loop

let n =
  Scanf.scanf "%d\n" id
let lst =
  make_list (fun () -> Scanf.scanf "%d " id) [] n
let result =
  List.fold_left gcd 0 lst

let () =
  Printf.printf "%d\n" result


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll H;
  cin >> H;

  ll x = 0;
  while (H > 0)
  {
    H /= 2;
    x++;
  }

  ll ans = (1LL << x) - 1;
  cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-


"""
https://beta.atcoder.jp/contests/abc057/tasks/abc57_1
"""

import sys
import math
from inspect import currentframe

def debug(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=sys.stderr)

N = int(input())

def F(A, B):
    return max(len(str(A)), len(str(B)))


print(min([F(A, N // A) for A in range(1, int(math.sqrt(N)) + 1) if N % A == 0]))









Measured memory_bytes: 4704
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string s;
    cin >> s;
    int c = 0;
    rep(i,s.size()) {
        if (s.at(i) == '1') {
            c++;
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
from itertools import permutations
n = int(input())
point_ls = [0] * n
for i in range(n):
    point_ls[i] = list(map(int, input().split()))
ind_ls = [i for i in range(n)]
diff_ls = []
for start, end in permutations(ind_ls, 2):
    diff = [0] * 2
    diff[0] = point_ls[end][0] - point_ls[start][0]
    diff[1] = point_ls[end][1] - point_ls[start][1]
    diff_ls.append(diff)
ans = 0
for diff in diff_ls:
    same = 0
    for diff2 in diff_ls:
        if diff == diff2:
            same += 1
    ans = max(ans, same)
print(n-ans)
    





Measured memory_bytes: 9340
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	vector<int> p(N), q;
	REP(i, N) cin >> p[i];
	q = p;
	sort(q.begin(), q.end());
	int cnt = 0;
	REP(i, N) {
		if (p[i] != q[i]) cnt++;
	}
	if (cnt == 0 || cnt == 2) cout << "YES\n";
	else cout << "NO\n";
	
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input! {
        n: i64,
        k: i64,
    }

    let ans = if n >= k * 2 - 1 { "YES" } else { "NO" };

    println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func init() {
	sc = bufio.NewScanner(os.Stdin)
	buffsize := 1000000
	buff := make([]byte, buffsize)
	sc.Buffer(buff, buffsize)
	sc.Split(bufio.ScanWords)
}

func loadint() (result int) {
	sc.Scan()
	result, _ = strconv.Atoi(sc.Text())
	return
}

func main() {
	n := loadint()
	result := (n + 110) / 111 * 111
	fmt.Println(result)
}


Measured memory_bytes: 640
/// hi_im_manh :D
#include <bits/stdc++.h>
#define reset(a,n) memset(a,0,(n+1)*sizeof(int))
#define endl "\n"
#define llmin LLONG_MIN
#define llmax LLONG_MAX
#define intmax INT_MAX
#define intmin INT_MIN
#define ll long long
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define duckman "TASK"

#define input freopen(duckman".inp", "r", stdin);
#define output freopen(duckman".out", "w", stdout);

#define nmax 22000
using namespace std;


int main()
{
    fast;
//    input;
//    output;

    int n, k;
    cin >> n >> k;
    int h[n];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    int dp[n];
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        dp[i] = intmax;
        for (int j = i-1; j >= max(0, i-k); j--) {
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n-1];
    return 0;
}
/*

*/


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

int main()
{
    long long n,k;cin>>n>>k;
    if(n>=2*k-1)
    {
        long long i;
        vector<int> a(n);
        vector<int> b(n);
        vector<int> c(n);
        for(i=0;i<n;i++)c.at(i)=k+2*n+i;
        vector<bool> use(3*n,false);
        int fir=k;
        int las=c.at(0)-fir;
        bool mode = false;
        int ch1=0;
        int ch2=2*n-1;
        for(i=0;i<n;i++)
        {
            if(!mode)
            {
                cout<<fir<<' '<<las<<' '<<c.at(i)<<endl;
                use.at(fir-k)=true;
                use.at(las-k)=true;
                fir+=2;
                las--;
                if(fir>=las)mode=true;
            }
            else
            {
                while(use.at(ch1))ch1++;
                while(use.at(ch2))ch2--;
                cout<<ch1+k<<' '<<ch2+k<<' '<<c.at(i)<<endl;
                use.at(ch1)=true;
                use.at(ch2)=true;
            }
        }
    }
    else
    {
        cout<<"-1"<<endl;
    }
}


Measured memory_bytes: 3456
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>
#include<unordered_set>

using namespace std;

/*

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

tree<pair<long long, long long>, null_type, less<pair<long long, long long>>, rb_tree_tag, tree_order_statistics_node_update> st;

*/
/*

st.find_by_order();
st.order_of_key();

*/

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] != t[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
  ll l,r;
  cin>>l>>r;
  if(r-l>=2018) {
    cout<<0<<endl;
    return 0;
  } 
  int ans=2019;
  for(int i=l;i<r;i++){
    for(int j=i+1;j<=r;j++){
      ans=min(ans,((i%2019)*(j%2019))%2019);
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
    int n; cin >> n; 
    int x[n];

    for (int i=0;i<n;i++){
        cin >> x[i];
    }

    int m; cin >> m;
    int a[m];

    for (int i=0;i<m;i++){
        cin >> a[i];
    }

    for (int i=0;i<m;i++){
        if(x[a[i]-1]+1==x[a[i]])continue;
        else if(x[a[i]-1]+1==2020)continue;
        else x[a[i]-1]+=1;
    }

    for (int i=0;i<n;i++){
        cout << x[i] << endl;
    }

}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int start,finish;
	while(cin>>start,start){
		int time[2][2];
		for(int i=0;i<2;i++)cin>>time[0][i];
		cin>>finish;
		if(start>finish)swap(start,finish);
		for(int i=0;i<2;i++)cin>>time[1][i];
		int num=0,distance[]={6,7,5,5,20,15},money[6][6]={{300,500,600,700,1350,1650},{350,450,600,1150,1500},{250,400,1000,1350},{250,850,1300},{600,1150},{500}};
		for(int i=start-1;i<finish-1;i++)num+=distance[i];
		bool kawa=0;
		for(int i=0;i<2&&!kawa&&num<41;i++)if(time[i][0]==18||time[i][0]==17&&time[i][1]>29||time[i][0]==19&&time[i][1]<31)kawa=1;
		num=money[start-1][finish-start-1];
		if(kawa){
			num/=2;
			if(num%50!=0)num+=25;
		}
		cout<<num<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

#define MOD 1000000007

vector<vector<ll>> dp0,dp1;

int main() {
	string K;
	int D;
	cin >> K >> D;
	int len = K.length();
	dp0 = vector<vector<ll>>(len, vector<ll>(D));
	dp1 = vector<vector<ll>>(len, vector<ll>(D));
	int c1 = K[0]-'0';
	rep(j, len) rep(i,D) {
		dp0[j][i%D] = 0;
		dp1[j][i%D] = 0;
	}
	rep(i,c1) dp0[0][i%D] += 1;
	dp1[0][c1%D] = 1;
	for(int i=0; i<len; i++) {
		if(i == 0) continue;
		int c = K[i] - '0';
		rep(j,10) {
			rep(s,D) {
				dp0[i][(s+j)%D] += dp0[i-1][s];
				dp0[i][(s+j)%D] %= MOD;
			}
		}
		rep(j,c) {
			rep(s,D) {
				dp0[i][(s+j)%D] += dp1[i-1][s];
				dp0[i][(s+j)%D] %= MOD;
			}
		}
		rep(s,D) {
			dp1[i][(s+c)%D] += dp1[i-1][s];
			dp1[i][(s+c)%D] %= MOD;
		}
	}
	/*rep(i,len) {
		rep(j,D) cout << setw(3) << dp0[i][j];
		cout << endl;
	}
	rep(i,len) {
		rep(j,D) cout << dp1[i][j];
		cout << endl;
	}*/
	ll ans = 0;
	ans = (ans + dp0[len-1][0]) % MOD;
	ans = (ans + dp1[len-1][0]) % MOD;
	cout << (ans+MOD-1)%MOD << endl;


  return 0;
}

Measured memory_bytes: 16640
a, b = gets.split.map(&:to_i)

def calc(num)
  return 0 if num == 0
  return 1 if num == 1
  return 3 if num == 2

  return num  if num % 4 == 0
  return num ^ (num - 1) if num % 4 == 1
  return num ^ (num - 1) ^ (num - 2) if num % 4 == 2
  0
end

puts calc(a - 1) ^ calc(b)

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

int main() 
{
    ll n, k, index;
    cin >> n >> k; k--;
    vector <ll> v(n);
    for (ll i=0; i<n; i++)
        cin >> v[i];
    ll m = INT_MAX;
    for (ll i=0; i<v.size()-k; i++)
        m = min(m, v[i+k]-v[i] + min(abs(v[i+k]), abs(v[i])));
    cout << m;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
using namespace std;
using ll = long long;

int main(){
    char c;
    cin>>c;
    if(c>='A'&&c<='Z')cout<<"A"<<endl;
    else cout<<"a"<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    ll x;
    cin >> x;

    ll ammount=100;
    ll t=0;
    while (ammount<x)
    {
        ammount=ammount*1.01;
        t++;
    }
    cout << t << endl;

    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll D,N;
	cin >> D >> N;
	if(N>=100)N++;
	cout << N ;
	FOR(i,0,D){
		cout << "00";
	}
	cout << endl;
}

Measured memory_bytes: 256
import fs = require('fs');
if(process.argv[1].match(/Main.js$/)) { console.log(main(fs.readFileSync('/dev/stdin', 'utf8').split(/[\r\n\t ]/))); }

export function main(strings: string[]): string {
	const ret: any[] = [];
	const numbers = strings.map(Number);

	const N = numbers.shift() || 0;
	const M = numbers.shift() || 0;
	const C = numbers.shift() || 0;

	const Bs: number[] = [];
	const As: number[][] = [];

	for(let i=0; i<M; i++) {
		Bs.push(numbers.shift() || 0);
	}

	for(let i=0; i<N; i++) {
		const A: number[] = [];
		for(let j=0; j<M; j++) {
			A.push(numbers.shift() || 0);
		}
		As.push(A);
	}

	let answer = 0;
	for(let i=0; i<N; i++) {
		let sum = 0;
		for(let j=0; j<M; j++) {
			sum += As[i][j] * Bs[j];
		}
		if(sum + C > 0) {
			answer++;
		}
	}

	ret.push(answer);

	return ret.join('\n') + '\n';
}

Measured memory_bytes: 9548
#include <iostream>

using namespace std;

int main(){
  int n, k, ans = 0;
  int l[51];
  cin >> n >> k;
  for ( int i = 0; i < n; i++){
    cin >> l[i];
  }
  
  for ( int i = 0; i < n - 1; i++){
    for (int j = n-1; j > i; j--){
      if(l[j] < l[j - 1]){
        int x = l[j];
        l[j] = l[j - 1];
        l[j - 1] = x;
      }
    }
  }
  
  for ( int i = n - 1; i >= n - k; i--){
    ans += l[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
 
ll findgcd(ll,ll);
 
int main(){
  int i;
  ll N, gcd;
  cin >> N;
  vector<ll> hp(N);
  for(i=0;i<N;i++) {
    cin >> hp[i];
    gcd = findgcd(gcd,hp[i]);
  }
  cout << gcd << endl;
  return 0;
}

ll findgcd(ll a,ll b){
  ll tmp,r;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  if(b==0) return a;
  // 0とのgdcはその数そのものと定義
  
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

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

  int c=0;
  int res;
  for (int i = 100; 1 <= i; i--) {
    if(a%i==0 && b%i==0){
      c++;
    }
    if(c==k){
      res = i;
      break;
    }
  }

  cout << res << endl;
  
  return 0;
}


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

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

    static class abc162_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String N = in.next();
            String nar[] = N.split("");
            for (String val : nar) {
                if (val.compareTo("7") == 0) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
        }

    }
}



Measured memory_bytes: 35768
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

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

	LL n, a, b;
	cin >> n >> a >> b;
	LL len = a + b;
	LL whole = n / len, rest = n % len;
	LL ans = whole * a + min(rest, a);
	cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) 
{ v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i]; }
template<class T, class U> void read_n(vector<pair<T, U>>& v, size_t n)
{ v = vector<pair<T, U>>(n); 
  for (lli i=0; i<n; ++i) cin >> v[i].first >> v[i].second; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n;
vector<pair<lli, lli>> p, q;
int main() {
  cin >> n;
  init_n(p, n);
  for (lli i=0; i<n; ++i) cin >> p[i].first >> p[i].second;
  bool par = (p[0].first + p[0].second) % 2 == 0;
  for (lli i=1; i<n; ++i) {
    if (((p[i].first + p[i].second) % 2 == 0) != par) {
      cout << -1 << endl; return 0;
    }
  }
  lli arms = par ? 34 : 33;
  cout << arms << '\n';
  for (lli b=32; b>0; --b) {
    cout << (1ll << b) << ' ';
  }
  if (par) cout << "1 1\n"; else cout << "1\n"; 
  for (lli i=0; i<n; ++i) {
    lli x = p[i].first, y = p[i].second;
    lli v[2]; v[0] = x + y, v[1] = x - y;
    lli av[2][33];
    for (lli i=0; i<=1; ++i) {
      for (lli b=32; b>0; --b) {
	lli m = 1ll<<b;
	if (v[i] > 0) {
	  av[i][b] = 1; v[i] -= m;
	} else {
	  av[i][b] = -1; v[i] += m;
	}
      }
    }
    for (lli b=32; b>0; --b) {
      if (av[0][b] == 1 && av[1][b] == 1) cout << 'R';
      if (av[0][b] == 1 && av[1][b] == -1) cout << 'U';
      if (av[0][b] == -1 && av[1][b] == -1)  cout << 'L';
      if (av[0][b] == -1 && av[1][b] == 1) cout << 'D';
    }
    lli xx = (v[0] + v[1]) / 2, yy = (v[0] - v[1]) / 2;
    for (lli i=(par ? 2 : 1); i>0; --i) {
      if (xx > 0) { cout << 'R'; xx -= 1; }
      else if (xx < 0) { cout << 'L'; xx += 1; }
      else if (yy > 0) { cout << 'U'; yy -= 1; }
      else { cout << 'D'; yy += 1; }
    }
    cout << '\n';
  }

  
  return 0;
}

/*
 * U: (u - t) / 2
 * R: (u + t) / 2
 */


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    X, Y = MI()

    sm = X * 4
    while X >= 0:
        if sm == Y:
            print('Yes')
            return
        sm -= 2
        X -= 1
    print('No')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9240
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    h, w = MI()
    cnt = 0
    for i in range(h):
        l = list(input())
        for j in range(w):
            if l[j] == '#':
                cnt = cnt + 1
    if h + w - 1 == cnt:
        print('Possible')
    else:
        print('Impossible')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    b = 10 * b + c;
    string ans = (b % 4 == 0) ? "YES" : "NO";
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int H,W,N;
int main(){
  cin>>W>>H>>N;
  vector<vector<int>>G(H+1);
  vector<set<int>>A(H+1);
  for(int i=0;i<=H;i++){
  G[i].push_back(W);
    A[i].insert(W);
  }for(int i=0;i<N;i++){
  int x,y;cin>>x>>y;x--;y--;
    G[y].push_back(x);
    A[y].insert(x);
  }for(int i=0;i<H;i++)
    sort(G[i].begin(),G[i].end());
  int a=0;int ans=W;
  for(int i=0;i<H;i++){
  auto itr=upper_bound(G[i].begin(),G[i].end(),a);
    int k=distance(G[i].begin(),itr);if(G[i][k]<ans)ans=G[i][k];
    bool x=false;int b=a;
    for(int j=b+1;j<G[i][k];j++)
      if(!A[i+1].count(j)){a=j;x=true;break;}
    if(!x || ans<a)
      break;
    }cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 42780
#include<stdio.h>
int main ()
{
  int time=0;
  int biscuit=0;
  int t_limit=0;
  int i=0;
  int b_cnt=0;
  scanf("%d%d%d",&time,&biscuit,&t_limit);
  for(i=1;i*time<t_limit+0.5;i++)
  {
    b_cnt+=biscuit;
  }
  printf("%d",b_cnt);
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  int sum = 0;
  vector<int> v(s.size());
  for(int i=0; i<s.size(); i++) {
    string t;
    t = s[i];
    v[i] = stoi(t);
    sum += v[i];
  }
  if(stoi(s)%sum==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
#define show(x) cout << #x << " is " << x << "\n";
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

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

ll k, a, b;
cin>>k>>a>>b;
ll flag=0;
for(int i=a;i<=b;i++){
	if(i%k==0) {
		flag=1;
		break;
	}
}
	if(flag) cout<<"OK";
	else cout<<"NG";

	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    // for(int i=0;i<n;i++)
    //     cout<<a[i]<<" ";
    double dp[n+1][n+1];
    dp[0][0] = 1.0;
    for(int i=1;i<=n;i++)
        dp[0][i] = 0.0;
    for(int i=1;i<=n;i++)
        dp[i][0] = dp[i-1][0]*(1-a[i-1]);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j] = dp[i-1][j]*(1-a[i-1]) + dp[i-1][j-1]*a[i-1];
        }
    }
    // for(int i=0;i<=n;i++)
    // {
    //     for(int j=0;j<=n;j++)
    //         cout<<dp[i][j]<<" ";
    //     cout<<endl;    
    // }
    double ans = 0.0;
    for(int i=(n+1)/2;i<=n;i++)
        ans += dp[n][i];
    printf("%.10g", ans);
}

Measured memory_bytes: 70528
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    string S;
    int K;
    cin >> S >> K;
    int cnt = 0;
    for(int i = 0; i < K; i++) {
        if(S[i] != '1'){
            cnt++;
            cout << S[i] << endl;
            break;
        }
    }
    if(cnt == 0) {
        cout << S[K-1] << endl;
    }
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
  while(1){
    
    int x;cin >> x;
    if(x==1) break;
    vector<int> a,b;
    for(int i=8;i<=300000;i+=7){
      a.push_back(i);
    }//7n-6の計算
    for(int i=6;i<=300000;i+=7){
      b.push_back(i);
    }//7n-1の計算
    
    bool flag;
    bool aflag = true;
    auto iter_a = upper_bound(a.begin(),a.end(),x/2);//x/2以上のイテレータを渡す
    auto iter_b = upper_bound(b.begin(),b.end(),x/2);//x/2以上のイテレータを渡す
    
    vector<int> ans;
    for(auto i = b.begin();i!=iter_b;i++){
      if(x%(*i)==0){
        flag = true;
        for(auto &k:ans){
          if((*i)%k==0){
            flag = false;
            break;
          }//もし割り切れてもansの中のやつで割り切れるならbreak
        }
        if(flag){ans.push_back((*i));aflag = false;}
      }
    }//bの計算
    
    for(auto i = a.begin();i!=iter_a;i++){
      if(x%(*i)==0){
        flag = true;
        for(auto &k:ans){
          if((*i)%k==0){
            flag = false;
            break;
          }//もし割り切れてもansの中のやつで割り切れるならbreak
        }
        if(flag){ans.push_back((*i));aflag = false;}
      }
    }//aの計算
    sort(ans.begin(),ans.end());
    if(aflag){
      auto it = std::find(a.begin(), a.end(), x);    //  最初の要素5へのイテレータを返す
      if( it != a.end() ) {     // 発見した場合
        ans.push_back(x);
      }
      auto itr = std::find(b.begin(), b.end(), x);    //  最初の要素5へのイテレータを返す
      if( itr != b.end() ) {     // 発見した場合
        ans.push_back(x);
      }
    }//もし素因数がなかったら自分自身が素因数か確かめて、もし素因数ならansへ
    
    cout << x << ": ";
    rep(i,ans.size()-1) cout << ans[i] << " ";
    cout << ans[ans.size()-1] << endl;
  }
}



Measured memory_bytes: 3312
import itertools
n = int(input())
a = list(map(int, input().split()))

total = sum(a)
b = list(itertools.accumulate(a))

ans = pow(10, 12)
for i in range(n-1):
    ans = min(abs(b[i] - (total - b[i])), ans)

if n == 2:
    print(abs(a[0] - a[1]))
    exit()
print(ans)

Measured memory_bytes: 86864
def resolve():
	# N: 足場の個数, K: 1回で右にジャンプできる足場の数
	N, K = map(int, input().split())
	# h: 各足場の高さ
	# dpテーブル宣言: dp[今いる足場の番号-1]=[最小コスト, 足場の高さ]
	dp = [
		[float('inf'), int(h_)]
		for h_ in input().split()
	]
	dp[0][0] = 0
	dp[1][0] = abs(dp[0][1] - dp[1][1])

	# k個左の足場からジャンプして来た時の最小コストを調べる
	for n in range(2, N):
		height_current = dp[n][1]
		dp[n][0] = min(
			[
				abs( height_current - height ) + cost
				for cost,height in dp[max(0, n-K):n]
			]
		)
	print(dp[N-1][0])

resolve()

Measured memory_bytes: 24980
/// You just can't beat the person who never gives up
/// ICPC next year

///#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+5 ;

int n ,m ,k ;
int r1 ,c1 ,r2 ,c2 ;
int dirr[] = {-1,0,0,1};
int dirc[] = {0,-1,1,0};
vector<vector<char>> str ;
vector<vector<vector<pair<int,int>>>> dis_rem ;
bool cmp(pair<int,int> a,pair<int,int> b){
    if(a.first!=b.first) return a<b;
    return a>b ;
}
int dijkstra(){
    --r1 ,--c1 ,--r2 ,--c2 ;
    for(int i=0;i<4;++i) dis_rem[r1][c1][i] = {0,0} ;
    priority_queue<pair<pair<pair<int,int>,int>,pair<int,int>>> pq ;
    pq.push({{{0,0},0},{r1,c1}});
    while(pq.size()) {
        int r = pq.top().second.first;
        int c = pq.top().second.second;
        int dir = pq.top().first.second;
        pq.pop();
        for (int i = 0; i < 4; ++i) {
            int rr = r + dirr[i];
            int cc = c + dirc[i];
            if (rr < 0 || rr >= n || cc < 0 || cc >= m || str[rr][cc]=='@') continue;
            if (i != dir || dis_rem[r][c][dir].second == 0) {
                int rem = k - 1;
                int cst = 1 + dis_rem[r][c][dir].first;
                if (cmp({cst, rem}, dis_rem[rr][cc][i])) {
                    dis_rem[rr][cc][i] = {cst, rem};
                    pq.push({{{-cst, rem}, i},
                             {rr,          cc}});
                }
            } else {
                int rem = dis_rem[r][c][dir].second - 1;
                int cst = dis_rem[r][c][dir].first;
                if (cmp({cst, rem}, dis_rem[rr][cc][i])) {
                    dis_rem[rr][cc][i] = {cst, rem};
                    pq.push({{{-cst, rem}, i},
                             {rr,          cc}});
                }
            }
        }
    }
    int inf = 1e9+5 ;
    int mn = inf ;
    for(int i=0;i<4;++i) mn = min(mn ,dis_rem[r2][c2][i].first);
    return mn<inf ? mn : -1 ;
}
bool Never_give_up(){
    cin >> n >> m >> k >> r1 >> c1 >> r2 >> c2 ;
    str = vector<vector<char>> (n,vector<char>(m,0));
    dis_rem = vector<vector<vector<pair<int,int>>>> (n ,vector<vector<pair<int,int>>>(m ,vector<pair<int,int>>(4,{1e9+5,0}))) ;
    for(int i=0;i<n;++i) for(int j=0;j<m;++j) cin >> str[i][j] ;
    cout << dijkstra() ;
    return 0;
}
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt" ,"r" ,stdin);
    freopen("output.txt" ,"w" ,stdout);
#endif
    std::ios::sync_with_stdio(0);
    cin.tie(0) ,cout.tie(0);
    int t = 1 ;
    //cin >> t ;
    while(t--){
        Never_give_up();
    }
    return 0;
}

Measured memory_bytes: 144776
from collections import deque
n, q = [int(x) for x in input().split()]
L = [ deque() for _ in range(n) ]
for _ in range(q):
    c, t, x = [int(x) for x in (input()+" 0").split()][:3]
    if c == 0:
        L[t].append(x)
    elif c == 1:
        print( " ".join(map(str,L[t])))
    else:
        s,t = t, x
        if L[s]:
            if L[t]:
                if len(L[s]) == 1:
                    L[t].append(L[s][0])
                elif len(L[t]) == 1:
                    L[s].appendleft(L[t][0])
                    L[t] = L[s]
                else:
                    L[t].extend(L[s])
            else:
                L[t] = L[s]
            L[s] = deque()



Measured memory_bytes: 61688
#include <bits/stdc++.h>
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;

const int INF = int(1e9 + 7);
typedef long long       ll;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;

ll dp[4][40], D[40][40], M[510][510];

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    int n, c;
    cin >> n >> c;
    for (int i = 0; i < c; i++)
    {
    	for (int j = 0; j < c; j++)
    	{
    		cin >> D[i][j];
    	}
    }
    for (int i = 0; i < n; i++)
    {
    	for (int j = 0; j < n; j++)
    	{
    		cin >> M[i][j];
    		M[i][j]--;

    		for (int k = 0; k < c; k++)
    		{
    			dp[ (i+j)%3 ][ k ] += D[ M[i][j] ][ k ];
    		}
    	}
    }
    
    ll res = (1LL << 60);
    for (int i = 0; i < c; i++)
    {
    	for (int j = 0; j < c; j++)
    	{
    		for (int k = 0; k < c; k++)
    		{
    			if (i == j || i == k || j == k) continue;
    			res = min( res, dp[0][i] + dp[1][j] + dp[2][k] );
    		}
    	}
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2304
n, t = map(int, input().split())
t_list = list(map(int, input().split()))

ans = 0

now = t_list[0]
end = now + t

for i in range(1, n):
    if end < t_list[i]:
        ans += (end - now)
    else:
        ans += (t_list[i] - now)
    now = t_list[i]
    end = now + t

ans += (end - now)

print(ans)

Measured memory_bytes: 26708
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder {
    class _042c {
        static void Main() {
            string[] nk = Console.ReadLine().Split(' ');
            int n = int.Parse(nk[0]);
            int k = int.Parse(nk[1]);
            string[] input = Console.ReadLine().Split(' ');
            int[] x = new int[k];
            for(int i = 0;i < k;i++) {
                x[i] = int.Parse(input[i]);
            }
            int result = n;
            while (true) {
                string s = result + "";
                bool isok = true;
                for(int i = 0; i < k; i++) {
                    if (s.Contains(x[i] + "")) {
                        isok = false;
                        break;
                    }
                }
                if (isok) {
                    break;
                }
                result++;
            }
            Console.WriteLine(result + "");
        }
    }
}

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

string s;

int main(){
  cin >> s;
  int n = s.size();
  string res = "";
  rep(i, n){
    res += 'x';
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MP make_pair
using namespace std;
typedef long long ll;
template<typename T>
inline T read(T&x){
    x=0;int f=0;char ch=getchar();
    while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
    while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x=f?-x:x;
}
const int N=300+5;
int n,i,j,h,w,d,q,l,r,a[N][N];
ll res[N*N];
map<int,pair<int,int> >mp;
/*ll dfs(int l,int r,int sx,int sy,int tx,int ty){
    if (res.find(MP(l,r))!=res.end()) return res[MP(l,r)];
    if (l==r) return 0;
    int tmp=l+d;
    int xx=mp[tmp].first,yy=mp[tmp].second;
   // cout<<xx<<" "<<yy<<endl;
    ll ans=dfs(tmp,r,xx,yy,tx,ty);
    res[MP(l,tmp)]=1LL*abs(xx-sx)+1LL*abs(yy-sy);
    res[MP(tmp,r)]=ans;
    return ans+1LL*abs(xx-sx)+1LL*abs(yy-sy);
}*/
int main(){
    read(h),read(w),read(d);
    for (i=1;i<=h;i++){
        for (j=1;j<=w;j++){
            read(a[i][j]);
            res[a[i][j]]=-1;
            mp[a[i][j]]=MP(i,j);
        }
    }
    for (i=1;i<=h*w;i++)if(res[i]==-1){
        int prex=mp[i].first,prey=mp[i].second;
        res[i]=0;
        for (j=i+d;j<=h*w;j+=d){
            int tx=mp[j].first,ty=mp[j].second;
            res[j]=res[j-d]+1LL*abs(tx-prex)+1LL*abs(ty-prey);
            prex=tx,prey=ty;
        }
    }
    for (read(q);q--;){
        read(l),read(r);
        printf("%lld\n",res[r]-res[l]);
    }
    return 0;
}


Measured memory_bytes: 7808
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  char s[3], _;
  int a = 0, b = 0, ab = 0, o = 0;
  while (scanf("%d,%s", &_, &s) != EOF) {
    if (s[0] == 'A' && s[1] == 'B') ab++;
    else if (s[0] == 'A') a++;
    else if (s[0] == 'B') b++;
    else o++;
  }
  cout << a << endl;
  cout << b << endl;
  cout << ab << endl;
  cout << o << endl;
  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <cctype>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

int main() {
	Int n,m,cnt; cin >> n>>m;
	//vector<int>l(m), r(m);
	int minz = 0, maxx = 1000000, l, r;
	
	for (int i = 0; i < m; i++) {
		cin >> l >> r;
		minz = max(minz, l);
		maxx = min(maxx, r);
	}

	cout <<(Int) max(maxx - minz + 1,0);

	//cout << cnt;

	cout << endl;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
	class _062A
    {
        static void Main()
        {
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            
			var toshi = arr[0];
			var miti = arr[1];
			
			int[] ans = new int[toshi];
			int[] point = new int[1];
			for(var i =1; i <= miti; i++)
			{
				point = Console.ReadLine().Split().Select(int.Parse).ToArray();
				ans[point[0] - 1]++;
				ans[point[1] - 1]++;
			}
			
			foreach(var x in ans)
				Console.WriteLine(x);
        }
    }

Measured memory_bytes: 13396
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm> // sort
#include <map>       // pair
#include <vector>
using namespace std;

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


const int INF = 100100100;
const long long int MOD = (int)1e9 +7;
const double EPS = 1e-9; 

typedef long long int ll;

//char in[120];
//ex. pair
//pair<pair<string,int>,int> p[110];


int main(){
    int n;cin>>n;
    cout << 3*pow(n,2) << endl;
    return 0;    
}

Measured memory_bytes: 256
//IncubatorMan
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 ll MOD = (ll)(1e9+7);

ll bigMod(ll base, ll exp, ll res=1){
    if(exp==0) return res;
    if(exp&1){
        res*=base;
        res%=MOD;
    }
    base = (base*base)%MOD;
    return bigMod(base,exp/2,res);
}

void solve(){
    ll n,k;
    cin>>n>>k;
    // number of element of a sequence
    // total number k
    ll ans=0;
    ll arr[k+4];
    for(ll i= k;i>0;i--){
        arr[i] = bigMod(k/i,n);
        ll t = arr[i];
        for(ll j= i*2;j<=k;j+=i){
            t-= arr[j];
            if(t<0) t+=MOD;
            t%MOD;
        }
        ll x = (t*i)%MOD;
        ans = (ans+x)%MOD;
        arr[i]=t;
    }
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        while(test--){
            solve();
        }
    return 0;
}

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

int main()
{
     int n,i,j;
     cin>>n;
     int cost[n+1];
     int dp[n+1] = {INT_MAX};
     //cout<<dp[0];
     for(i = 1; i <= n ; i++)
          cin>>cost[i];

     dp[1]=0; //cost of moving from 1st to 1st position is 0
     dp[2]=abs(cost[2]-cost[1]); //cost moving from position 1 to 2 is abs(c[2]-c[1])

     for(i = 3; i <= n; i++)
     {
         dp[i] = min(dp[i-1]+abs(cost[i]-cost[i-1]),dp[i-2]+abs(cost[i]-cost[i-2]));
         //finding the minimum cost between position i to (i-1) and (i-2)
     }
     cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    string s; cin >> s;
    if (s[2]==s[3] && s[4]==s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
r,g,b,n = map(int,input().split())
cou  = 0
for i in range(int(n//r)+1):
  for j in range(int((n-i*r)//g)+1):
    if (n-r*i-g*j)%b==0:
      cou += 1
 # print(i,j,cou)
print(cou)

Measured memory_bytes: 2940