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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#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> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, n;
    cin >> h >> n;
    int dp[20001] = {};
    vector<P> p(n);
    rep (i, n) cin >> p[i].first >> p[i].second;
    repp (i, 1, 20001) dp[i] = 1000000000;
    rep (i, n) {
        rep (j, h + 1) {
            chmin(dp[j + p[i].first], dp[j] + p[i].second);
        }
    } 
    int ans = 1000000000;
    repp (i, h, 20001) chmin(ans, dp[i]);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  ll a,b,x;
  
  cin>>a>>b>>x;
  if(a!=0){
    cout<<b/x-(a-1)/x<<endl;
    return 0;
  }
  else if(b==0){
    cout<<1<<endl;
  }
  else {
    cout<<b/x+1<<endl;
  }
}

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

int main() {
   string S;
   int ans=0;
   cin >> S;
   for(int i=0;i<S.size()/2;i++){
       if(S.at(i)!=S.at(S.size()-1-i)){
           ans++;
       }
   }
   cout << ans <<endl;
   return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	string str;
	cin >> str;

	int m = 9;
	for(int i=0 ; i<str.size() ; i++)
		m = min(m , str[i]-'0');

	string temp;
	for(int i=0 ; i<str.size() ; i++)
	{
		temp += (m+'0');
	}

	while(temp < str)
	{
		for(int i=0 ; i<str.size() ; i++)
			temp[i] = temp[i] + 1;
	}

	cout << temp;
	return 0;
}

Measured memory_bytes: 256
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()

    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1

print(taro, hanako)

Measured memory_bytes: 7652
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};


int main(){
	int a, b;
	cin >> a >> b;
	rep(i, 0, a+1) {
		if (2 * i + 4 * (a - i) == b) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <queue>
#include<algorithm>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<n;i++)
#define ALL(a) a.begin(),a.end()
#define B1 1000000007
#define B2 100000007
using namespace std;
typedef unsigned long long int ull;
template<typename T, T MOD, T B>
struct RollingHash {
    vector<T> hash, p;
    RollingHash() {}
    RollingHash(const string& s) {
        int n = s.size();
        hash.assign(n + 1, 0);
        p.assign(n + 1, 1);
        for (int i = 0; i < n; i++) {
            hash[i + 1] = (hash[i] * B + s[i]) % MOD;
            p[i + 1] = p[i] * B % MOD;
        }
    }
    //S[l, r)
    T find(int l, int r) {
        T res = hash[r] + MOD - hash[l] * p[r - l] % MOD;
        return res >= MOD ? res - MOD : res;
    }
};
int main() {
    string s, t;cin >> s >> t;
    if(s.size() < t.size()) return 0;
    using RH = RollingHash<ull,B1, B2>;
    RH rs(s), rt(t);
    rep(i, s.size() - t.size()+1) {
        if (rs.find(i, i + t.size()) == rt.find(0, t.size()))cout << i << endl;
    }
}


Measured memory_bytes: 19812
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define test ll t; cin>>t; while(t--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
#define max 1000005
bool prime[max];
/*ull sieve()
{
	memset(prime,true,sizeof(prime));
	for(ull p=2;p*p<max;p++)
	{
		if(prime[p]==true){
			for(ull i=2*p;i<max;i+=p)
			{
				prime[i]=false;
			}
		}
	}
	prime[0]=0;
	prime[1]=0;
}*/
using namespace std;
signed main()
{
	fastio;
	int n;
	cin>>n;
	int hel=1,sum=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			for(int k=1;k<=n;k++)
			{
				hel=gcd(i,j);
				hel=gcd(hel,k);
				sum+=hel;
			}
		}
	}
	cout<<sum<<endl;
}













Measured memory_bytes: 3652
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (x, y) = scan!(i64, i64);
    let v1 = vec![1, 3, 5, 7, 8, 10, 12];
    let v2 = vec![4, 6, 9, 11];
    let v3 = vec![2];

    if (v1.contains(&x) && v1.contains(&y))
        || (v2.contains(&x) && v2.contains(&y))
        || (v3.contains(&x) && v3.contains(&y))
    {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		int x[] = new int[n];
		int y[] = new int[n];
		for(int i=0;i<n;i++){
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
		}
		
		int nx=x[0],ny=y[0],cnt=0;
		for(int i=1;i<n;i++){
			while(nx!=x[i]||ny!=y[i]){
				if(x[i]>nx&&y[i]>ny){//斜め右上
					nx++;ny++;
				}else if(x[i]<nx&&y[i]<ny){//斜め左下
					nx--;ny--;
				}else if(y[i]>ny){//上
					ny++;
				}else if(y[i]<ny){//下
					ny--;
				}else if(x[i]>nx){//右
					nx++;
				}else if(x[i]<nx){//左
					nx--;
				}
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 25560
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	cout<<max(a-b*2,0)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) xmax = x; return true;
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) xmin = x; return true;
    return false;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    ll n, k; cin >> n >> k;
    vector<ll> a(n); FOR(i, 0, n) cin >> a[i], a[i]--;

    vector<ll> time(n, -1);
    vector<ll> seq = {0};
    size_t s;
    time[0] = 0;
    while (true) {
        size_t x = a[seq.back()];
        if (time[x] != -1) {
            s = time[x];
            break;
        }
        time[x] = time[seq.back()] + 1;
        seq.push_back(x);
    }

    ll ret;
    if (k < s) {
        ret = seq[k] + 1;
    } else {
        ret = seq[(k-s) % (seq.size() - s) + s] + 1;
    }

    cout << ret << endl;
}

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

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


int main() {
  vector<char> ans(10);
  int point = 0;
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == '0') {
      ans.at(point) = '0';
      point++;
    } else if(s[i] == '1') {
      ans.at(point) = '1';
      point++;
    } else {
      point = max(0,point-1);
    }
  }
  for(int i=0; i<point; i++) {
    cout << ans.at(i);
  }
  cout << endl;
      
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)

