akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int N; cin>>N;
  string S; cin>>S;

  int ise[N]={};
  int isw[N]={};

  reps(i,1,N){
    ise[i]= ise[i-1]+ (S[i-1]=='E');
  }

  repr(i,N-2,0){
    isw[i]= isw[i+1]+ (S[i+1]=='W');
  }
  
  int ans=INF;
  rep(i,N){
    int temp;
    temp=N-ise[i]-isw[i]-1;
    mini(ans,temp);
  }

  cout<< ans<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 2964
import math
a , b = map(int,input().split())
al = math.ceil(a / 0.08)
ar = math.floor((a + 1)/0.08)
bl = math.ceil(b/0.1)
br = math.floor((b+1)/0.1)
ans = 0
if al <= bl and ar > bl:
    ans = bl
elif al >= bl and br > al:
    ans = al
else:
    ans = -1
# if al == bl:
#     ans = al
# elif al > bl:
#     if al > br:
#         ans = -1
#     else:
#         ans = al
# elif al < bl:
#     if ar < bl:
#         ans = -1
#     else:
#         ans = bl
if ar < al or br < bl:
    ans = -1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>

using namespace std;

inline void Cmin(int &a, int b) {
	if (a > b) a = b;
	return;
}

const int N = 200010;

int n;
int a[N], b[N];

namespace Segment_Tree {

#define lc k << 1
#define rc k << 1 | 1

	struct Node {
		int l, r, Min[2];
	} p[N << 2];

	void Build(int k, int l, int r) {
		p[k].l = l;
		p[k].r = r;
		if (l == r) {
			p[k].Min[l & 1] = a[l];
			p[k].Min[(l & 1) ^ 1] = n + 1;
			return;
		}
		int m = (l + r) >> 1;
		Build(lc, l, m);
		Build(rc, m + 1, r);
		p[k].Min[0] = min(p[lc].Min[0], p[rc].Min[0]);
		p[k].Min[1] = min(p[lc].Min[1], p[rc].Min[1]);
		return;
	}

	int Query(int k, int l, int r, int bit) {
		if (l <= p[k].l && p[k].r <= r) return p[k].Min[bit];
		int Min = n + 1;
		if (l <= p[lc].r) Cmin(Min, Query(lc, l, r, bit));
		if (p[rc].l <= r) Cmin(Min, Query(rc, l, r, bit));
		return Min;
	}

#undef lc
#undef rc

}

struct Node {
	Node (int l = 0, int r = 0, int Min = n + 1) : l(l), r(r), Min(Min) {}
	int l, r, Min;
	bool operator < (const Node &a) const {
		return Min > a.Min;
	}
};

priority_queue<Node> pq;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		b[a[i]] = i;
	}
	Segment_Tree::Build(1, 1, n);
	pq.push(Node(1, n, Segment_Tree::Query(1, 1, n, 1)));
	for (int i = 1; i <= n && !pq.empty(); i += 2) {
		Node cur = pq.top();
		pq.pop();

#define l cur.l
#define r cur.r
#define Min cur.Min

		int k1 = b[Min], k2 = b[Segment_Tree::Query(1, k1, r, (k1 & 1) ^ 1)];
        printf("%d %d ", a[k1], a[k2]);
        if (l < k1) pq.push(Node(l, k1 - 1, Segment_Tree::Query(1, l, k1 - 1, l & 1)));
        if (k1 + 1 < k2) pq.push(Node(k1 + 1, k2 - 1, Segment_Tree::Query(1, k1 + 1, k2 - 1, (k1 + 1) & 1)));
        if (k2 < r) pq.push(Node(k2 + 1, r, Segment_Tree::Query(1, k2 + 1, r, (k2 + 1) & 1)));
        
#undef l
#undef r
#undef Min

	}
	putchar('\n');
	return 0;
}

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

using namespace std;
typedef long long LL;
const LL mod=1000000007;
const int Max_Num=100010;

LL modinv(LL x){
	LL m=mod, u=1, v=0;
	while(m){
		LL t=x/m;
		x-=t*m; swap(x,m);
		u-=t*v; swap(u,v);
	}
	u%=mod;
	if(u<0) u+=mod;
	return u;
}

int main(){
  int N, K;
  cin >> N >> K;
  int A[Max_Num];
  rep(i,N) cin >> A[i];
  sort(A,A+N);
  LL F[Max_Num], Finv[Max_Num];
  F[0]=1;
  rep(i,Max_Num-1){
  	F[i+1]=F[i]*(i+1);
  	F[i+1]%=mod;
  }
  rep(i,Max_Num) Finv[i]=modinv(F[i]);
  LL MaxSum=0, MinSum=0;
  for(int i=K; i<=N; i++) MaxSum+=A[i-1]*F[i-1]%mod*Finv[K-1]%mod*Finv[i-K]%mod;
  for(int i=N-K+1; i>=1; i--) MinSum+=A[i-1]*F[N-i]%mod*Finv[K-1]%mod*Finv[N-K+1-i]%mod;
  LL ans=(MaxSum-MinSum)%mod;
  while(ans<0) ans+=mod;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2176
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pll >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll inf=1e18+1e17;
const ll mod =inf;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}

const ll N =2e5 + 6;

