akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define sz(a) ((int)(a).size())
#define pii pair<int,int>
#define R(a) scanf("%d",&a)
#define per(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);i++)
#define rix(i,x) for(int i=last[x];i;i=pre[i])
const double eps=1e-8;
int sgn(double x){return x<-eps?-1:x>eps;}
int Mn(int&a,int b){if(a>b){a=b;return 1;}return 0;}
int Mx(int&a,int b){if(a<b){a=b;return 1;}return 0;}
ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
ll inv(ll a,ll b){return a==1?1:(1-b*inv(b%a,a))/a;}
ll exg(ll a,ll b,int&x,int&y){!a?x=0,y=1:(exg(b%a,a,y,x),x-=b/a*y);}
ll pow(ll a,ll b,ll M) {ll t=1;for(a%=M;b;b>>=1){if(b&1)t=t*a%M;a=a*a%M;}return t;}
int main()
{
	int a,b,c,i=0;cin>>a>>b>>c;
	if(a%2==0&&a==b&&a==c){
		puts("-1");return 0;
	}
	while(true){
		if(a%2||b%2||c%2)break;
		int p=(b+c)/2,q=(a+c)/2,r=(a+b)/2;
		a=p;b=q;c=r;
		i++;
	}
	cout<<i<<endl;
}














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")
    };
}

use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn readu() -> usize {
    read::<usize>()
}

#[allow(dead_code)]
fn readi() -> i32 {
    read::<i32>()
}

use std::collections::VecDeque;

fn lower_bound<T: Ord>(deq: &VecDeque<T>, v: T) -> usize {
    let mut lower = 0;
    let mut upper = deq.len();
    let mut res = deq.len();
    while lower < upper {
        let cur = (lower + upper) / 2;
        if deq[cur] >= v {
            res = cur;
            upper = cur;
        } else {
            lower = cur + 1;
        }
    }
    return res;
}

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut deq: VecDeque<usize> = VecDeque::new();
    for &ai in &a {
        let i = lower_bound(&deq, ai);
        if i == 0 {
            deq.push_front(ai);
        } else {
            deq[i - 1] = ai;
        }
    }
    println!("{}", deq.len());
}


Measured memory_bytes: 6396
import java.util.Scanner;

public class Main {

    private static int A, B, C;

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

        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        System.out.println(solve());
    }

    private static int solve() {
        int ans = 0;
        while(diff() >= 2 ) {
            plus2();
            ans++;
        }

        int cm = countMax();
        if( cm == 3 ) {
            return ans; // ok
        } else if( cm == 2 ) {
            return ans + 2; // 4 4 3 みたいなケース
        } else {
            return ans + 1; // 4 3 3 みたいなケース
        }
    }

    private static void show() {
        System.out.println( A + " " + B + " " + C );
    }

    private static int countMax() {
        int max = Math.max(Math.max(A, B), C);
        int cnt = 0;
        if( max == A ) cnt++;
        if( max == B ) cnt++;
        if( max == C ) cnt++;
        return cnt;
    }

    private static int diff() {
        int max = Math.max(Math.max(A, B), C);
        int min = Math.min(Math.min(A, B), C);
        return max - min;
    }

    private static void plus2() {
        int min = Math.min(Math.min(A, B), C);
        if( min == A ) {
            A = A+2;
        } else if( min == B ) {
            B = B+2;
        } else {
            C = C+2;
        }
    }
}


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  string s,t;cin>>s>>t;
  string p;
  rep(i,0,n)p.PB(s[i]),p.PB(t[i]);
  cout<<p<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())

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

  int n;
  ll y;
  cin >> n;
  cin >> y;

  int fuku = -1;
  int higu = -1;
  int nogu = -1;

  bool foundAns = false;
  REP(i, n+1) {
    REP(j, n-i+1) {
      // cout << i << " " << j << " => " << (y - (i * 10000 + j * 5000)) / 1000 << endl;
      if((y - (i * 10000 + j * 5000)) / 1000 == n-i-j) {
        foundAns = true;
        fuku = i;
        higu = j;
        nogu = (y - (i * 10000 + j * 5000)) / 1000;
        break;
      }
    }
    if(foundAns) {
      break;
    }
  }

  cout << fuku << " " << higu << " " << nogu << endl;
  return 0;
}