N = int(input())
a = list(map(int, input().split()))

min_ = min(a)
max_ = max(a)

if max_ > min_ + 1:
    print("No")
    exit()

if min_ == max_:
    if min_ == N-1:
        print("Yes")
        exit()
    if 2*min_ <= N:
        print("Yes")
        exit()
    print("No")
    exit()
else:
    # max_ == min_ + 1
    count_min = a.count(min_)
    count_max = a.count(max_)
    if count_min >= max_:
        print("No")
        exit()
    if count_min + 2*(max_ - count_min) <= N:
        debug("hoge")
        print("Yes")
        exit()
    print("No")


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

int main(void){
  int n;
  vector<int> a(100000, 10000001);
  cin >> n;
  for(int i = 0; i < n; i ++){
    cin >> a.at(i);
  }
  
  int c = 0;
  sort(a.begin(), a.begin()+n);
    
  for(int i = 0; i < n; i ++){
    int temp = 0;
    for(int j = i; j < n; j ++){
      if(a.at(i) == a.at(j)) temp ++;
      else break;
    }
    if(temp % 2) c ++;
    i += temp-1;
  }
  cout << c << endl;
  
  return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip> 

using namespace std;

#define mp make_pair
#define pb push_back
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define all(x) (x).begin(), (x).end()
#define fst first
#define snd second
#define endl "\n"

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef tuple<int,int,int> iii;

template<typename T> inline T abs(T a){ return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a){ return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd (b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd (a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

string to_string(string s) {
    return '"' + s + '"';
}
    
string to_string(const char* s) {
    return to_string((string) s);
}
    
string to_string(bool b) {
    return (b ? "true" : "false");
}
    
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
    
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void fastIO() {
    cin.sync_with_stdio(false);
    cin.tie(0);
}

template<typename T>
vector<T> make_unique(vector<T> v) {
    sort(all(v));
    return v.resize(unique(all(v)) - v.begin());
}

int nxt() {
    int x;
    cin >> x;
    return x;
}

const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int dxKn[8] = {-2, -1, 1, 2,  2,  1, -1, -2};
const int dyKn[8] = { 1,  2, 2, 1, -1, -2, -2, -1};
const int dxK[8] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dyK[8] = {1, -1, 0, 0, 1, -1, 1, -1};

const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const ll INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld e = ld(2.7182818284590452353602874713527);
const ld EPS = 1e-9;

//#############################
const int MAXN = 1000005;

int main() {
    fastIO(); 
    int a, x, y;
    cin >> x >> y;
    forn(i,x+1){
        a = 2*i + 4*(x-i);
        if (a == y){
            cout << "Yes\n";
            return 0;
        }
    }

    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3672
A_UPPERCASE=97
ALPHABET_SIZE=26
def _decompose(number):
    """Generate digits from `number` in base alphabet, least significants
    bits first.

    Since A is 1 rather than 0 in base alphabet, we are dealing with
    `number - 1` at each iteration to be able to extract the proper digits.
    """

    while number:
        number, remainder = divmod(number - 1, ALPHABET_SIZE)
        yield remainder


def base_10_to_alphabet(number):
    return ''.join(
            chr(A_UPPERCASE + part)
            for part in _decompose(number)
)[::-1]
print(base_10_to_alphabet(int(input())))


Measured memory_bytes: 9124
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

	public static int[][] point;
	public static int m;

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

		int[][] stud = new int[n][2];
		for(int i=0; i<n; i++){
			stud[i][0] = in.nextInt();
			stud[i][1] = in.nextInt();
		}

		point = new int[m][2];
		for(int i=0; i<m; i++){
			point[i][0] = in.nextInt();
			point[i][1] = in.nextInt();
		}

		for(int i=0; i<n; i++){
			Manhattan(stud[i][0], stud[i][1]);
		}
	}

	static void Manhattan(int a, int b) {
		HashMap<Integer, Integer> man = new HashMap<>();
		for(int i=0; i<m; i++){
			man.put(i, Math.abs(a - point[i][0]) + Math.abs(b - point[i][1]));
		}
		List<Map.Entry<Integer, Integer>> entries = new ArrayList<Map.Entry<Integer, Integer>>(man.entrySet());
		Collections.sort(entries, new Comparator(){
		    public int compare(Object o1, Object o2){
		        Map.Entry e1 =(Map.Entry)o1;
		        Map.Entry e2 =(Map.Entry)o2;
		        return ((Integer)e1.getValue()).compareTo((Integer)e2.getValue());
		    }
		});

		for (Entry<Integer,Integer> s : entries) {
            System.out.println(s.getKey()+1);
            break;
        }

	}

}



Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define int long long int
vector<int> adj[100005];
int dp[100005];
int dfs(int n){
	if(dp[n]) return dp[n];
	int mx = 0;
	for(int t:adj[n]){
		mx = max(mx,dfs(t));
	}
	return dp[n]=mx+1;
}
int32_t main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int t1,t2;
		cin>>t1>>t2;
		adj[t1].push_back(t2);
	}
	for(int i=1;i<=n;i++){
		dfs(i);
	}
	//for(int i=1;i<=n;i++){
	//	cout<<dp[i]<<" ";
	//}
	//cout<<"\n";
	cout<<*max_element(dp,dp+n+1)-1;
}


Measured memory_bytes: 8576
from sys import stdin
input = stdin.readline

N, K = [int(x) for x in input().split()]
arr = [0] * (10**5+1)
for _ in range(N):
    a, b = [int(x) for x in input().split()]
    arr[a] += b

remain = K
for i in range(1, 10**5+1):
    if arr[i] != 0:
        remain -= arr[i]
    if remain <= 0:
        print(i)
        exit()

Measured memory_bytes: 5744
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
using namespace std;

int w, h, white, black;
char a[52][52];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};