vii graph[N];
int arr[N];
//(a – b)(a4 + a3b + a2b2 + ab3 + b4)
// ( a-b)( (a3+b3)( a+b)+ a2b2)
void solve(){
	ll x;

	cin>>x;

	/*//cout<<powm( 1e3,5);//-powm( 1e3-1,5)<<'\n';
	for ( int i=-1e3;i<=1e3;i++){
		ll val=powm(i,5)-x;
		//cout<<val<<'\n';
		ll lb=-1e3,ub=1e3;
		int t=22;
		while ( t--){
			ll mid=(lb+ub)/2;
			ll val2=powm( mid,5);
			if ( val2==val){
				cout<<i<<' '<<mid<<'\n';
				return;
			}
			if ( val2<val){
				lb=mid+1;
			}
			else
			{
				ub=mid;
			}
		}
	}
*/
	map < ll, ll > m;
	ll total=0;
	for ( int i=0;i<x;i++){
		ll aa;
		cin>>aa;
		total+=m[i-aa];
		m[i+aa]++;
	}
	cout<<total<<'\n';

}


int main(){
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif	*/
    ll t=1;
	//cin>>t;
    for (ll i=1;i<=t;i++){
    //	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}

Measured memory_bytes: 31036
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

const int MAX = 1400;
const int INF = INT_MAX / 3;
const int GOOD = 0;
const int BAD = 1;

int main() {
	int H, W;
	cin >> H >> W;	
	vector<vector<int>> tiles(H, vector<int>(W));	
	int	dp[MAX][MAX];
	rep(i, H) rep(j, W) cin >> tiles[i][j];

	int ans = 0;
	rep(i, H) {
		rep(j, W) {
			dp[i][j] = (tiles[i][j] == BAD) ? 0 : 1;
			ans = max(ans, dp[i][j]);
		}
	}	
	
	REP(i, 1, H) {
		REP(j, 1, W) {
			if(tiles[i][j] == BAD) {
				dp[i][j] = 0;
			} else {
				dp[i][j] = min(dp[i-1][j-1], min(dp[i][j-1], dp[i-1][j])) + 1;
			}
			ans = max(ans, dp[i][j]);
		}
	}
	
	cout << ans * ans << endl;	
	
	return 0;
}

Measured memory_bytes: 16368
#include<cstdio>
long long n,k,a[500005],f[500005],cnt;
int dfs(int i,long long k){
    if(k==0)return i;
    if(!f[i])return f[i]=cnt++,dfs(a[i],k-1);
    else{
        k%=(cnt-f[i]);int ret=i;
        for(int i=1;i<=k;i++)ret=a[ret];
        return ret;
    }
}
int main(){
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)scanf("%lld",a+i);
    printf("%d\n",dfs(1,k));
}


Measured memory_bytes: 4860
#include <stdio.h>
#include <math.h>

int isprime(int);
int main(void)
{
	int n, x[10000], i, a = 0;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}
	for (i = 0; i < n; i++) {
		if(isprime(x[i]) == 1)
			a++;
	}
	printf("%d\n", a);
	return 0;
}

int isprime(int x)
{
	int i;
	if (x == 2)
		return 1;
	if (x < 2 || x % 2 == 0)
		return 0;
	for (i = 3; i <= (int)sqrt((double)x); i += 2) {
		if (x % i == 0)
			return 0;
	}
	return 1;
}

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