Measured memory_bytes: 256
a=str(input())
b=str(input())
c=str(input())
s=len(a)+len(b)+len(c)
z=a[0]
for i in range(s):
    if z=='a':
        if a=='':
            print('A')
            break
        else:
            z=a[0]
            a=a[1:]
    elif z=='b':
        if b=='':
            print('B')
            break
        else:
            z=b[0]
            b=b[1:]
    elif z=='c':
        if c=='':
            print('C')
            break
        else:
            z=c[0]
            c=c[1:]

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if(u==s) a--;
    else b--;
    cout<<a<<" "<<b<<endl;
    
    return 0;
}

Measured memory_bytes: 256
from sys import stdin


def main():
    N, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
    result = [0] * (N - 1)
    for left in range(1, N):
        for right in range(left + 1, N + 1):
            if (left <= X) and (Y <= right):
                x = (X - left) + 1 + (right - Y)
            elif (left <= X) and (X <= right <= Y):
                x = (X - left) + min((right - X), (Y - right) + 1)
            elif (X <= left <= Y) and (Y <= right):
                x = min((Y - left), (left - X) + 1) + (right - Y)
            elif (X <= left <= Y) and (X <= right <= Y):
                x = min((right - left), (left - X) + (Y - right) + 1)
            else:
                x = right - left
            result[x - 1] += 1
    print(*result, sep='\n')


if __name__ == "__main__":
    main()


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

int main(){
  int64_t a,b,c;
  cin >> a >> b >> c;
  if(a%2==1&&b%2==1&&c%2==1)
    cout << min({a*b,b*c,c*a}) << endl;
  else
    cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3628
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)


class UF_tree:
    def __init__(self, n):
        self.root = [-1] * (n + 1)
        self.rank = [0] * (n + 1)

    def find(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.rank[x] < self.rank[y]:
            self.root[y] += self.root[x]
            self.root[x] = y
        else:
            self.root[x] += self.root[y]
            self.root[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def size(self, x):
        return -self.root[self.find(x)]


N, Q = map(int, input().split())
uf = UF_tree(N + 1)
for _ in range(Q):
    t, u, v = map(int, input().split())
    if t == 0:
        uf.unite(u, v)
    else:
        if uf.isSame(u, v):
            print(1)
        else:
            print(0)

Measured memory_bytes: 13640
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int dx8[8]={1,0,-1,0,1,1,-1,-1};
int dy8[8]={0,1,0,-1,1,-1,1,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll A,B,C;
        cin>>A>>B>>C;
        ll s=A+B+C;
        ll m=max({A,B,C});
        if(s%2==m%2){
            cout<<(m*3-s)/2<<endl;
        }else{
            cout<<(m*3+3-s)/2<<endl;
        }
    }

Measured memory_bytes: 256
from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = float('inf')
S = [-INF] + list(int(input()) for _ in range(A)) + [INF]
T = [-INF] + list(int(input()) for _ in range(B)) + [INF]
for _ in range(Q):
    x = int(input())
    i = bisect_right(S,x)
    j = bisect_right(T,x)
    d = INF
    for s in [S[i-1], S[i]]:
        for t in [T[j-1], T[j]]:
            d1 = abs(s-x) + abs(s-t)
            d2 = abs(t-x) + abs(s-t)
            d = min(d, d1, d2)
    print(d)



Measured memory_bytes: 17344
#include<cstdio>
#include<cstring>

using namespace std;

char s[100]; 

int main() {
	scanf("%s", s+1);
	for(int i = 1; i < strlen(s+1); ++i)
	if(s[i] == 'A' && s[i+1] == 'C') {puts("Yes"); return 0;}
	puts("No");
	return 0;
}

Measured memory_bytes: 128
#![allow(non_snake_case)]

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn read_vec() -> Vec<i32> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().unwrap())
        .collect()
}