void dfs(int x, int y, char c){
	for(int i=0 ; i < 4 ; i++ ){
		int mx = x + dx[i], my = y + dy[i];
		if( mx < 0 || my < 0 || w <= mx || h <= my ) continue;
		
		if( c == 'W' ){
			if( a[y][x] == 'W' || a[y][x] == 'w' ){
				if( a[my][mx] == '.' ){
					a[my][mx] = 'w';
					dfs(mx, my, c);
				}
			}
		}else if( c == 'B' ){
			if( a[y][x] == 'B' || a[y][x] == 'b' ){
				if( a[my][mx] == 'w' || a[my][mx] == 'W'){
					if( a[y][x] == 'b' ){
						a[y][x] = '?';
					}
					if( a[my][mx] == 'w' ){
						a[my][mx] = '?';
					}
				}
				
				if( a[my][mx] == '.' ){
					a[my][mx] = 'b';
					dfs(mx, my, c);
				}
			}
		}else if( c == '?' ){
			if( a[y][x] == 'w' || a[y][x] == 'b' ){
				a[y][x] = '?';
			}
			if( a[my][mx] == 'w' || a[my][mx] == 'b' ){
				a[my][mx] = '?';
				dfs(mx, my, c);
			}
		}
	}
}

void solve(){
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			if( a[y][x] == 'W' ){				
				dfs(x, y, 'W');
			}
		}
	}
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			if( a[y][x] == 'B' ){
				dfs(x, y, 'B');
			}
		}
	}
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			if( a[y][x] == '?' ){
				dfs(x, y, '?');
			}
		}
	}
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			if( a[y][x] == 'w' ) white++;
			if( a[y][x] == 'b' ) black++;
		}
	}
}