int main(){
  int N;
  cin >>N;
  for(int i=0; i<=25; i++){
    for(int j=0;j<=14; j++){
      if(N==4*i+7*j){ cout << "Yes"; return 0;}
    }
  }
  cout << "No";
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;

int toInt(string x){
    stringstream ss ;
    ss << x ; 
    int y ; 
    ss >> y ;
    return y  ;
}

int main(){
    fastio
    string s ;
    cin >> s ; 
    int n = (int) s.size() ;
    int ans = 1e9 ; 
    for(int i = 0; i + 3 <= n; i++){
        int x = toInt(s.substr(i,3));
        ans = min(ans, abs(x - 753));
    }
    cout << ans << endl;
    return 0 ;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N;
    string s, t;
    cin >> N >> s >> t;

    if (N <= 2) {
        int ans = 0;
        for (int i = 0; i < N; i++)
            ans += s[i] != t[i];
        cout << ans << endl;
        return 0;
    }

    vi a, b;

    for (int i = 1; i < N; i++) {
        if (s[i] != s[i-1]) a.push_back(i);
        if (t[i] != t[i-1]) b.push_back(i);
    }

    int ans = INT_MAX;

    int range = a.size();
    bool par = s[0] != t[0];
    if ((range&1) != par)
        range++;

    for (int off = -range; off <= range; off += 2) {
        int pos = 0;

        for (int i = 0; i < a.size(); i++) {
            int tar;
            if (i + off < 0) tar = 0;
            else if (i + off >= b.size()) tar = N;
            else tar = b[i + off];
            pos += abs(a[i] - tar);
        }

        for (int i = 0; i < b.size(); i++) {
            if (i - off < 0) pos += abs(b[i]);
            else if (i - off >= a.size()) pos += abs(b[i] - N);
        }

        ans = min(ans, pos);
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2000000000; //2e9
const long long INF2 = 8000000000000000000; //8e18

const int large_P = 1000000007; //1e9 + 7
//const int large_P = 1000000009; //1e9 + 9
//const int large_P = 998244353;




signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N; cin >> N;
	vector<int> L(N);
	rep(i, N) cin >> L.at(i);

	sort(L.begin(), L.end());
	int res = 0;
	rep(i, N) {
		auto iter1 = L.begin();
		for (int j = i + 1; j < N; j++) {
			//if (j == i) continue;

			auto iter_begin = L.begin();
			if (iter1 == L.begin()) iter_begin = L.begin() + j;
			else iter_begin = iter1;

			iter1 = lower_bound(iter_begin, L.end(), L.at(i) + L.at(j));
			//res += (L.end() - iter1);

			int tempo = iter1 - L.begin();
			tempo--;

			if (tempo - j > 0) res += tempo - j;
			//cout << i << " " << j << " " << tempo << endl;
		}
	}


	cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int N;  /* 人数 */
	int K;  /* 身長制限 */
	int ans=0;
	scanf("%d", &N);
	scanf("%d", &K);

	int h[N];  /* 身長配列 */
	for( int i=0; i<N; i++ ){
		scanf("%d", &h[i]);
	}

	for( int j=0; j<N; j++ ){
		if( h[j]>=K ){
			ans++;
		}
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

long long s(int a, int b){
  long long ans = 1;
  while(b--){
    ans *= a;
  }
  return ans;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  int tim = 100*(N-M) + M * 1900;
  int p = s(2,M);
  cout << tim * p << endl;
  return 0;
}


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

using namespace std;

int main() {
	int n, q;
	cin >> n >> q;
	
	string s;
	cin >> s;

	int current = 0;
	int idx = s.size() - 2;
	int next_idx = 0;
	vector<int> count = {};

	while ((next_idx = s.rfind("AC", idx)) != -1 ) {
		for (int i = 0; i < idx - next_idx + 1; i++) {
			count.push_back(current);
		}
		current++ ;
		if (next_idx >= 1) {
			idx = next_idx - 1;
		} else {
			break;
		}
	}

	int diff = 0;
	if (next_idx != 0) {
		diff = 2;
	}

	for (int i = 0; i < idx + diff; i++) {
		count.push_back(current);
	}

	reverse(count.begin(), count.end());

	vector<int> result = {};
	int l, r;
	for (int i = 0; i < q; i++) {
		cin >> l >> r;
		result.push_back(count[l-1] - count[r-1]);
	}

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


Measured memory_bytes: 1976
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b + 1 == d) cout << 0;
    else cout << 1;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>

using namespace std;

int main(void){
    unsigned long long int X,interest;
    unsigned long long int deposit = 100;
    int i =0;

    cin >> X;

    while(deposit <= pow(10,18)){
        i++;
        interest = (unsigned long long int)(deposit * 0.01);
        deposit = deposit + interest;
        if(deposit >= X){
            break;
        }
    }

    cout << i;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

long int gcd(long int a,long int b)
{
  if (a%b==0)
  {
    return(b);
  }
  else
  {
	return(gcd(b,a%b));
  }
}

long int lcm(long int a,long int b){
	return a * b / gcd(a,b);	
}

int main(){
  long int A, B;
  cin >> A >> B;
  
  cout << lcm(A, B) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#include <atcoder/all>

#define FOR_LT(i, beg, end) for (decltype(end) i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (decltype(end) i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (decltype(beg) i = beg; end <= i; i--)
#define REP(n)              for (decltype(n) repeat_index = 0; repeat_index < n; repeat_index++)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n, m; cin >> n >> m;

	atcoder::scc_graph scc(n);
	FOR_LT(i, 0, m) {
		int a, b; cin >> a >> b;
		scc.add_edge(a, b);
	}
	auto ret = scc.scc();

	cout << ret.size() << endl;
	for (auto& r : ret) {
		cout << r.size() << " ";
		for (auto& e : r) {
			cout << e << " ";
		}
		cout << endl;
	}

	return 0;
}

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

ll mod = 1e9+7;

int main()
{
	ll n;
	cin>>n;
	ll a[n];

	bool ok =true;
	for(int i = 0; i < n; i++)	cin>>a[i];

	int f[n+1];
	for(int i = 0; i <= n; i++)
		f[i] = 0;
	for(int i = 0; i < n; i++)
		f[a[i]]++;

	
	for(int i = 0; i < n; i++)
	{
		if(i == 0 && f[i] > 1)
			ok = false;

		if(f[i] > 2)
			ok = false;
	}


	if(!ok)
		cout<<"0\n";
	else{
	ll ans = 1;
	// cout<<"ok\n";
	for(int i = 0; i < n; i++)
	{
		if(f[i] > 0)
			ans =  (ans%mod*f[i]%mod)%mod;
	}

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

Measured memory_bytes: 1408
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL d,t,s;
    cin>>d>>t>>s;
    if(t * s >= d)PUTS("Yes")
    else PUTS("No")
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <queue>
#include <vector>
#include <functional>

#define N 100
using namespace std;


class list {
public:
	int cost;
	int node;
	list(void) {
		cost = -1;
		node = -1;
	}
};

bool operator<(const list& y,const list& x) {
	return (y.cost < x.cost);
};
bool operator>(const list& y,const list& x) {
	return (y.cost>x.cost);
};

int m[N][N];
bool visited[N];
int sum = 0;

int main(void) {
	priority_queue<list, vector<list>, greater<list> > pq;
	int n;
	int now;
	scanf("%d", &n);
	for (int i = 0; i<n; i++) {
		visited[i] = false;
		for (int j = 0; j<n; j++) {
			scanf("%d", &m[i][j]);
		}
	}
	now = 0;
	while (1) {
		//printf("I'm in %d\n", now);
		visited[now] = true;
		for (int j = 0; j<n; j++) {
			if (m[now][j] != -1) {
				list a;
				a.cost = m[now][j];
				a.node = j;
				pq.push(a);
			//	printf("I pushed %d %d\n", a.node, a.cost);
			}
		}
		//system("pause");
		list x;
		while (!pq.empty()) {
			if (visited[(pq.top()).node] == false) {
				x = pq.top();
				//printf("I got %d %d\n", x.node, x.cost);
				pq.pop();
				now = x.node;
				sum += x.cost;
				break;
			}
			else pq.pop();
		}
		if (x.node == -1)break;
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 1188
package main

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

const NIL = -1

var sc = bufio.NewScanner(os.Stdin)

var dummy = &Node{}

type Node struct {
	key    int
	parent *Node
	left   *Node
	right  *Node
}

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func init() {
	sc.Split(bufio.ScanWords)
	dummy.parent = dummy
	dummy.left = dummy
	dummy.right = dummy
}

func insert(v int) {
	node := &Node{key: v, left: dummy, right: dummy}

	parent := dummy
	leaf := dummy.left
	for leaf != dummy {
		parent = leaf
		if node.key < leaf.key {
			leaf = leaf.left
		} else {
			leaf = leaf.right
		}
	}

	node.parent = parent
	if parent == dummy {
		dummy.left = node
		dummy.right = node
	} else if node.key < parent.key {
		parent.left = node
	} else {
		parent.right = node
	}
}

func preOrder(node *Node, w io.Writer) {
	if node == dummy {
		return
	}

	fmt.Fprint(w, " ", node.key)
	preOrder(node.left, w)
	preOrder(node.right, w)
}

func inOrder(node *Node, w io.Writer) {
	if node == dummy {
		return
	}

	inOrder(node.left, w)
	fmt.Fprint(w, " ", node.key)
	inOrder(node.right, w)
}

func print(root *Node) {
	w := bufio.NewWriter(os.Stdout)

	inOrder(root, w)
	fmt.Fprintln(w)
	preOrder(root, w)
	fmt.Fprintln(w)

	w.Flush()
}

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		command := scanString()
		switch command {
		case "insert":
			num := scanInt()
			insert(num)
		case "print":
			root := dummy.left
			print(root)
		}
	}
}



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

int main()
{
    ll N,W,sum=0;
    cin >> N >> W;
    ll w[N],v[N];
    
    for(int i=0;i<N;++i)
    {
        cin >> w[i] >> v[i];
    }
    ll dp[W+1]={0};

    
    for(int i=0;i<N;++i)
    {
        for(int j=W;j>=0;--j)
        {
            if(j+w[i]<=W)
            dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i]);
        }
    }
    ll ans=0;
    for(int i=0;i<=W;++i)
    {
        ans=max(ans,dp[i]);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 4384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(c > b && b > a)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    
    return 0;
}


Measured memory_bytes: 3068
#include <stdio.h>
int main(){
  int S, h, m, s;
  scanf("%d", &S);
  h = S/3600;
  m = (S-h*3600)/60;
  s = S-h*3600-m*60;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}


Measured memory_bytes: 2148
#!/usr/bin/env python3
import sys
# input = sys.stdin.r/eadline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    N,C,K = MAP()
    T = [INT() for _ in range(N)]
    T.sort()
    passengers = 1
    deadline = T[0]+K
    answer = 0

    for i in range(1,N):
        if passengers<C and T[i]<=deadline:
            passengers += 1
        elif passengers == C or T[i]>deadline: #出発させる
            passengers = 1
            answer += 1
            deadline = T[i]+K
    if passengers>0:
        answer += 1
    print(answer)

if __name__ == '__main__':
    main()


Measured memory_bytes: 7384
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int arr[101];
    int n,k,d,x;
    int cnt=0;
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++) arr[i]=0;
    for(int i=0;i<k;i++)
    {
        scanf("%d",&d);
        for(int j=0;j<d;j++)
        {
            scanf("%d",&x);
            arr[x]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(arr[i]==0) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,ans=1;
  scanf("%d %d",&x,&y);
  if(x<y){int temp=x;x=y;y=temp;}
  while(ans>0){
    ans=x%y;x=y;y=ans;
  }
  printf("%d\n",x);
  return 0;
}

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

int main() {
    int n,ans=0;cin>>n;
    if(n%10==9)ans=1;
    n/=10;
    if(n%10==9)ans=1;
    if(ans==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
//#include <bits/stdc++.h>

#define ll unsigned long long int
#define pb push_back
#define llu unsigned long long int
#define fo(i,n) for(int i=0;i<n;i++)
#define eb emplace_back
#define M 1000000007
#define vi vector<int>
#define vlli vector<lli>
#define pi pair<int,int>
#define mp make_pair
#define mapi map<int,int>

using namespace std;
ll max(ll x,ll y)
{
	if(x>y)
		return x;
	return y;
}
ll min(ll x,ll y)
{
	if(x<y)
		return x;
	return y;
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin.ignore(numeric_limits<streamsize>::max(),'\n');
    //const unsigned ll M=1000000007;
	//cout << lol;
  	int l,r,d;
  	cin >> l >> r >> d;
  	ll count=0;
  	for(int i=l;i<=r;i++)
  	{
  		if(i%d==0) count++;	
	}
	cout << count;
    return 0;
}



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

int main(){
    string s;
    int n=0;
    cin>>s;
    while (!s.empty()){
        n+=int(s.back())-int('0');
        n=n%9;
        
        s.pop_back();
    }

    if (n==0){cout<< "Yes";}
    else {cout<<"No";}

    return 0;

}


        

Measured memory_bytes: 3680
#include <cstdio> 
using namespace std; //This makes the code much more cleaner

int main()
{
	
/*
	int a, b, c, d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int area = a*b;
	int areatwo = c*d;
		if (area>=areatwo)
		{
			printf("%d", area);
		}
		else
		{
			printf("%d",areatwo);
		}
		*/

	int a;
	scanf("%d", &a);
	if(a>=1200)
	{
	
		printf("ARC");
	}
	else
	{
		printf("ABC");
	}





	return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
    int n;
    while(1){
        cin>>n;
        if(n==0)break;
        double t=0;
        double z=0;
        int s[n];
        for (int i=0;i<n;i++){
            int a;
            cin>>a;
            s[i]=a;
            t+=a;
            
        }
        double m=t/n;
        for (int i=0;i<n;i++){
            z+=(s[i]-m)*(s[i]-m);
            
        }
        double f=z/n;
        cout<<fixed<<setprecision(15)<<sqrt(f)<<endl;
    }return 0;
}


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

int main(){
  int n;
  scanf("%d", &n);
  int arr[n+1];
  for(int i = 0; i < n; i++){
    scanf("%d", &arr[i]);
  }
  sort(arr, arr+n);
  arr[n] = 0;
  int top = arr[0] * 2;
  if(arr[1] == arr[0]) --top;
  if(arr[2] == arr[0] || arr[n-1] != top){
    printf("Impossible");
    return 0;
  }
  bool noo = false;
  int prev = arr[0];
  for(int i = 1; i < n; i++){
    if(arr[i] != prev){
      if(noo || arr[i]-prev > 1){
        printf("Impossible");
        return 0;
      }else{
        noo = true;
        prev = arr[i];
      }
    }else{
      noo = false;
    }
  }
  printf("Possible");
}



Measured memory_bytes: 256
//
// Created on 2020/03/07.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

int main() {
    ll ans;
    ll n;
    ll a;
    ll b;
    cin>>n>>a>>b;
    if (n%(a+b) <=a){
        ans = a*(n/(a+b))+n%(a+b);
    }
    else{
        ans = a*(n/(a+b))+a;
    }





    cout<<ans<<endl;
}


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

int main(){
    string num;
    int n=0;
    
    while(1){
    cin >> num;
    if(num[0] == '0') break;
    for(int i = 0; i < num.size(); i++){
        n += num[i] - '0';
    }
    cout << n << endl;
    n = 0;
    }
    return 0;
}


Measured memory_bytes: 3204
n = gets.chomp.to_i
max = (n ** (1 / 2.0)).floor
sum = 0
max.times do |i|
  v1 = i + 1
  next if n % v1 != 0
  v2 = n / v1
  next if v2 - v1 <= 1
  sum += v2 - 1
end

puts sum


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

int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    long int n,i,c=0;
    cin>>n;int a[n+1],b[n];
    for(i=0;i<=n;i++) cin>>a[i];
    for(i=0;i<n;i++) cin>>b[i];
    for(i=0;i<n;i++){
      if(b[i]>=a[i]+a[i+1]){
      	c=c+a[i]+a[i+1];
      	a[i]=0;a[i+1]=0;
      }
      else{
      	c=c+b[i];
      	a[i]=a[i]-b[i];
      	if(a[i]<0) a[i+1]=a[i+1]+a[i];
      }
    }cout<<c;
    return 0; 
} 

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>

using namespace std;

int main(){
    
    int n;
    cin >> n;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j==n) {cout << "Yes" << endl;
            return 0;
            }
            
        }
        
    }
    cout << "No" ;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map> 
#define fr first
#include<algorithm>
#include<vector>
#define sc second
using namespace std;
const int N=1100,inf=1e9;
int n,k,a[N],ans[N],curlen;
typedef vector<int> vi;
void merge(int *x,int *y,int *z,int len1,int len2){
	int i=1,j=1,l=0;
	while(i<=len1&&j<=len2){if(x[i]<y[j])z[++l]=x[i++];else z[++l]=y[j++];}
	while(i<=len1)z[++l]=x[i++];
	while(j<=len2)z[++l]=y[j++];
}

int b[N], x[N], y[N], z[N], l1, l2, l3;bool vis[N];
vi solve_ext(int exlen){l1=l2=l3=0;
	for(int i=1;i<=k;i++)vis[i]=0,b[i]=a[i];
	for(int i=0;i<k-exlen;i++){
		//if(vis[ans[curlen-i]])return vi(1,k+1);
		vis[ans[curlen-i]]=1;
	}
	for(int i=1;i<=k;i++){if(!vis[i])b[i]--;if(b[i]<0)return vi(1,k+1);}
	int mn=inf,mx=0;
	for(int i=1;i<=k;i++)mn=min(mn,b[i]),mx=max(mx,b[i]);
	if(mn*2>=mx){
		vi ret;
		for(int i=1;i<=k;i++)if(!vis[i])ret.push_back(i);
		return ret;
	}else if(mn*2+1==mx){
		vi res;
		for(int i=1;i<=k;i++)if(!vis[i]&&b[i]==mx)x[++l1]=i;
		for(int i=1;i<=k;i++)if(!vis[i]&&b[i]==mn)x[++l1]=i;
		for(int i=1;i<=k;i++)if(!vis[i]&&b[i]!=mx && b[i]!=mn)y[++l2]=i;
		merge(x,y,z,l1,l2);l3=l1+l2;
		res=vector<int>(z+1,z+l3+1);
		int p1=0,p2=0;
		for(int i=curlen-(k-exlen-1);i<=curlen;i++){
			if(b[ans[i]]==mx)p1=i;
			if(b[ans[i]]==mn&&!p2)p2=i;
		}
		for(int i=1;i<=l3;i++){
			if(b[z[i]]==mx)p1=i+curlen;
			if(b[z[i]]==mn&&!p2)p2=i+curlen;
		}
		if(p1<p2)return res;
		else return vector<int>(1,k+1);
	}else
		return vector<int>(1,k+1);			
}
bool bigger(vi a,vi b){
	for(int i=0;i<a.size();i++){
		if(i>=b.size())return 1;
		if(a[i]>b[i])return 1;if(a[i]<b[i])return 0;
	}
	return 0;
}
void extend(){vi ext(1,k+1);
	for(int exlen=1;exlen<=k&&exlen+curlen<=n;exlen++){
		int need=k-exlen;
		if(curlen-need+1>0){
			vi nw=solve_ext(exlen);
			if(bigger(ext,nw))ext=nw;
		}
	}
	for(int i=0;i<ext.size();i++)
		printf("%d ",ext[i]),ans[++curlen]=ext[i],a[ext[i]]--;
}
bool check(){
	int mn=inf,mx=0;
	for(int i=1;i<=k;i++)mx=max(mx,a[i]),mn=min(mn,a[i]);
	return mn*2>=mx;	
}
int main(){//freopen("a.in","r",stdin);
	scanf("%d",&k);
	for(int i=1;i<=k;i++)scanf("%d",&a[i]),n+=a[i];
	if(!check()){puts("-1");return 0;}
	while(curlen<n)extend();
	
}

Measured memory_bytes: 3280
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;

const int N=1e3+1e2+7;

int n;

char a[N][N],b[N][N],c[N][N];

inline void pre()
{
	for(int i=0;i<n;i++)
		memcpy(b[i],a[i],n);
	for(int i=0;i<n;i++)
		memcpy(b[i]+n,b[i],n);
	for(int i=0;i<n;i++)
		memcpy(b[n+i],b[i],n*2);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			c[j][i]=a[i][j];
	for(int i=0;i<n;i++)
		memcpy(c[i]+n,c[i],n);
	for(int i=0;i<n;i++)
		memcpy(c[n+i],c[i],n*2);
}

inline bool check(int x,int y)
{
	for(int i=0;i<n;i++)
		if(memcmp(c[i+y]+x,b[i+x]+y,n))
			return false;
	return true;
}

inline int solve()
{
	pre();
	int ret=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			ret+=check(i,j);
	printf("%d",ret);
}

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%s",a[i]);
	solve();
}

Measured memory_bytes: 1920
N = int(input())
for _ in range(N):
	balls = list(map(int, input().split()))
	left = right = 0
	ans = "YES"
	for i in range(10):
		if min(left, right) > balls[i]:
			ans = "NO"
			break
		if left < right:
			if right < balls[i]:
				right = balls[i]
			else:
				left = balls[i]
		else:
			if left < balls[i]:
				left = balls[i]
			else:
				right = balls[i]
	print(ans)

Measured memory_bytes: 7604
#include <iostream>
#include <cstdio>
#include <cctype>
#define il inline
#define vd void
#define rg register
#define rep(i,x,y) for(rg int i=x;i<=y;++i)
#define drp(i,x,y) for(rg int i=x;i>=y;--i)
using namespace std;
const int Len=2333333;
char buf[Len],*p1=buf,*p2=buf,duf[Len],*q1=duf;
il char gc(); il int rd(); il vd pc(char c); il vd rt(int x); il vd flush();
template<class T> il T Max(T a,T b){return a>b?a:b;}
template<class T> il T Min(T a,T b){return a<b?a:b;}
int n;
int main(){
    n=rd();
    int ans=0;
    rep(i,1,n){
        int x=i,c=0;
        while(x) ++c,x/=10;
        if(c&1) ++ans;
    }
    rt(ans);
    return flush(),0;
}

il char gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,Len,stdin),p1==p2)?-1:*p1++;}
il int rd(){char c;
    while(!isdigit(c=gc())&&c!='-');
    int f=c=='-'?c=gc(),1:0,x=c^48;
    while(isdigit(c=gc())) x=((x+(x<<2))<<1)+(c^48);
    return f?-x:x;
}
il vd pc(char c){q1==duf+Len&&fwrite(q1=duf,1,Len,stdout),*q1++=c;}
il vd rt(int x){x<0?pc('-'),x=-x:0,pc((x>=10?rt(x/10),x%10:x)+48);}
il vd flush(){fwrite(duf,1,q1-duf,stdout);}

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

int main() {
  int n;
  scanf("%d", &n);
  vector<long long> a(n);
  for (int i = 0; i < n; ++i)
    scanf("%lld", &a[i]);
  map<long long, int> ma;
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    s += a[i];
    ++ma[s];
  }
  long long ans = 0, minus = 0;
  for (int i = 0; i < n; ++i) {
    minus += a[i];
    ans += ma[-a[i] + minus];
    --ma[minus];
  }
  printf("%lld\n", ans);
  return 0;
}

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