fn main() {
    let n: i32 = read_line().parse().unwrap();
    let p = read_vec();
    let mut ans = 0;
    for i in 0..(n-2) as usize {
        if (p[i+2] - p[i+1]) * (p[i+1] - p[i]) > 0 {
            ans += 1
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll K;
ll X;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> K;
    cin >> X;
    solve();
}

// 1 <= K <= 100
// 0 <= X <= 100
// 入力中の値はすべて整数である。

// ll K, ll X
// 黒で塗られている石が置かれている可能性のある座標をすべて、空白で区切って小さい順に出力せよ。
void solve(){
    repe(i,-(K-1),K-1){
        if(i>-(K-1))cout<<' ';
        cout<<X+i;
    }
    cout<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		char[] alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
//		n -= 1;
		String s = "";
		do {
			n -= 1;
			int z = (int)((n)%26);
			s = alphabet[z] + s;
			n /= 26;
		}while(n>0);
		System.out.println(s);
	}

}


Measured memory_bytes: 39324
#include<iostream>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>
//#include<chrono>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))


template <typename T>
void out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

template<typename T>
string ntos( T i ) {
  ostringstream s ;
  s << i ;
  return s.str() ;
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,i = 0;
  string s;
  vector<int> v;
  vector<string> vs;
  while(1){
    cin >> n >> s;
    v.pb(n);
    vs.pb(s);
    if(s == "="){
      break;
    }
  }
  while(1){
    if(vs[i] == "="){
      break;
    }
    else if(vs[i] == "+"){
      v[i+1] += v[i];
    }
    else if(vs[i] == "-"){
      v[i+1] = v[i] - v[i+1];
    }
    else if(vs[i] == "*"){
      v[i+1] *= v[i] ;
    }
    else if(vs[i] == "/"){
      v[i+1] = floor(v[i] / v[i+1]);
    }
    ++i;
  }
  cout <<  v[v.size()-1] << endl;

  return 0;
}

Measured memory_bytes: 1240
#include <functional>
#include <list>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <deque>
#include <stack>
#include <cassert>
using namespace std;
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define ALL(x) (x).begin(),(x).end()
#define CASET2 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d:\n", case_n++) : 0), ___T-- > 0)
#define CASET1 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d: ", case_n++) : 0), ___T-- > 0)
#define CASET int ___T; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#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 PER1(i,a,b) for(int i=(a);i>=(b);i--)
#define REPL(i,x) for(int i=0;x[i];i++)
#define PER(i,n) for(int i=(n)-1;i>=0;i--)
#define RI1(x) scanf("%d",&x)
#define RI2(x,y) RI1(x), RI1(y)
#define RI3(x,y...) RI1(x), RI2(y)
#define RI4(x,y...) RI1(x), RI3(y)
#define RI5(x,y...) RI1(x), RI4(y)
#define RI6(x,y...) RI1(x), RI5(y)
#define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define RI(argv...) GET_MACRO(argv, RI6, RI5, RI4, RI3, RI2, RI1)(argv)
#define DRI(argv...) int argv;RI(argv)
#define WRI(argv...) while (RI(argv) != EOF)
#define DWRI(x...) int x; WRI(x)
#define RS(x) scanf("%s",x)
#define MP make_pair
#define PB push_back
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define X first
#define Y second
#define V(x) vector<x >

typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

void print(int i) { printf("%d", i); }
void print(LL i);
template<class T> void PI(T i) { print(i); puts(""); }
template<class T> void PIS(T i) { print(i); printf(" "); }

template<class T>
void PV(T const &v, int N) {
    REP(i, N) {
        print(v[i]);
        printf("%c", i == N-1 ? '\n' : ' ');
    }
}

template<class T> void PV(T const &v) { PV(v, SZ(v)); }

template<class T, class S> bool has_bit(T mask, S i) { return (mask >> i) & 1; }
long long shift(int i) { return 1ll << i; }

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
int popcount(int x) { return __builtin_popcount(x); } 
int popcount(long long x) { return __builtin_popcountll(x); } 

#include <unordered_set>
#include <unordered_map>
#define EB emplace_back
#define RL(x) scanf("%lld", &(x))
#define PL(x) printf("%lld\n", x)
#define DRL(x) LL x; RL(x)

int main() {
    DRI(N, H, W);
    PI((N - H + 1) * (N - W + 1));
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N, A, B;

int main() {
    cin >> N >> A >> B;

    cout << min(N * A, B) << endl;
    return 0;
}


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

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n ;
	cin>>n ;
	int x , place[n] ;
	for(int i = 0 ; i < n ; ++i)
	{
		cin>>x ;
		x-- ;
		place[x] = i ;
	}
	for(int i = 0 ; i < n ; ++i)
		cout<<40000 * (i+1)<<" " ;
	cout<<"\n" ;
	for(int i = 0 ; i < n ; ++i)
		cout<<40000 * (n-i) + place[i]<<" " ;
	return 0 ;
}

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

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

    for(int i = 0; i < 3; i++) {
        if(s[i] == '1') {
            std::cout << 9;
        } else {
            std::cout << 1;
        }
    }
    std::cout << std::endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def POW(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x
    elif y % 2 == 0:
        return POW(x, y // 2) ** 2 % MOD
    else:
        return POW(x, y // 2) ** 2 * x % MOD
def mod_factorial(x, y): return x * POW(y, MOD - 2) % MOD
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from collections import Counter

def main():
    A, B = LI()
    a, b = max(A, B), min(A, B)
    ans = a
    a -= 1
    ans += max(a, b)

    return ans

print(main())

Measured memory_bytes: 3316
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  scanf("%d", &n);
  map<int, int> cnt;
  int64 sum = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
    sum += x;
  }
  int m;
  scanf("%d", &m);
  while(m--) {
    int b, c;
    scanf("%d%d", &b, &c);
    if (cnt.count(b)) {
      sum -= 1LL * cnt[b] * b;
      sum += 1LL * cnt[b] * c;
      cnt[c] += cnt[b];
      cnt.erase(b);
    }
    printf("%lld\n", sum);
  }
  return 0;
}


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

typedef long long ll;

const int N = 2000006;

ll a[N];
bool b[N];
pair<ll,ll> p[N];
ll v[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	cin>>n;
	ll ans = 1000;
	vector<ll>v;
	a[0]  = 1000000;
	a[n+1] = 0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	
	for(int i=1;i<n;i++){
		if(a[i] <= a[i-1] && a[i] <= a[i+1])b[i] = true;
		if(a[i] >= a[i-1] && a[i] >= a[i+1])b[i] = true;
		//cout<<b[i]<<" ";
	}
	//cout<<endl;
	ll mn = 1000,pr = 0;
	for(int i=1;i<=n;i++){
		if(b[i]){
			if(a[i] <= a[i-1] && a[i] <= a[i+1]){
				pr += mn/a[i];
				mn -= (a[i])*(mn/a[i]);
			}else{
				mn += pr*a[i];
				pr = 0;
			}
		}
		ans = max(ans,mn + pr*a[i]);
	}
	
	cout<<ans;
	
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n, k, q;
	cin >> n >> k >> q;

	vl cnt(n);
	FOR(i,0,q) {
		ll a; cin >> a;
		cnt[a-1]++;
	}

	FOR(i,0,n) {
		cout << (q-cnt[i] < k ? "Yes" : "No") << endl;
	}
}



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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

string n;

int main(){
	cin >> n;
	for(lli i = 0;i < 4;i++){
		if(n[0] != n[i]) break;
		if(i == 2){
			cout << "Yes" << endl;
			return 0;
		}
	}
	for(lli i = 1;i < 4;i++){
		if(n[1] != n[i]) break;
		if(i == 3){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]+n>'Z')
            cout<<(char)(s[i]+n-26);
        else
            cout<<(char)(s[i]+n);
    }
    cout<<endl;
}


Measured memory_bytes: 384
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := intScanner(), Scanner()
	c := ""
	for _, v := range b {
		if string(v) != "." {
			c += string(v)
		}
	}
	d, _ := strconv.Atoi(c)
	fmt.Println(a * d / 100)
}


