akhauriyash/Code-Regression huggingface dataset:
c = [list(map(int, input().split())) for _ in range(3)]
ans = "Yes"
for i in range(1,3):
    if c[i][0]-c[0][0] != c[i][1]-c[0][1] or c[i][1]-c[0][1] != c[i][2]-c[0][2]:
        ans = "No"
print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-8)
#define PI (acos(-1))
#define MOD 1000000007ll

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

typedef long long ll;
typedef complex<double> P;
typedef complex<double> Vec;
typedef pair<ll, ll> pll;

map<pll, ll> dp;

ll dfs(ll s, ll x) {
	if (dp.find(pll(s, x)) != dp.end()) return dp[pll(s, x)];
	
	if (s == 0 && x == 0) return 1;
	
	ll res = 0;
	
	res += dfs(s / 2, x / 2);
	if (s >= 1 && x >= 1) res += dfs((s - 1) / 2, (x - 1) / 2);
	if (s >= 2) res += dfs((s - 2) / 2, x / 2);
	
	return dp[pll(s, x)] = res % MOD;
}

int main() {
	ll n;
	cin >> n;
	
	cout << dfs(n, n) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) ((int)(x).size())
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int inf = 1 << 30;
const ll INF = 1LL << 60;

int main(){
    ll k;
    cin >> k;
    ll q = k / 50;
    ll r = k % 50;
    VL a(50, 49);
    rep(i, 50) a[i] += q;
    rep(i, 50){
        if (i < r) a[i] += 1;
        else a[i] -= r;
    }

    cout << 50 << endl;
    rep(i, 50) printf("%lld%c", a[i], i == 49 ? '\n' : ' ');

    // rep(ki, k){
    //     ll mx = 0;
    //     int mxi = 0;
    //     rep(i, 50) if (chmax(mx, a[i])) mxi = i;
    //     rep(i, 50) {
    //         if (i == mxi) a[i] -= 50;
    //         else a[i]++;
    //     }
    //     printf("No.%d MAX=%lld\n", ki+1, mx);
    // }

    // cout << 50 << endl;
    // rep(i, 50) printf("%lld%c", a[i], i == 49 ? '\n' : ' ');
    return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
int main(void){
    // Your code here!
    mp::cpp_int a,b;
    cin >> a;
    b = 1;
    int zf = 0;
    int cf = 0;
    long long tmp;
    
    for (int i = 0; i < a; i++) {
        cin >> tmp;
        b *= tmp;
        if(b>1000000000000000000){
            cf=1;
            b=0;
        }
        if(tmp == 0){
            zf = 1;
        }
    }
    if(zf==1){
        cout << 0;
    }else if(cf == 1){
        cout << "-1";
    }else{
        cout << b;
    }
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

int dp[55][55][55*55];


signed main(void) {
    int n,k;
    cin >> n >> k;
    dp[0][0][0] = 1;
    loop(i,1,n+1)rep(j,n+1)rep(x,k+1)if(x-2*j >= 0){//奇妙さがxで保留にしているのがj*2匹
        dp[i][j][x] += (2*j+1)*dp[i-1][j][x-2*j]%MOD;//i同士をペアにするまたはi片方と保留をペアにする(保留の数はそのまま)
        dp[i][j][x] %= MOD;
        dp[i][j][x] += (j+1)*(j+1)*dp[i-1][j+1][x-2*j]%MOD;//それぞれ保留とペアにする(保留の数が減る)
        dp[i][j][x] %= MOD;
        if(j)dp[i][j][x] += dp[i-1][j-1][x-2*j]%MOD;//どちらも保留にする(保留の数が増える)
        dp[i][j][x] %= MOD;
    }
    cout << dp[n][0][k] << endl;
}


Measured memory_bytes: 66560
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<math.h>
#include<climits>
#include<set>
//#include<bits/stdc++.h>
#define debug(x) cout <<#x<<" = "<<x<<endl
#define debug2(x, y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define gg cout <<"---------------QAQ---------------"<<endl
#define fi first
#define SZ(x) (int)x.size()
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, string> pii;
typedef pair<pii, ll> Pii;
template<class T> inline void read(T &x){
    x=0; char c=getchar(); int f=1;
    while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
    while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2e5+10, maxn = 1e6+10;
void FAST(){ios::sync_with_stdio(false);cin.tie(nullptr); cout.tie(nullptr);}
const ll mod =  1e9+7;

int n, m, k;
int a, b, c;

void solve()
{
   scanf("%d%d%d%d", &a, &b, &c, &k);
   int ans = 0;
   if(k <= a) ans = k;
   else if(k <= a+b) ans = a;
   else ans = a-(k-(a+b));
   printf("%d\n", ans);
}

int main()
{
//    init();
//    int _;scanf("%d", &_); while(_--)
    solve();
    return 0;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
using namespace std;
typedef long long ll;
int f[2222][2222],g[2222][2222],d[2222],n,m;
int main(){
    cin >> n >> m;
    for (int i=0;i<2222;i++) d[i]=d[i/2]+(i%2);
    n=1<<n; m=1<<m;
    for (int i=0;i<n;i++)
        for (int j=0;j<m;j++)
            f[i][j]=d[i&j]&1;
    for (int i=1;i<n;i++)
        for (int j=1;j<m;j++)
            g[i][j]=f[i][j]^f[i][j-1]^f[i-1][j]^f[i-1][j-1];
    for (int i=1;i<n;i++){
        for (int j=1;j<m;j++) cout<<g[i][j];
        puts("");
    }
}

Measured memory_bytes: 21632
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
typedef __int128 ll;
map <pair <ll, int>, int> ans;
inline int dfs(pair <ll, int> now) {
    if (now.second == 0) return 1;
    if (::ans.count(now)) return ::ans[now];
    int ans = dfs(make_pair(now.first >> 1, now.second - 1)) * ((now.first & 1) + 1) % mod;
    for (int k = 1; k <= now.second >> 1; k++) {
        ll S = ((ll)1 << k) - 1;
        ll tmp = now.first, sum = tmp & S;
        tmp >>= k;
        sum &= tmp & S;
        tmp >>= k;
        int rest = now.second - k - k;
        for (; rest >= 0; rest -= k, sum &= tmp & S, tmp >>= k) {
            ans = (ans + 1ll * dfs(make_pair(sum, k)) * dfs(make_pair(tmp, rest))) % mod;
        }
    }
    return ::ans[now] = ans;
}
char s[110];
int main() {
    scanf("%s", s);
    int n = strlen(s);
    __int128 S = 0;
    for (int i = 0; i < n; i++) S = S << 1 | (s[i] - '0');
    return cout << dfs(make_pair(S, n)) << endl, 0;
}

Measured memory_bytes: 4480
H,N = map(int,input().split())

dp = [float("inf")] * (H+1)
dp[0] = 0

for i in range(N):

    A,B = map(int,input().split())

    for i in range(A,A+H):
        
        dp[min(i,H)] = min(dp[i-A] + B , dp[min(i,H)])

print (dp[H])

Measured memory_bytes: 52828
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<int> data(n);
    for (int i = 0; i < n; i++)
    {   
        cin >> data[i];
    }
    sort(data.begin(), data.end());
    int cnt = 0;
    int l = 0; 
    int r = 0; 
    while (r < n)
    {
        if (data[r] - data[l] > 2)
        {   
            ++l;
        }
        else
        {
            cnt = max(cnt, r - l + 1);
            ++r;
        }
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void) {
	char in;
	char out;

	scanf("%c", &in);
	switch (in) {
	case 'A':
		out = 'T';
		break;
	case 'T':
		out = 'A';
		break;
	case'G':
		out = 'C';
		break;
	case'C':
		out = 'G';
		break;
	}
	printf("%c\n", out);
	return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;

int main() {
  int n, m; cin >> n >> m;
  vector<int> broken(n+1);
  rep(i, m) {
    int a; cin >> a;
    broken[a] = 1;
  }
  vector<int> dp(n+2);
  dp[n] = 1;
  for(int i = n-1; i >= 0; i--) {
    if(broken[i]) {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % mod;
  }
  cout << dp[0] << endl;

  return 0;
}


Measured memory_bytes: 1024
package main

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

func main() {
	run()
}

func run() {
	setSpace()
	a, b, c, d, e := readN(), readN(), readN(), readN(), readN()
	sum := f(a) + f(b) + f(c) + f(d) + f(e)
	red := max(r(a), r(b), r(c), r(d), r(e))
	fmt.Println(sum - red)
}

func max(xs ...int) int {
	var n int
	for _, x := range xs {
		if n < x {
			n = x
		}
	}
	return n
}

func f(x int) int {
	return (x + 9) / 10 * 10
}

func r(x int) int {
	return f(x) - x
}

// ------以下、ユーティリティ------

var sc = bufio.NewScanner(os.Stdin)

func setSpace() {
	sc.Split(bufio.ScanWords)
}

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

func readN() int {
	n, err := strconv.Atoi(read())
	if err != nil {
		panic(err)
	}
	return n
}


Measured memory_bytes: 640
#include<cstdio>

int main(){
  int c[2][3];
  for(int i=0;i<2;i++){
    for(int j=0;j<3;j++){
      if(i==1&&j==2) c[i][j] = 5000;
      else scanf("%d",&c[i][j]);
    }
  }
  int ans = 0;
  int x = 5000;
  for(int i=0;i<3;i++) if(c[0][i]<x) x = c[0][i];
  ans += x;
  x = 5000;
  for(int i=0;i<3;i++) if(c[1][i]<x) x = c[1][i];
  ans += x;
  printf("%d\n",ans-50);
  return 0;
}

Measured memory_bytes: 2724
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int M;
  cin >> M;
  cout << 48-M << endl;
  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
using namespace std;
#define MAX 2147483647
long aray[400002];
int n;

int right(int k){
  return 2*k+2;
}
int left(int k){
  return 2*k+1;
}
int parent(int k){
  return (k-1)/2;
}
long query(int a,int b,int k,int l,int r){
  long res;
  if(r<=a || b<=l)res = MAX;
  else if(a<=l && r<=b)res = aray[k];
  else res = min(query(a,b,left(k),l,(l+r)/2),query(a,b,right(k),(l+r)/2,r));
  return res;
}
long findmin(int a,int b){
    return query(a,b,0,0,n);
}
void update(int k,long x){
  k = k+n-1;
  aray[k] =x;
  while(k>0){
    k=parent(k);
    aray[k]=min(aray[left(k)],aray[right(k)]);
  }
}
int main(){
  int com,q,x,y,p=2,i=0;
  cin>>n>>q;
  while(n>pow(p,i))i++;
  n = pow(p,i);
  p = n*2;
  for(i=0;i<p;i++)aray[i]=MAX;
  for(i=0;i<q;i++){
    cin>>com>>x>>y;
    if(!com)update(x,y);
    else cout<<findmin(x,y+1)<<endl;
  }
  return 0;
}



Measured memory_bytes: 5304
n = int(input())
m = [input() for i in range(n)]
 
ans = [0,0,0,0]
 
for i in m:
    if i == "AC":
        ans[0] += 1
    elif i == "WA":
        ans[1] += 1
    elif i == "TLE":
        ans[2] += 1
    elif i == "RE":
        ans[3] += 1
    
    
    
print("AC x "+str(ans[0])) 
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x "+str(ans[3]))

Measured memory_bytes: 16332
#include<iostream>

using namespace std;

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

    if(a>=13){
        cout << b << endl;
    } else if(a>=6 && a<=12){
        cout << b/2 << endl;
    } else{
        cout << 0;
    }

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	ll answer = 0, ModNumber = 0;
	string s;
	ll Mod2019Data[2019] = {};
	cin >> s;
	Mod2019Data[0]++;
	ll Pow10Mod2019 = 1;
	for (int i = s.length() - 1; i >= 0; i--)
	{
		ModNumber = (ModNumber + (s[i] - '0') * Pow10Mod2019) % 2019;
		Pow10Mod2019 = Pow10Mod2019 * 10 % 2019;
		Mod2019Data[ModNumber]++;
	}
	for (int i = 0; i < 2019; i++)
	{
		answer += Mod2019Data[i] * (Mod2019Data[i] - 1) / 2;
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
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;}
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

/*bool operator<(const data &d)const{
	return hoge;
}*/
 
const int dx[]={0,1,1,-1,-1,0};
const int dy[]={1,1,0,0,-1,-1};

 
signed main(){
	IOS();
	int t,n;
	vector<int>ans;
	while(cin>>t>>n,t||n){
		set<pair<int,int>>used,ng;
		rep(i,0,n){
			int x,y;
			cin>>x>>y;
			ng.insert({x,y});
		}
		queue<pair<pair<int,int>,int>>que;
		int sx,sy;
		cin>>sx>>sy;
		que.push({{sx,sy},0});
		while(!que.empty()){
			int i = que.front().fi.fi;
			int j = que.front().fi.se;
			int turn = que.front().se;
			que.pop();
			if(turn>t)continue;
			if(ng.count({i,j}))continue;
			if(used.count({i,j}))continue;
			used.insert({i,j});
			rep(k,0,6){
				que.push({{i+dx[k],j+dy[k]},turn+1});
			}
		}
		ans.push_back(used.size());
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}


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

int main(){

	int n, k;

	cin >> n >> k;

	int s = 1;

	for (int i = 0; i < n; i++){
		if (s > k){
			s += k;
		}else{
			s *= 2;
		}
	}

	cout << s << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MAXN 200009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int cnt[26],c[26],p[26],F[MAXN];
vector<int>adj[MAXN];
int tap(int x){
	int res=0;
	for(;x;x-=x&(-x))
		res+=F[x];
	return res;	
}
void upd(int x){
	for(;x<MAXN;x+=x&(-x))
		F[x]++;
}
ll solve(string x,string y){
	memset(F,0,sizeof F);
	assert(x.size()==y.size());
	for(int i=0;i<26;i++)
		adj[i].clear(),p[i]=0;
	for(int i=0;i<int(y.size());i++)
		adj[y[i]-'a'].pb(i);
	vector<int>vec;
	for(int i=0;i<int(x.size());i++)
		vec.pb(adj[x[i]-'a'][p[x[i]-'a']++]+1);
	ll res=0;	
	for(int i=vec.size()-1;i>=0;i--){
		res+=tap(vec[i]-1);
		upd(vec[i]);
	}	
	return res;
}
int main(){
    //~ freopen("file.in", "r", stdin);
    string s;
    cin>>s;
    int n=s.size();
    if(n==1){
		puts("0");
		return 0;
	}
    for(int i=0;i<n;i++)
		cnt[s[i]-'a']++;
	int pos=-1;	
	for(int i=0;i<26;i++)
		if(cnt[i]&1){
			if(~pos)
				return puts("-1")*0;
			pos=i;
		}
	if(~pos)	
		cnt[pos]--;	
	string A,B;	
	for(int i=0;i<n;i++)
		if(c[s[i]-'a']+1<=cnt[s[i]-'a']/2)
			A+=s[i],c[s[i]-'a']++;
	memset(c,0,sizeof c);		
	for(int i=n-1;i>=0;i--)
		if(c[s[i]-'a']+1<=cnt[s[i]-'a']/2)
			B+=s[i],c[s[i]-'a']++;		
	ll ans=solve(A,B);	
	reverse(all(B));		
	if(pos==-1)
		ans+=solve(s,A+B);
	else
		ans+=solve(s,A+char(97+pos)+B);
	printf("%lld\n",ans);	
	return 0;
}


Measured memory_bytes: 9328
#!/usr/bin/env python3


def main():
    N = int(input())
    ac, wa, tle, re = 0, 0, 0, 0

    for i in range(N):
        s = input()
        if s == 'AC':
            ac += 1
        elif s == 'WA':
            wa += 1
        elif s == 'TLE':
            tle += 1
        elif s == 'RE':
            re += 1

    print(f'AC x {ac}')
    print(f'WA x {wa}')
    print(f'TLE x {tle}')
    print(f'RE x {re}')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9196
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve()
{
    int a, b;
    cin >> a >> b;
    bool ok = false;
    if (a % 3 == 0)
        ok = true;
    if (b % 3 == 0)
        ok = true;
    if ((a + b) % 3 == 0)
        ok = true;
    if (ok)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
}

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

Measured memory_bytes: 3540
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextLineInt() int {
	b, _ := strconv.Atoi(nextLine())
	return b
}

func nextLineIntSlice() []int {
	a := strings.Split(nextLine(), " ")
	var b []int
	for _, v := range a {
		t, _ := strconv.Atoi(v)
		b = append(b, t)
	}
	return b
}

func main() {
	n := nextLineInt()

	var m int
	for {
		if n%2 == 0 {
			m = n
			break
		}
		n = n * 2
	}
	fmt.Println(m)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
const double PI = 3.14159265358979323846;
using namespace std;

int main()
{
    double A,B,H,M;
    cin >> A >> B >> H >> M;
    double rad_dif,X;
    rad_dif = fabs(((H*60 + M)/720) - (M/60))*2*PI;
    X = sqrt(pow(A,2) + pow(B,2) - 2*A*B*cos(rad_dif));
    cout << setprecision(20) << X <<endl;
}

Measured memory_bytes: 4120
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL

struct UnionFind {
  vi par, count;

  UnionFind(int N) : par(N), count(N, 1){
    for(int i = 0; i < N; i++) par.at(i) = i;
  }

  int root(int x){
    if(par.at(x) == x) return x;
    return par.at(x) = root(par.at(x));
  }

  int unite(int x, int y){
    if(root(x) == root(y)) return 0;
    if(size(x) < size(y)){
      count.at(root(y)) += count.at(root(x));
      par.at(root(x)) = root(y);
    }
    else{
      count.at(root(x)) += count.at(root(y));
      par.at(root(y)) = root(x);
    }
    return 1;
  }

  bool same(int x, int y){
    return root(x) == root(y);
  }

  int size(int x){
    return count.at(root(x));
  }
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vll p(N);
  for(int i = 0; i < N; i++){
    cin >> p.at(i);
    p.at(i)--;
  }
  UnionFind tree(N);
  for(int i = 0; i < M; i++){
    ll x, y;
    cin >> x >> y;
    x--; y--;
    tree.unite(x, y);
  }
  ll ans = 0;
  for(int i = 0; i < N; i++){
    if(tree.same(i, p.at(i))) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
	int main(){
		int n;
		cin>>n;
		n%=10;
		if(n==3)
			cout<<"bon\n";
		else if(n==0||n==1||n==6||n==8)
			cout<<"pon\n";
		else
			cout<<"hon\n";
	}

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

int main() {
  ll n,sum_A=0;
  cin>>n;
  for(int i=1; i<=n; i++){
    if(i%3!=0 && i%5!=0){
      sum_A+=i;
    }
  }
  cout<<sum_A<<endl;
}

Measured memory_bytes: 3628
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define F first
#define S second


int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
//ios_base& scientific (ios_base& str);

	string s;
	cin >> s;
	string out = "";
	for (auto i : s)
	{
		if (i == '?')
			out += 'D';
		else
			out += i;
	}
	cout << out << "\n";
	return 0;
}

Measured memory_bytes: 3876
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

struct vec
{
    double x, y;
    vec (const double& x0 = 0, const double& y0 = 0) : x(x0), y(y0) {}
    vec operator + (const vec& t) const {return vec(x+t.x, y+t.y);}
    vec operator - (const vec& t) const {return vec(x-t.x, y-t.y);}
    vec operator * (const double& t) const {return vec(x*t, y*t);}
    vec operator / (const double& t) const {return vec(x/t, y/t);}
    const double len2 () const {return x*x + y*y;}
    const double len () const {return sqrt(len2());}
    vec norm() const {return *this/len();}
    vec rotate_90_c () {return vec(y, -x);}
};

double dot(const vec& a, const vec& b) {return a.x*b.x + a.y*b.y;}
double crs(const vec& a, const vec& b) {return a.x*b.y - a.y*b.x;}

vec lin_lin_int(const vec& p0, const vec& v0, const vec& p1, const vec& v1)
{
    double t = crs(p1-p0, v1) / crs(v0, v1);
    return p0 + v0 * t;
}

vec circle(const vec& a, const vec& b, const vec& c)
{
    return lin_lin_int((a+b)/2, (b-a).rotate_90_c(), (a+c)/2, (c-a).rotate_90_c());
}

int n;
vec pot[100005];

int main()
{
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%lf%lf", &pot[i].x, &pot[i].y);
    random_shuffle(pot+1, pot+n+1);
    vec o;
    double r2 = 0;
    for(int i=1; i<=n; i++)
    {
        if((pot[i]-o).len2() > r2)
        {
            o = pot[i], r2 = 0;
            for(int j=1; j<i; j++)
            {
                if((pot[j]-o).len2() > r2)
                {
                    o = (pot[i]+pot[j])/2, r2 = (pot[j]-o).len2();
                    for(int k=1; k<j; k++)
                    {
                        if((pot[k]-o).len2() > r2)
                        {
                            o = circle(pot[i], pot[j], pot[k]), r2 = (pot[k]-o).len2();
                        }
                    }
                }
            }
        }
    }
    printf("%.10lf\n", sqrt(r2));
    return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

#define PI 3.141592

struct C {
    double x;
    double y;
};


void kock(int n, C p1, C p2){
    if (n == 0) return;
    
    C s, t, u;
    
    s.x = (2*p1.x + 1*p2.x)/3;
    s.y = (2*p1.y + 1*p2.y)/3;
    t.x = (1*p1.x + 2*p2.x)/3;
    t.y = (1*p1.y + 2*p2.y)/3;
    
    u.x = (t.x - s.x)*cos(PI/3) - (t.y - s.y)*sin(PI/3) + s.x;
    u.y = (t.x - s.x)*sin(PI/3) + (t.y - s.y)*cos(PI/3) + s.y;
    
    kock(n-1, p1, s);
    printf("%.8f %.8f\n", s.x, s.y);
    kock(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    kock(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    kock(n-1, t, p2);
}

int main(){
    int n;
    cin >> n;
    C p1, p2;
    p1.x = 0.00;
    p1.y = 0.00;
    p2.x = 100.00;
    p2.y = 0.00;
    printf("%.8f %.8f\n", p1.x, p2.y);
    kock(n, p1, p2);
    printf("%.8f %.8f\n", p2.x, p2.y);
    
    return 0;
}


Measured memory_bytes: 3216
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back

using namespace std;

using ll = long long;
using P = pair<int,int>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60, lmod = 1e9+7;

const int MAX_N = 2003;

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

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

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))

typedef unsigned long long ull;
const ull c = 1145148931919LL;

ull ro[1000100];
ull tei[1000100];
int nn;
bool check(int a, int b, int c, int d) {
	if(a < 0 || c < 0) return false;
	if(nn <= b || nn <= d) return false;
	ull aa = ro[b];
	ull bb = ro[d];
	if(a) aa += -ro[a - 1] * tei[b - a + 1];
	if(c) bb += -ro[c - 1] * tei[d - c + 1];
	return aa == bb;
}



template<class T>
struct RollingHash {
	static const int NN = 2; // the number of hash table
	T base[NN] = {1009, 1007};
	T PMOD[NN] = {1000000007, 1000000009};
	vector<T> hash[NN];
	vector<T> mypow[NN];
	int sz;
	void init(string s) {
		sz = s.size();
		for(int i = 0; i < NN; i++) {
			hash[i].assign(sz + 1, 0);
			mypow[i].assign(sz + 1, 0);
			mypow[i][0] = 1;
		}
		for(int i = 0; i < NN; i++) {
			for(int j = 0; j < sz; j++) {
				hash[i][j + 1] = (hash[i][j] * base[i] + s[j]) % PMOD[i];
				mypow[i][j + 1] = mypow[i][j] * base[i] % PMOD[i];
			}
		}
	}
	RollingHash() {
	}
	T get(int l, int r, int t) {
		T ret = (hash[t][r + 1] - hash[t][l] * mypow[t][r - l + 1] % PMOD[t] + PMOD[t]) % PMOD[t];
		return ret;
	}
	// compare s[a..b] and s[c..d]
	bool comp(int a, int b, int c, int d) {
		if(a < 0 || sz <= b || c < 0 || sz <= d) return false;
		for(int i = 0; i < NN; i++) {
			if(get(a, b, i) != get(c, d, i)) return false;
		}
		return true;
	}
	int LCE(int l,int r){
		tie(l,r)=minmax(l,r);
		if(l==r) return sz-r+1;
		int ll = 0;
		int rr = sz;
		while(rr-ll>1){
			int mid = (ll+rr)>>1;
			if(comp(l,l+mid-1,r,r+mid-1)) ll=mid;
			else rr=mid;
		}
		return ll;
	}
};

RollingHash<long long> rhash1;

int calc1(int l, int r) {
	return rhash1.LCE(l,r);
	int ll = 0;
	int rr = INT_MAX / 10;
	while(rr - ll > 1) {
		int mid = (ll + rr) / 2;
		if(rhash1.comp(l, l + mid - 1, r, r + mid - 1)) {
			ll = mid;
		}
		else {
			rr = mid;
		}
	}
	return ll;
}

int calc2(int l, int r) {
	int ll = 0;
	int rr = INT_MAX / 10;
	while(rr - ll > 1) {
		int mid = (ll + rr) / 2;
		if(rhash1.comp(l - mid + 1, l, r - mid + 1, r)) {
			ll = mid;
		}
		else {
			rr = mid;
		}
	}
	return ll;
}

int main() {
	string s, t;
	cin >> s >> t;
	string a = s + t;
	nn = a.size();
	int n = s.size();
	int m = t.size();
	int ans = 0;
	rhash1.init(a);
	rep(i, n) {
		if(i + m - 1 >= n) break;
		int l = calc1(i, n);
		int r = calc2(i + m - 1, n + m - 1);
		if(l + r + 1 == m) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 18512
#include <bits/stdc++.h>
#define int             long long
#define ld              long double
#define rep0(i,n)       for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rep(i,x,y)      for(int i=x;i<=y;i++)
#define reprev1(i,n)    for(int i=n;i>0;i--)
#define reprev0(i,n)    for(int i=n-1;i>=0;i--)
#define reprev(i,x,y)   for(int i=x;i>=y;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcount(x)
#define zerobits(x)     __builtin_ctz(x)
#define in(a,n)         vi a(n);rep0(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define endl            '\n'
#define mod             1000000007
#define Max             (int)1e6+6
#define inf             1e18
using namespace std;

int n,m,k,x,y,z,a1,b,c,d,i,j;





void sol()
{   
    cin>>n>>m;
    int dp[n][m]={};
    rep0(i,n)rep0(j,m){char x;cin>>x;if(x=='#')dp[i][j]=-1;}
    if(dp[0][0]==-1 || dp[n-1][m-1]==-1){cout<<0<<endl;return;}
    rep0(j,m)
    {
        if(dp[0][j]==-1)break;
        dp[0][j]=1;
    }
    rep0(i,n)
    {
        if(dp[i][0]==-1)break;
        dp[i][0]=1;
    }

    rep1(i,n-1)
    {
        rep1(j,m-1)
        {
            if(dp[i][j]==-1)continue;
            if(dp[i-1][j]!=-1)dp[i][j]+=dp[i-1][j];
            dp[i][j]%=mod;
            if(dp[i][j-1]!=-1)dp[i][j]+=dp[i][j-1];
            dp[i][j]%=mod;


        }
    }
    
    cout<< (dp[n-1][m-1]%mod) <<endl;
}





int32_t main(){

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // w(t)
    sol();
    return 0;
}



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

int main() {
        int n, k;
        string s;
        cin >> n >> k >> s;
        bool all = true;
        rep(i, n) if (s[i] == '1') all = false;
        if (all) {
                cout << n << endl;
                return 0;
        }
        bool fadd = s.front() == '0';
        bool badd = s.back() == '0';
        if (fadd) s = '1' + s;
        if (badd) s = s + '1';
        int cur = 1;
        vector<int> v;
        rep(i, s.size()) {
                if (s[i] != s[i + 1]) {
                        v.push_back(cur);
                        cur = 1;
                } else {
                        cur ++;
                }
        }
        vector<int> acc(v.size());
        acc[0] = v[0];
        rep(i, acc.size()) if (i) acc[i] = acc[i - 1] + v[i];
        int ans = 0;
        int p = acc.size() - 1;
        for (int l = 0; l < acc.size(); l += 2) {
                int r = min(l + 2 * k + 1 - 1, p);
                if (l == 0) ans = max(ans, acc[r] - fadd);
                else if (r == p) ans = max(ans, acc[r] - acc[l - 1] - badd);
                else ans = max(ans, acc[r] - acc[l - 1]);
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 1336
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    ll N,K;
    cin >> N >> K;
    vec<ll> A(N);
    rep(i,N) {
        cin >> A[i];
        --A[i];
    }
    int log2 = 0;
    while((1LL<<log2)<K) ++log2;

    vec<vec<int>> dbl(log2+1,vec<int>(N));
    rep(i,N) dbl[0][i] = A[i];

    rep(i,log2)rep(j,N){
        dbl[i+1][j] = dbl[i][dbl[i][j]];
    }

    int now = 0;
    rep(i,log2+1){
        if(K&(1LL<<i)) now = dbl[i][now];
    }
    cout << now+1 << endl;
}

Measured memory_bytes: 53332
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

template<class T> T umax(T a,T b) {return (a>b?a:b);}
template<class T> T umin(T a,T b) {return (a<b?a:b);}
template<class T,class P> T umax(T a,P b) {return (a>b?a:b);}
template<class T,class P> T umin(T a,P b) {return (a<b?a:b);}

typedef long long int ll;
const int maxn = 1e5+7;
const ll mod = 1e9+7;

bool compare(const pair<ll,ll>& x, const pair<ll,ll>& y) {
    if(x.second == y.second) return x.first < y.first;
    return x.second < y.second;
}

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) {
            res = (res*a)%mod;
        }
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

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



int main() {
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;i++) {
        cin >> a[i];
    }
    vector<int> dp(n,1e9);
    dp[0] = 0;
    for(int i=1;i<n;i++) {
        for(int j=1;j<=k;j++) {
            if(i-j >= 0) {
                dp[i] = min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
            }
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

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

int main(){
	ll x,h=0;
	scanf("%lld",&x);
	if(x>=500){
		h += (x/500)*1000;
		x = x%500;
	}
	if(x>=5){
		h += (x/5)*5;
		x = x%5;
	}
	printf("%lld\n",h);
	return 0;
}

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

int main(){
  int K;cin>>K;
  int A,B;
  cin>>A>>B;
  for(int i=A;i<=B;i++){
    if(i%K==0){
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3128
import bisect
def main():

    N, M, V, P = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()

    prefix = [0]
    for i in range(N):
        prefix.append(prefix[-1] + A[i])

    ans = P
    for i in range(N-P):
        if A[i] + M >= A[N-P]:
            v = i * M + P * M
            v += (A[i] + M) * (N-P-i)
            v -= prefix[N-P+1] - prefix[i+1]
            if v >= M * V:
                ans += 1

    return ans

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 14484
N = int(input())
a = [input() for i in range(N)]
 
countac = 0
countwa = 0
counttle = 0
countre = 0
for A in a:
  if A == "AC":
    countac += 1
  elif A == "WA":
    countwa += 1
  elif A == "TLE":
    counttle += 1
  elif A == "RE":
    countre += 1

print("AC x %d" % countac)
print("WA x %d" % countwa)
print("TLE x %d" % counttle)
print("RE x %d" % countre)   

Measured memory_bytes: 16248
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  string S;
  cin>>S;
  ll sum=1, MOD=1000000007, A=0, AB=0, ABC=0;
  int i=-1;
  while(++i<S.length()){
    if(S[i]=='A')
      A+=sum;
    if(S[i]=='B')
      AB+=A;
    if(S[i]=='C')
      ABC+=AB;
    if(S[i]=='?'){
      ABC=ABC*3+AB;
      AB=AB*3+A;
      A=A*3+sum;
      sum*=3;
    }
    A%=MOD;
    AB%=MOD;
    ABC%=MOD;
    sum%=MOD;
  }
  cout<<ABC<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;


int main() {
	int n, m,k; long long ans = 0;
	vector<int> a;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> k;
		a.push_back(k);
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < m;i++) {
		int v = a[n - 1] / 2;
		int l = 0, r = n - 1;
		while (l<r) {
			int mid = (l + r) / 2;
			if (a[mid] == v) {
				l = r = mid;
			}
			else if (a[mid] > v) r = mid;
			else l = mid + 1;
		}
		a.insert(a.begin() + l, v);
	}
	for (int i = 0; i < n; i++) {
		ans += a[i];
	}
	cout << ans << endl;
}


Measured memory_bytes: 1400
// Atcoder_157B - Bingo
#include<bits/stdc++.h>
using namespace std;
int main()
{
    bool has[101];
    memset(has, 0, sizeof has);
    int a[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    int b[n];
    for(int i=0; i<n; i++){
        cin >> b[i];
        has[b[i]] = 1;
    }
    for(int i=0; i<3; i++){
        bool all = 1;
        for(int j=0; j<3; j++){
            if(!has[a[i][j]]){
                all = 0;
                break;
            }
        }
        if(all){
            return cout << "Yes" << endl, 0;
        }
    }
    for(int i=0; i<3; i++){
        bool all = 1;
        for(int j=0; j<3; j++){
            if(!has[a[j][i]]){
                all = 0;
                break;
            }
        }
        if(all){
            return cout << "Yes" << endl, 0;
        }
    }
    bool all = 1;
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            if(i == j){
                if(!has[a[i][j]]){
                    all = 0;
                    break;
                }
            }
        }
    }
    if(all){
        return cout << "Yes" << endl, 0;
    }
    all = 1;
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            if(i+j == 2){
                bool ck = 0;
                if(!has[a[i][j]]){
                    all = 0;
                    break;
                }
            }
        }
    }
    if(all){
        return cout << "Yes" << endl, 0;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#template
def inputlist(): return [int(k) for k in input().split()]
#template
A,B,K = inputlist()
M = max(A,B)
li = []
for i in range(1,M+10):
    if A % i == 0 and B % i == 0:
        li.append(i)
li.reverse()
print(li[K-1])

Measured memory_bytes: 3064
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int MAXN=1e6+50;
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
ll vis[MAXN];
ll prime[MAXN];
void init()
{
    for(int i=2;i<MAXN;i++)
    {
        if(!vis[i])
        {
            for(int j=i+i;j<MAXN;j+=i)
            {
                prime[j]=1;
                vis[j]=1;
            }
        }
    }
}
int main()
{
    init();
    ll a,b;
    cin>>a>>b;
    ll g=gcd(a,b);
    ll ans=1;
    if(g==1)
    {
        cout<<1<<endl;
        return 0;
    }
    ll x=sqrt(g);
    for(int i=2;i<=x;i++)
    {
        if(g%i==0&&prime[i]!=1)
        {
            ans++;
        }
    }
    for(int i=2;i<=x;i++)
    {
        if(g%i==0&&prime[i]!=1)
        {
            while(1)
            {
                if(g%i==0)
                    g/=i;
                else break;
            }
        }
    }
    if(g==1)
        cout<<ans<<endl;
    else cout<<ans+1<<endl;;
    return 0;
}


Measured memory_bytes: 15872
#include <iostream>
 #include <vector>
 #include <map>
 #include <string>
 #include <algorithm>
 using namespace std;

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

 typedef long long ll;
 const long long INF = 1LL << 60;



 int main()
 {
    int n;
    cin >> n;

    cout << n * n << endl;


    return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define cin (type == 0?cin:fin)
//#define cout (type == 0?cout:fout)
#define tcn cin.tie(0);
#define tct cout.tie(0);
#define r_0 return 0
#define ll long long
#define TIME ios_base::sync_with_stdio(0);
using namespace std;

const long long N = 2e3 + 7;
const long long MrBeast = 1e9;

ll T = 1, n, m, x, a[N];
vector < ll > v, t;
int type = 0;
set< ll > st;
pair< ll ,ll > p[N];
int main()
{
    TIME
    //ifstream  fin("swap.in");
    //ofstream  fout("swap.out");
    cin >> n >> m;
    long double ans = 0;
    for ( int i=0; i<n; i++ ){
        cin >> a[i];
        ans += a[i];
    }
    long double cnt = ans / ( 4 * m );
    for ( int i=0; i<n; i++ ){
        if ( a[i] >= cnt )
            x ++;
        if ( x == m )
            return cout << "Yes", 0;
    }
    cout << "No";
}


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

int main(void) 
{
	int a[4] ;
	scanf("%d%d%d",&a[0],&a[1],&a[2]) ;
	printf("%d %d %d\n",a[2],a[0],a[1]) ;
	return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,i;
  cin >> n;
  vector<int> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  int ans =0;
  for(i=0;i<n;i++){
    while(a[i] % 2 == 0){
      a[i] = a[i] /2;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8

# In[25]:


s = input()


# In[29]:


dic = {'a': 0, 'b': 0, 'c': 0}


# In[30]:


for c in s:
    if c in dic:
        dic[c] += 1


# In[31]:


if dic['a'] == 1 and dic['b'] == 1 and dic['c'] == 1:
    print ('Yes')
else:
    print ('No')



Measured memory_bytes: 2940
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var s = ReadLine();
        var t = ReadLine();
        var pre = -1;
        for(var i = 0; i < num; i++)
            if (t.Substring(0, num - i) == s.Substring(i))
            {
                pre = i;
                break;
            }
        if (pre == -1) pre = num;
        WriteLine(num+pre);
    }
}


Measured memory_bytes: 11220
#![allow(unused)]

use std::{cell, cmp, collections, convert, fmt, io, iter, ops, str};

use cell::{Cell, RefCell};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($($args: tt)*) => { eprint!($($args)*) };
}

#[cfg(feature = "debug")]
macro_rules! debugln {
    ($($args: tt)*) => { eprintln!($($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($($args:tt)*) => {};
}

#[cfg(not(feature = "debug"))]
macro_rules! debugln {
    ($($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn main() {
    let n = parse_line::<i32>();
    let sn = {
        let mut n = n;
        let mut sn = 0;
        while n != 0 {
            sn += n % 10;
            n /= 10;
        }
        sn
    };

    if n % sn == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}

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

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if !buf.is_empty() {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn next_prime(x: i32) -> i32 {
    for i in (x + 1).. {
        if is_prime(i) {
            return i;
        }
    }

    panic!("attempt to add with overflow");
}

fn is_prime(x: i32) -> bool {
    let ceil = f64::from(x).sqrt().ceil() as i32;
    x == 2 || (2..(ceil + 1)).all(|i| x % i != 0)
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <map>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    size_t len = 3;
    vector< vector<int> > vec(len, vector<int>(len));  // (N, M) array 0で初期化
    int max_num = -1;
    REP(i, len) {
        REP(j, len) {
            cin >> vec[i][j];
        }
    }
    
    // calculation
    int max_r0 = *MAX(vec[0]), max_r1 = *MAX(vec[1]), max_r2 = *MAX(vec[2]);
    int a1, a2, b0, b1, b2;
    vector<int> a2_candidate(3), a3_candidate(3);
    int a2_can, a3_can, num_a2, num_a3;
    
    for (int a0 = 0; a0 <= max_r0; ++a0) {
        // b0
        b0 = vec[0][0] - a0;
        b1 = vec[0][1] - a0;
        b2 = vec[0][2] - a0;
        
        // a2 candidate
        a2_candidate[0] = vec[1][0] - b0;
        a2_candidate[1] = vec[1][1] - b1;
        a2_candidate[2] = vec[1][2] - b2;
        
        // a3 candidate
        a3_candidate[0] = vec[2][0] - b0;
        a3_candidate[1] = vec[2][1] - b1;
        a3_candidate[2] = vec[2][2] - b2;
        
        a2_can = a2_candidate[0];
        a3_can = a3_candidate[0];
        
        num_a2 = 0;
        num_a3 = 0;
        
        REP(i, 3) {
            if (a2_candidate[i] < 0 || a3_candidate[i] < 0) break;
            if (a2_can == a2_candidate[i]) num_a2++;
            if (a3_can == a3_candidate[i]) num_a3++;
        }
        
        if (num_a2 == 3 && num_a3 == 3) {
            cout << "Yes" << "\n";
            return 0;
        }
    }
    
    cout << "No" << "\n";
    
    return 0;
}


Measured memory_bytes: 256