def main():
  N = int(input())
  liA = list(map(int, [input() for _ in range(N)]))
  first, second = sorted(liA, reverse=True)[0:2]
  for a in liA:
    if a == first:
      print(second)
    else:
      print(first)
  pass

if __name__=='__main__':
  main()



Measured memory_bytes: 23728
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a>c){
    cout<<"NO\n";
  }else if(c-a<=b){
    cout<<"YES\n";
  }else{
    cout<<"NO\n";
  }
}

Measured memory_bytes: 256
(a, b, c, d) = gets.chomp.split(' ').map(&:to_i)

if a > c then
  t = a
  a = c
  c = t
  
  t = b
  b = d
  d = t
end

# a < cを保証した下で
if c < b then
  t = [b - c, d - c].min
else
  t = 0
end

puts t.to_s

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

int main() {
  int a,b;
  cin >> a >> b;
  if (a % 2 ==0 && b % 2 == 0 ){
    cout << "Even" << endl;
  }
  else if (a % 2 != 0 && b % 2 == 0){
    cout << "Even" << endl;
  }
  else if (b % 2 != 0 && a % 2 == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" <<endl;
  }
}


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

#define fi  first
#define se  second
#define mp  make_pair
#define pb  push_back

typedef long long ll;
typedef queue <int> qi;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef map <char, int> mci;
typedef map <char, char> mcc;
typedef map <string, int> msi;
typedef pair <string, int> psi;
typedef map <string, string> mss;
typedef unsigned long long ull;