Measured memory_bytes: 1760
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		int a,b,W,H;
		Scanner br=new Scanner(System.in);
		a=br.nextInt();
		b=br.nextInt();
		W=a*b;
		H=(a+b)*2;
		System.out.println(W+" "+H);
	}
}

Measured memory_bytes: 26176
#include <bits/stdc++.h>
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> multi_vector(size_t a){return vector<T>(a);}template<class T, class... Ts>auto multi_vector(size_t a, Ts... ts){return vector<decltype(multi_vector<T>(ts...))>(a, multi_vector<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}

/* ここからコード開始 */

int main(){
  kyopro;
  vector<ll> A(3);
  cin >> A[0] >> A[1] >> A[2];
  sort(all(A));
  cout << A[0] * A[1] / 2 << rt;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep2(i,x,n) for(int i=x;i<n;++i)

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

    const double PI=3.14159265358979323846;
    double v = a*a*b;
    cout << fixed << setprecision(15);

    if(x <= v/2)
    {
        // x = b*a*(b*tan(PI-th))/2
        double th = PI/2 - atan(2*x/b/b/a);
        cout << th/PI*180 << endl;
    }
    else
    {
        // x = v-a*tan(th)*a*a/2
        double th = atan(2*(v-x)/a/a/a);
        cout << th/PI*180 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
void solve(){
	int n;
	cin >> n;
	cout << (n+1)/2 << endl;
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}


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>;

void Main()
{
  int N, K;
  cin >> N >> K;
  double p = 0.0;
  for (int i = 1; i <= N; i++) {
    double cur_p = 1.0;
    int winNum = 0;
    while (i * pow(2, winNum) < K) {
      cur_p *= 0.5;
      winNum++;
    }
    cur_p /= N;
    p += cur_p;
  }
  cout << p << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
        long long N;
        cin>>N;
        vector<long long>A(N);
        for(long long i=0;i<N;i++) scanf("%ld",&A[i]);
        sort(A.begin(),A.end());
        if((A[N/2]-A[N/2-1])>0) cout<<(A[N/2]-A[N/2-1])<<endl;
        else cout<<0<<endl;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll INF = 1LL << 60;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

struct Node {
  vector<int> children;
  ll cost;
  bool used;
};

Node nodes[200010];
ll results[200010];

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

  REP(i, 0, N - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    nodes[a].children.push_back(b);
    nodes[b].children.push_back(a);
  }

  REP(i, 0, Q) {
    int p, x;
    cin >> p >> x;
    p--;
    nodes[p].cost += x;
  }

  stack<int> s;
  s.push(0);
  nodes[0].used = true;

  ll cost = 0;
  while (!s.empty()) {
    int val = s.top();
    s.pop();
    if (val < 0) {
      cost += val;
      continue;
    }

    if (nodes[val].cost > 0) s.push(-nodes[val].cost);
    for (int next : nodes[val].children) {
      if (nodes[next].used) continue;
      s.push(next);
    }

    cost += nodes[val].cost;
    results[val] = cost;
    nodes[val].used = true;
  }

  string result;
  REP(i, 0, N) {
    result += to_string(results[i]);
    result += " ";
  }
  result.pop_back();
  cout << result << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 21764
#include<stdio.h>
#include<cstdio>
using namespace std;

int N;
int a[10000];
int main() {
  scanf("%d", &N);
  for (int i=0 ; i<N ; i++) scanf("%d", &a[i]);
  int res = 0;
   for (int i=0 ; i<30 ; i++) {
    for (int j=0 ; j<N ; j++) {
      if (a[j] % 2 == 0) {
        a[j] /= 2;
        res++;
      }
    }
  }
  printf("%d\n", res);
}

Measured memory_bytes: 256
N,M = map(int, input().split())
gate_l = [[int(x) for x in input().split()] for _ in range(M)]

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

if max_card >= min_card:
    print(max_card - min_card +1)
    
else:
    print(0)

Measured memory_bytes: 21108
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i< (n);i++)
#define rep1(i,n) for(ll i=1;i<= (n);i++)
using namespace std;
typedef long long ll;
const static ll MOD = (1e+9)+7;

ll modpow(ll a,ll n_){
    if(n_ == 0)return 1;
    if(n_ % 2 == 1)return a * modpow(a,n_-1) % MOD;
    ll t = modpow(a,n_/2) % MOD;
    return t*t % MOD;
}

int main(){
    ll N,K;cin>>N>>K;
    vector<ll> lst(K+1,0);
    ll ans = 0;
    for(ll i = K; i > 0; i--){
        lst[i] = modpow(K/i,N);
        for(ll j = 2*i;j<=K;j+=i){
            lst[i] = (lst[i] - lst[j] +MOD) % MOD;
        } 
    }
    rep1(i,K){
        ans += lst[i] % MOD * i % MOD;
    }
    cout<<ans%MOD<<endl;
    return 0;
}

Measured memory_bytes: 4056
//
// Created by 伊東麻沙美 on 2019/10/22.
//

#include<iostream>
#include<algorithm>
using namespace std;


int main(){

    int x,a;
    cin>>x>>a;

    if(x<a){
        cout<<0;
    }else{
        cout<<10;
    }
    //cin>>a>>b>>x;
    //scanf("%d%s%d",&i,&x,&j);


       // printf("%d",i+j);
       //cout<<i+j<<endl;

    return 0;
}

Measured memory_bytes: 256
i = list(map(int,input().split()))
a = i[0]
b = i[1]
c = i[2]
d = i[3]

ret = 0
if b < 0:
    if d < 0: #-2 -1 -3 -2
        ret = a * c
    elif c < 0 and d >= 0: # -3 -2 -4 0, -3 -2 -2 2
        ret = a * c
    else: # -3 -2 0 3, -3 -2 3 9
        ret = b * c
elif a < 0 and b >= 0:
    if d < 0: # -3 0 -4 -3, -3 1 -4 -3
        ret = a * c
    elif c < 0 and d >= 0:
        ret = max(a*c, b*d)
    else:
        ret = b * d
else:
    if d < 0:
        ret = a * d
    elif c < 0 and d >= 0:
        ret = b * d
    else:
        ret = b * d

print(ret)

Measured memory_bytes: 9224
/**
 *      ///----- My Info -----///
 *      Clock: nowl
 *      Code by: Ernesto Abreu
 *      Codeforces User: Ernest0_0Abreu
 *      Country: Cuba
 *      E-mail: ernestoabreup@gmail.com
 *      ©CopyRight
**/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
        ///----- My Template -----///
///=====================================================================================================================
/// Red-Black Tree
// #include <ext/pb_ds/assoc_container.hpp>  // .find_of_order(x); .order_of_key(x);
// using namespace __gnu_pbds;
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > indexed_set;
/// Typedef
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
/// Function
#define pi (acos(-1))
#define lg2(x) 31-__builtin_clz(x)
#define lgx(x,b) log(b)/log(x)
/// Macros
#define fst first
#define scd second
#define pb push_back
#define left (node<<1)
#define right ((node<<1)+1)
#define sz(x) (int)(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
/// Debug
#define _end cout << "\n"
#define debug(x) cerr << #x << " = " << x << " "
/// Constant
const int MAXN = 1e6+7;
const int MOD = 1e9+7;
const ull BASE = 311;
const ld EPS = 1e-9;
const int INF = ((1<<30)-1);
const ll INFLL = ((1ll<<62ll)-1ll);
/// Hash Prime Numbers: 2, 277, 293, 307, 331, 337, 1009, 2027;
/// Module Prime Numbers: 3, 998244353, 1000000007, 1000000009, 1000000021, 1000000033;
///=====================================================================================================================
#define int long long
        ///----- My code -----///



int32_t main (){

    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    cout.setf(ios::fixed);cout.precision(0);
//  freopen("a.in", "r", stdin);

    int K;
    cin >> K;
    int sum = 0;
    for(int i = 1; i <= K; i++){
        for(int j = 1; j <= K; j++){
            for(int k = 1; k <= K; k++){
                sum+=__gcd(__gcd(i,j),k);
            }
        }
    }

    cout << sum;

    return 0;
}
/*
Test case:

*/



Measured memory_bytes: 3648
#include<stdio.h>
#include<string.h>
using namespace std;
int main() {
	int n,s[10],ans=1,tmp=1;
	scanf("%d",&n);
	for(int i=0; i<n; i++) {
		scanf("%d",&s[i]);
		ans*=3;
		if(s[i]%2==0) tmp*=2;
	}

	printf("%d\n",ans-tmp);
	return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)+1
cur = [0]*(n)
temp = 0
for i in range(len(s)):
    if s[len(s)-2-i] == '>':
        if s[len(s)-i-1] == '<':
            cur[len(s)-i-1] = 0
        else:
            temp += 1
            cur[len(s)-i-1] = temp
    else:
        if s[len(s)-i-1] == '>':
            temp += 1
            cur[len(s)-i-1] = temp
            temp = 0
for i in range(len(s)):
    if s[i] == '<':
        if i != 0 and s[i-1] == '<':
            cur[i+1] = max(cur[i+1], cur[i]+1)
        elif i != 0 and s[i-1] == '>':
            cur[i+1] = max(cur[i]+1, cur[i+1])
        else:
            cur[i+1] = max(cur[i]+1,cur[i+1])
    else:
        if i != 0 and s[i-1] == '<':
            cur[i+1] = min(cur[i+1], cur[i]-1)
        elif i != 0 and s[i-1] == '>':
            None
        else:
            None
print(sum(cur))


Measured memory_bytes: 23372
#ifdef __GNUC__
#include <bits/stdc++.h>
#endif // __GNUC__


int main() {
    std::string S; std::cin >> S;
    int ans = 0;
    int count = 0;
    for (auto& c : S) {
        switch (c) {
        case 'A':case 'C':case 'G':case 'T':
            ++count;
            break;
        default:
            count = 0;
            break;
        }
        ans = std::max(ans, count);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
# 参考記録
N = int(input())
x, y = 1, 1
for i in range(N):
    a, b = map(int, input().split())
    # 前回の得票数+今回の得票数が今回のやつよりはるかに多い➡その倍数分あればいい？？
    mul = max((x+a-1)//a, (y+b-1)//b)
    x = mul*a
    y = mul*b
print(x+y)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define loop(i,a,n) for (ll i=a;i<n;i++)
#define loopm(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define Graph(n) vector < vector < ll > > (n,vector < ll >(0,0))
#define tr(container,it)\
for(auto it=container.begin();it!=container.end();it++)
#define SZ(x) ((int)(x).size())
typedef vector<long long> VI;
typedef long long ll;
typedef vector < vector < ll > > VII;
typedef pair<ll,ll> PII;
typedef double db;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;ll k;
    cin>>n;
    cin>>k;
    VI height(n,0);
    VI dp(n,9e18);
    loop(i,0,n)
    {
        cin>>height[i];
    }
    dp[0]=0;
    loop(i,1,n)
    {
        loop(j,0,k)
        {
            if((i-j-1)>=0)
            {
                  dp[i]=min(dp[i],dp[i-j-1]+abs(height[i]-height[i-j-1]));
            }
        }
    }
    cout<<dp[n-1];

}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ATenki solver = new ATenki();
        solver.solve(1, in, out);
        out.close();
    }

    static class ATenki {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            String s = in.scanString();
            String t = in.scanString();
            int ct = 0;
            for (int i = 0; i < s.length(); i++) if (s.charAt(i) != t.charAt(i)) ct++;
            out.println(s.length() - ct);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public String scanString() {
            int c = scan();
            if (c == -1) return null;
            while (isWhiteSpace(c)) c = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return res.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



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

using namespace std;

#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define int long long
#define pii pair<int, int>
#define fi first
#define se second

const int N = 2e5 + 7, inf = 1e9 + 1;

vector<pii> a;
vector<int> rem;
int n, t;

bool cmp(const pii &x, const pii &y)
{
    return x.fi * (y.se + 1) > y.fi * (x.se + 1);
}

int dp[N][33];

signed main()
{
    fastio;
    cin >> n >> t;
    for (int i = 1; i <= n; ++i)
    {
        int x, y;
        cin >> x >> y;
        if (x == 0)
            rem.push_back(y);
        else
            a.push_back({x, y});
    }
    sort(begin(rem), end(rem));
    sort(begin(a), end(a), cmp);
    n = a.size();
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= 32; ++j)
        {
            dp[i][j] = inf;
        }
    }
    for (int i = 0; i <= n; ++i)
    {
        dp[i][0] = 0;
    }
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= min(i, 32ll); ++j)
            if (i == j)
            {
                dp[i][j] = min({inf, dp[i - 1][j - 1] + 1 + a[i - 1].fi * (dp[i - 1][j - 1] + 1) + a[i - 1].se});
            }
            else
            {
                dp[i][j] = min({inf, dp[i - 1][j], dp[i - 1][j - 1] + 1 + a[i - 1].fi * (dp[i - 1][j - 1] + 1) + a[i - 1].se});
            }
    int maxans = 0;

    for (int j = 0; j <= 32; ++j)
    {
        if (dp[n][j] <= t)
        {
            int res = j, now = dp[n][j];
            for (int i = 0; i < rem.size(); ++i)
                if (now + rem[i] + 1 <= t)
                    now += rem[i] + 1, ++res;
            maxans = max(maxans, res);
        }
    }
    // for (int i = 1; i <= n; ++i)
    // {
    //     for (int j = 1; j <= n; ++j)
    //     {
    //         cout << dp[i][j] << " \n"[j == n];
    //     }
    // }
    cout << maxans;

    return 0;
}

/* input

*/

Measured memory_bytes: 55916