int main(){
	while( cin >> w >> h , w || h ){
		for(int y=0 ; y < h ; y++ ){
			cin >> a[y];
		}
		white = black = 0;
		solve();
		cout << black << " " << white << endl;
	}
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll a,b;
  cin >> a >> b;
  for(ll i=1;i<=10000;i++) {
    if(int(i*0.08)==a&&int(i*0.1)==b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<functional>

using namespace std;
typedef long long ll;

struct edge {
	int to, cost;
	edge(const int &_to, const int &_cost) :to(_to), cost(_cost) {}
	edge(const edge &e) :to(e.to), cost(e.cost) {}
};
inline bool operator< (const edge& l, const edge &r) { return (l.cost < r.cost); }
inline bool operator> (const edge& l, const edge &r) { return (l.cost > r.cost); }

vector<vector<edge>> G(10000);
vector<bool> used(10000);
priority_queue <edge, vector<edge>, greater<vector<edge>::value_type>> que;

int prim(int s) {
	int res = 0;
	used[s] = true;
	for (int i = 0; i < G[s].size(); ++i)que.emplace(G[s][i]);
	while (!que.empty()) {
		edge e = que.top(); que.pop();
		int to = e.to;
		if (used[to])continue;
		res += e.cost;
		used[to] = true;
		for (int i = 0; i < G[to].size(); ++i) {
			if (!used[G[to][i].to])
				que.emplace(G[to][i]);
		}
	}
	return res;
}

int main()
{
	cin.tie(0);
	ios::ios_base::sync_with_stdio(false);
	int V, E;cin >> V >> E;
	int s, t, w;
	for (int i = 0; i < E; ++i) {
		cin >> s >> t >> w;
		G[s].emplace_back(edge(t, w));
		G[t].emplace_back(edge(s, w));
	}
	int ans = prim(0);
	cout << ans << endl;
}

Measured memory_bytes: 5000
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                continue

            else:
                # 3角形の成立条件
                if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
                    ans += 1
print(ans)


Measured memory_bytes: 9200
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair((first), (second)))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

	string S;
	cin >> S;
	string T;
	for(int i = 0; i < S.size(); i++){
		if(i < S.size() - 1 && S[i] == 'R' && S[i + 1] == 'L'){
			T.pb('G');
			i++;
		}
		else{
			T.pb(S[i]);
		}
	}
	vector<int> V;
	int r = 0, l = 0;
	for(int i = 0; i < T.size(); i++){
		if(T[i] == 'R'){
			if(i - 1 >= 0 && T[i - 1] != 'R'){
				V.pb(l);
				l = 0;
			}
			r++;
		}
		else if(T[i] == 'L'){
			l++;
		}
		else{
			if(i - 1 >= 0 && T[i - 1] != 'R'){
				V.pb(l);
				l = 0;
			}
			V.pb(r);
			r = 0;
			V.pb(-1);
		}
	}
	if(T[T.size() - 1] != 'R')V.pb(l);
	for(int i = 0; i < V.size(); i++){
		//cout << V[i] << endl;
		if(V[i] > 0){
			for(int j = 0; j < V[i]; j ++){
				cout << "0 "; 
			}
		}
		if(V[i] == -1){
			int l = 1, r = 1;
			if(i - 1 >= 0 && V[i - 1] > 0){
				r += divcel(V[i - 1], 2);
				l += V[i - 1] / 2;
			}
			if(i + 1 < V.size() && V[i + 1] > 0){
				l += divcel(V[i + 1], 2);
				r += V[i + 1] / 2;
			}
			cout << l << " " << r << " ";
		}
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 1656
import java.io.*;

public class Main {

    public static void main(String[] args) {
	    InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }

    static class TaskC {
        public void solve(InputReader in, PrintWriter out) {
            //x + y + z = N
            //10000x + 5000y + 1000z = Y
            //z = N - x - y => 9000x + 4000y = Y - 1000N

            int bills = in.nextInt();
            int yen   = in.nextInt();
            boolean exists = false;
            int x, y, z;
            x = y = 0;
            loop: for(; x <= bills; x++) {
                for(y = 0; y <= bills - x; y++) {
                    if((9000 * x + 4000 * y) == (yen - 1000 * bills)) {
                        exists = true;
                        break loop;
                    }
                }
            }

            z = bills - x - y;
            if(exists)
                out.println(x + " " + y + " " + z);
            else
                out.println(-1 + " " + (-1) + " " + (-1));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public String[] input;
        public int current;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            input = null;
            current = 0;
        }

        public String next() {
            while (input == null || current == input.length) {
                try {
                    current = 0;
                    input = reader.readLine().split("\\s");
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }

            return input[current++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}


Measured memory_bytes: 23508
#include<stdio.h>

int main(void){
    int i;
    int j;
    int a;
    for(i = 1;i <= 9;i++){
        for(j = 1;j <= 9;j++){
            a = i * j;
            printf("%dx%d=%d\n",i,j,a);
        }
    }
    return 0;
}

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

int main()
{
    ll N;
    ll ans = 0;
    // vector<ll> P;
    ll minnum;
    cin >> N >> minnum;
    ++ans;
    for (int i = 0; i < N - 1; ++i)
    {
        ll temp;
        cin >> temp;
        if (minnum > temp)
        {
            ++ans;
            minnum = temp;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iterator>
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <vector>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;
int main(int argc, char **argv) {
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i < S.size(); ++i) {
    int cur = 0;
    for (int j = i; j < S.size(); ++j) {
      if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
        ++cur;
      } else {
        break;
      }
    }
    ans = max(ans, cur);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

		int A = scan.nextInt();
		int B = scan.nextInt();

		int x1 = A + A -1;
		int x2 = A + B ;
		int x3 = B + B -1;
		int r1 = (x1 > x2)? x1: x2;
		int ret = r1 > x3? r1 : x3;

		System.out.println(ret);

	}
}


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

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

int main(void) {
    string s, t;
    bool flg = false;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    cin >> t;
    REP(i, s.length()) {
        if (s == t) {
            flg = true;
            break;
        }
        s = s.substr(s.length() -1, 1) + s.substr(0, s.length() -1);
    }

    cout << (flg? "Yes" : "No") << "\n";
    return 0;
}

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

using namespace std;

typedef long long llint;

int main() {
  llint a;
  long double b;
  cin >> a >> b;
  llint c = b * 100 + 0.5;
  llint d = a * c;
  d /= 100;
  cout << d << endl;

  return 0;
}

Measured memory_bytes: 3740
/**
 *    author:  tourist
 *    created: 22.01.2020 00:01:26       
**/
#include <bits/stdc++.h>

using namespace std;

class dsu {
 public:
  vector<int> p;
  int n;

  dsu(int _n) : n(_n) {
    p.resize(n);
    iota(p.begin(), p.end(), 0);
  }

  inline int get(int x) {
    return (x == p[x] ? x : (p[x] = get(p[x])));
  }

  inline bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x != y) {
      p[x] = y;
      return true;
    }
    return false;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  dsu d(2 * n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    --x; --y;
    d.unite(x, y + n);
    d.unite(x + n, y);
  }
  vector<int> cnt(n, 0);
  for (int i = 0; i < n; i++) {
    cnt[d.get(i) % n] += 1;
  }
  long long iso = 0;
  long long bip = 0;
  long long non = 0;
  for (int i = 0; i < n; i++) {
    if (cnt[i] == 1) {
      iso += 1;
    }
    if (cnt[i] > 1) {
      if (d.get(i) == d.get(i + n)) {
        non += 1;
      } else {
        bip += 1;
      }
    }
  }
  long long ans = iso * iso + iso * (n - iso) + (n - iso) * iso;
  ans += (non + bip) * (non + bip);
  ans += bip * bip;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 100005
#define mod 1000000007

int n;
char s[maxn];

int main()
{
    cin >> n;
    scanf("%s", s);
    int ans = 0;
    for (int i = 1; i < n + 1; i++)
    {
        if (s[i] != s[i - 1])
            ans++;
    }
    printf("%d\n", ans);

    return 0;
}

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

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define ll long long
#define ld long double

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)

#define pii pair<int, int>
#define pll pair<ll, ll>

#define fi first
#define se second

#define pb push_back
#define eb emplace_back

#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()

#define endl '\n'
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double PI=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=1000010;
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  ll gall = a[0];
  rep(i,n-1) gall=gcd(gall,a[i+1]);
  bool ok = true;
  map<int,int>mp;
  rep(i,n){
    auto vec = prime_factorize(a[i]);
    for(auto v:vec){
      mp[v.first]++;
    }
  }
  for(auto p:mp){
    if(p.second>1)ok= false;
  }
  if(ok)cout << "pairwise coprime" << endl;
  else if(!ok && gall==1)cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
  return 0;
}


Measured memory_bytes: 10648
// Last Change: 07/07/2019 22:26:28.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  ll cal = 0;
  for (ll i = 0; i < N; ++i) {
    cin >> A[i];
    cal += ((i % 2 == 0) ? 1 : -1) * A[i];
  }

  vector<ll> ans(N);
  cal /= 2;
  cout << 2 * cal << " ";
  for (ll i = 1; i < N; ++i) {
    cal = A[i - 1] - cal;
    cout << 2 * cal << " ";
  }
  cout << endl;
}


Measured memory_bytes: 2944
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

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

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;

int main() {
	int a, b, n;

	while(cin >> a >> b >> n, a) {
		vvi cost(a+1, vi(b+1, 0));

		REP(i, n) {
			int x, y;
			cin >> x >> y;

			cost[x][y] = -1;
		}

		FOR(i, 1, a+1) {
			FOR(j, 1, b+1) {
				if(cost[i][j] != -1) {
					cost[i][j] = cost[i-1][j] + cost[i][j-1];
				} else {
					cost[i][j] = 0;
				}

				if(i==1 && j==1) {
					cost[i][j] = 1;
				}
 			}
		}

		cout << cost[a][b] << endl;
	}

	return 0;
}

Measured memory_bytes: 0
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, k = map(int, input().split())
d = str(input())
tmp = list(d)
data = [int(s) for s in tmp]

ans = 0

cnt_list = []

tmp = 1
cnt = 0
for i in range(n):
    if data[i] == tmp:
       cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
        tmp = 1 - tmp
if cnt != 0:
    cnt_list.append(cnt)

if len(cnt_list) % 2 == 0:
    cnt_list.append(0)

sum_list = [0]
sum_num = 0
for d in cnt_list:
    sum_num += d
    sum_list.append(sum_num)

tmp_ans = 0
for i in range(0, len(sum_list), 2):
    left = i
    right = min(i + 2*k+1, len(sum_list)-1)
    tmp_ans = sum_list[right] - sum_list[left]
    ans = max(ans, tmp_ans)

print(ans)


Measured memory_bytes: 10836
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

VL rem1;
VL rem2;

VL soinsu(ll n){
	// ll ret = 2;
	VL ret;
	for(ll i=2; i*i<=n; i++){
		if(n%i==0){
			ret.PB(i);
			if(n/i!=i) ret.PB(n/i);
		}
	}
	// sort(ALL(rem));
	return ret;
}


signed main(){
	ll n; cin>>n;
	if(n==2) return cout<<1<<endl,0;
	int ans = soinsu(n-1).size()+2;
	cerr<<ans<<endl;
	VL ret = soinsu(n);
	rep(i,ret.size()){
		ll tmp = n;
		while(tmp%ret[i]==0) tmp/=ret[i];
		if(tmp%ret[i]==1) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
import itertools
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
P=tuple(P)
Q=tuple(Q)
l=[]
R=[]
for i in range(N):
    l.append(i+1)
for i in itertools.permutations(l,N):
    R.append(i)
x=R.index(P)
y=R.index(Q)
print(abs(x-y))

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

int main(){
    int N, D;
    cin >> N >> D;
    int t;
    t = N / (D * 2 + 1);
    if(N % (D * 2 + 1) == 0){
        cout << t << endl;
    }
    else{
        cout << t + 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int a,b;cin>>a>>b;
    int c = a+b;

    if(a%3==0 || b%3==0 || c%3==0){
      cout<<"Possible"<<endl;
    }else{
      cout<<"Impossible"<<endl;
    }
    
    return 0;
}


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


int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n)
  {
    cin >> a[i];
    a[i] = -a[i];
  }
  vector<int> ans;
  rep(i, n)
  {
    auto itr = upper_bound(ans.begin(), ans.end(), a[i]);
    if (itr == ans.end())
      ans.push_back(a[i]);
    else
      *itr = a[i];
  }
  cout << ans.size() << endl;
  return 0;
}

Measured memory_bytes: 1276
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n,m = LI()
    if n > m:
        n,m = m,n
    ans = 0
    if n == 1:
        ans = abs(m-2)
    elif n == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)

    print(ans)
main()            


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

int main(){
//srandom((unsigned long)time(NULL));

int k,a,b;
cin>>k>>a>>b;

bool isK = false;
for(int i=a;i<=b;i++){
    if(i%k==0) isK=true;
}
if(isK) cout<<"OK"<<endl;
else cout<<"NG"<<endl;

return 0;
}



Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>

#define ll long long

int main()
{
    int N, X, T;
    std::cin >> N >> X >> T;

    int sho = N / X;
    if(N % X == 0) {
        std::cout << sho * T << std::endl;
    }
    else {
        std::cout << (sho+1) * T << std::endl;
    }
}

Measured memory_bytes: 3588
import java.util.*;
public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        if(((n-1)%(k-1)) !=0)
            System.out.println(((n-1)/(k-1)) + 1);
        else
            System.out.println(((n-1)/(k-1)));

    }


}

Measured memory_bytes: 21588
q,h,s,d,n=map(int,open(0).read().split())
a=0
if d<min(s*2,h*4,q*8):
  a+=n//2*d
  n%=2
if s<min(h*2,q*4):
  a+=n*s
  n=0
if h<q*2:
  a+=n*2*h
  n=0
print(a+n*4*q)

Measured memory_bytes: 38256
import sys
from itertools import combinations_with_replacement
input = sys.stdin.readline
 
 
def readstr():
    return input().strip()
 
 
def readint():
    return int(input())
 
 
def readnums():
    return map(int, input().split())
 
 
def readstrs():
    return input().split()
 
 
N, M, Q = readnums()
num_list = [list(readnums()) for _ in range(Q)]
 
ans = 0
for v in combinations_with_replacement(range(1, M + 1), N):
    val = 0
    for n in num_list:
        if v[n[1] - 1] - v[n[0] - 1] == n[2]:
            val += n[3]
    ans = max(ans, val)
 
print(ans)

Measured memory_bytes: 67864
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }


int main()
{
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    int N;
    string S;
    cin >> N >> S;
    if(N%2==1){cout << "No" << endl; return 0;}
    string T;
    T = S.substr(N/2);
    if(S==(T+T)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <iostream>
#include <bitset>
#include <algorithm>        // sort()
#include <vector>           // for vectors
#include <map>              // for ordered map
#include <unordered_map>
#include <list>             // for list
#include <iomanip>          // for setprecision()
#include <cmath>            // for pow(), sqrt(), log(), log10(), ....
#include <cstring>          // for memset()
#include <unordered_set>    // for unordered_set
#include <climits>          // for INT_MAX & INT_MIN
#include <set>              // for ordered set

#define C ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
#define INF INT_MAX
#define NINF INT_MIN
#define MOD 1000000007
const double pi=acos(-1); // value of pi


bool isVowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        return 1;
    }
    return 0;
}

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second<b.second;
}


bool isPrime(ll n) {
    for(ll i=3; i*i<=n; i+=2) {
        if(n%i==0) {
            return false;
        }
    }
    return true;
}

// map<ll, list<ll>> m;
map<ll, ll> m;

int main() {
    C
//     freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
    int t=1;
    // cin >> t;
    while(t--) {
        ll k, n, x;
        cin >> k >> n;
        vector<ll> v;
        for(ll i=0; i<n; i++) {
            cin >> x;
            m[x]=1;
        }
        for(ll i=0; ; i++) {
            if(m[k-i]==0) {
                cout << k-i << endl;
                return 0;
            }
            if(m[k+i]==0) {
                cout << k+i << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3196