const ll mod = 10e9+7;
const double eps = 1e-11;
const double PI = 2 * acos(0.0);

/*
string to_string(int n) { // Integer -> String
    stringstream convert;
    convert << n;
    return convert.str();
}

int to_int(string s) { // String -> Integer
    istringstream sin(s);
    int x = 0;
    sin >> x;
    return x;
}

ll big_mod(ll b, ll p, ll m) {
    if (p == 0) return 1;
    ll r = big_mod(b, p / 2, m);
    r = (r * r) % m;
    if (p & 1) r = (r * b) % m;
    return r;
}

const int p_max = 1000020;
int status[p_max + 1];
vi prime;

void fact_sieve() {
    int i;
    prime.pb( 2 );
    for (i = 3; i < p_max / 2; i += 2) {
        if (status[i] == 0) {
            prime.pb( i );
            for (int j = i; j <= p_max; j += i)
                status[j] = i;
        }
    }
    for(; i <= p_max; i += 2) {
        if (status[i] == 0) {
            prime.pb( i );
            status[i] = i;
        }
    }
}

// BITMASK SET
void bitmask_set_finder() {
    for (int i = 0; i < (1<<n); i++) {
        for (int j = 0; j < n; j++) {
            if (i & (1<<j) != 0) // bla
            else //bla
        }
    }
}
*/

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

    int x = A + B;
    if (x % 3 == 0) puts("Possible");
    else if (A % 3  == 0) puts("Possible");
    else if (B % 3 == 0) puts("Possible");
    else puts("Impossible");
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
const int C[10]={0,2,5,5,4,5,6,3,7,6};
const int N=10000+100;
int n;
bool can[10];
void readData(){
	scanf("%d",&n);
	int m,x;
	scanf("%d",&m);
	for(int i=1;i<=m;i++){
		scanf("%d",&x);
		can[x]=true;
	}
}
string f[N];
bool bigger(string a,string b){
	if(a.length()!=b.length())
		return a.length()>b.length();
	int len=a.length();
	for(int i=0;i<len;i++)
		if(a[i]!=b[i])
			return a[i]>b[i];
	return false;
}
void solve(){
	for(int i=1;i<=9;i++)
		if(can[i]){
			char t[]="x";
			t[0]='0'+i;
			f[C[i]]=t;
		}
	for(int i=2;i<n;i++)
		if(f[i]!=""){
			for(int j=1;j<=9;j++)
				if(can[j]){
					char t[]="x";
					t[0]='0'+j;
					string ns=string(t)+f[i];
					if(bigger(ns,f[i+C[j]]))
						f[i+C[j]]=ns;
				}
		}
	cout<<f[n]<<endl;
}
int main(){
	readData();
	solve();
	return 0;
}

Measured memory_bytes: 32512
/****************************************************************
*	Author: huhao
*	Email: 826538400@qq.com
*	Create time: 2020-01-25 21:32:53
****************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
#define i64 long long
const int N=3010,mod=1000000007;
i64 power(i64 a,i64 b,i64 p)
{
	i64 r=1; a%=p;
	for(;b;b>>=1,a=a*a%p) if(b&1) r=r*a%p;
	return r;
}
i64 inv(i64 a){ return power(a,mod-2,mod); }
i64 n,q,a[N],f[N][N],F[N][N],i2=inv(2),x,y;
int main()
{
	n=read(); q=read();
	fr(i,1,n) a[i]=read();
	fr(i,1,n) fr(j,1,n) if(i!=j) f[i][j]=F[i][j]=(a[i]<a[j]);
//	fr(i,1,n) fr(j,1,n) printf("%d%c",int(f[i][j]+f[j][i])%mod,j==end_j?'\n':' ');
	fr(i,1,q)
	{
		x=read(); y=read();
		fr(j,1,n) if(j!=x&&j!=y) f[y][j]=f[x][j]=i2*(F[x][j]+F[y][j])%mod;
		fr(j,1,n) if(j!=x&&j!=y) f[j][y]=f[j][x]=i2*(F[j][x]+F[j][y])%mod;
		f[x][y]=f[y][x]=i2*(F[x][y]+F[y][x])%mod;
		fr(j,1,n){ F[x][j]=f[x][j]; F[y][j]=f[y][j]; F[j][x]=f[j][x]; F[j][y]=f[j][y]; }
//		fr(i,1,n) fr(j,1,n) printf("%d%c",int(f[i][j]+f[j][i])%mod,j==end_j?'\n':' ');
	}
	i64 ans=0;
//	fr(i,1,n) fr(j,1,n) printf("%d%c",int(f[i][j]+f[j][i])%mod,j==end_j?'\n':' ');
	fr(i,1,n) fr(j,1,i-1) ans+=f[i][j];
	printf("%d\n",int(ans%mod*power(2,q,mod)%mod));
	return 0;
}

Measured memory_bytes: 141568
n=int(input())
s=input()
ans=0
 
for i in range(10):
    x=s.find(str(i))
    if x!=-1:
        for j in range(10):
            y=s.find(str(j),x+1)
            if y!=-1:
                for k in range(10):
                    z=s.find(str(k),y+1)
                    if z!=-1:
                        ans+=1
print(ans)


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define allr(v)	     ((v).rbegin()), ((v).rend())
#define sz(v) ((int)(v).size())
#define clr(v, d)        memset(v, d, sizeof(v))
#define JSE ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
ll mod = ll(1e9 + 7);
typedef  double ld;
void file(){
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); //freopen("out.txt", "w", stdout);  
#endif
}
	
int main()
{
	//cout << setprecision(7) << fixed;
	JSE
		//file();
		//	freopen("friday.in", "r", stdin);
		///////////
		ll n, m, x;
	cin >> n >> m;
	if (m < 10)
		n *= 10;
	else if (m < 100)
		n *= 100;
	else
		n *= 1000;
	n += m;
	x = sqrt(n);
	if (x*x == n)
	{
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main(void) {
	ll n;
	cin >> n;
	ll a[1000003];
	ll sum = 0;
	rep(i, n) {
		a[i] = i + 1;
	}
	rep(i , n) {
		if (a[i] % 3 == 0 || a[i] % 5 == 0) {}
		else sum += a[i];
	}
	cout << sum << endl;
}


Measured memory_bytes: 10952
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 15:10:57 2020

@author: liang
"""

N = int(input())
lis10 = list()
lis =list()
ans = 0
for i in range(N):
    s = int(input())
    if s % 10 == 0:
        lis10.append(s)
    else:
        lis.append(s)
ans += sum(lis10)
lis.sort()
ans += sum(lis)
if ans % 10 == 0:
    if lis:
        ans -= lis[0]
    else:
        ans = 0
print(ans)

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

using namespace std;

int main() {
  long long n;
  cin >> n;
  long long i = 1;
  while (i*(i+1)/2  < n) ++i;
  long long dif = i*(i+1)/2 - n;
  for (int j=1; j<=i; ++j) {
    if (j != dif) cout << j << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>

using namespace std;

const double EPS=(1e-10);
typedef long long ll;
typedef pair<int,int> pii;
bool EQ(double a,double b){
  return abs((a)-(b))<EPS;
}
void fast_stream(){
	std::ios_base::sync_with_stdio(0);
}

int getLen(int n){
    int cnt=0;
    if(n==0)return 1;
    while(n){
        cnt++;
        n/=10;
    }
    return cnt;
}

void solve(){
    int A,B,K;
    cin>>A>>B>>K;
    int n=getLen(A);
    string as,bs;
    for(int i=0;i<n;i++){
        as+=(A%10)+'0';
        A/=10;
    }
    reverse(as.begin(),as.end());
    for(int i=0;i<n;i++){
        bs+=(B%10)+'0';
        B/=10;
    }
    reverse(bs.begin(),bs.end());
    // ツづつアツづーツ繰ツづィツ可コツつーツつオツづ按つ「ツつゥ
    ll maxnum=0;
    for(int mask=0;mask<(1<<n);mask++){
        int cnt=0;
        for(int i=0;i<n;i++){
            if((mask>>i)&1)cnt++;
        }
        if(cnt>K)continue;
        string c;
        // ツ可コツ暗環個つゥツづァツ渉氾板づ可計ツ算
        int bor=0;
        for(int i=n-1;i>=0;i--){
            if(as[i]-'0'-bor>=bs[i]-'0'){
                c+=as[i]-bor-bs[i]+'0';
                bor=0;
            }
            else{
                c+=as[i]-bor-bs[i]+'0'+10;
                if((mask>>i)&1)bor=0;
                else bor=1;
            }
        }
        ll num=0;
        for(int i=c.size()-1;i>=0;i--){
            num=num*10+(c[i]-'0');
        }
        maxnum=max(maxnum,num);
    }
    cout<<maxnum<<endl;
}
int main(){
    solve();

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int x;
	cin>>x;
	if(x<600) cout<<8;
	else if(x<800) cout<<7;
	else if(x<1000) cout<<6;
	else if(x<1200) cout<<5;
	else if(x<1400) cout<<4;
	else if(x<1600) cout<<3;
	else if(x<1800) cout<<2;
	else cout<<1;
}

Measured memory_bytes: 3656
import bisect
n = int(input())
a = [float(input()) for _ in range(n)]
b = sorted(a)
for i in range(n):
    x = bisect.bisect_left(b, a[i])
    y = bisect.bisect_right(b, a[i])
    print(x * 2 + y - 1)


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

using namespace std;

int main()
{
    int x,y;
    cin>>x>>y;
    for(int i=0;i<=x;i++)
    {
        if(i*2+(x-i)*4==y)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep (i, n) cin >> a[i];

  int counter = 0;
  for (int i = k; i < n; i++) {
    if (a[counter] < a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }

    counter++;
  }
  return 0;
}


Measured memory_bytes: 3988
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println(Math.max(A+(A-1), Math.max(B+(B-1), A+B)));
    }
}


Measured memory_bytes: 23252