akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>
int main()
{   long long n;
    scanf("%lld",&n);
    int dig=log10(n);
    int head=n/(pow(10,dig));
    if(n==9||n==99||n==999||n==9999||n==99999||
        n==999999||n==9999999||n==99999999||n==999999999||n==9999999999||
        n==99999999999||n==999999999999||n==9999999999999||n==99999999999999||
        n==999999999999999||
        n==8||
        n==89||n==899||n==8999||n==89999||
        n==899999||n==8999999||n==89999999||n==899999999||n==8999999999||
        n==89999999999||n==899999999999||n==8999999999999||n==89999999999999||
        n==899999999999999||
        n==7||
        n==79||n==799||n==7999||n==79999||
        n==799999||n==7999999||n==79999999||n==799999999||n==7999999999||
        n==79999999999||n==799999999999||n==7999999999999||n==79999999999999||
        n==799999999999999||
        n==6||n==69||n==699||n==6999||n==69999||
        n==699999||n==6999999||n==69999999||n==699999999||n==6999999999||
        n==69999999999||n==699999999999||n==6999999999999||n==69999999999999||
        n==699999999999999||
        n==5||
        n==59||n==599||n==5999||n==59999||
        n==599999||n==5999999||n==59999999||n==599999999||n==5999999999||
        n==59999999999||n==599999999999||n==5999999999999||n==59999999999999||
        n==599999999999999||
        n==4||
        n==49||n==499||n==4999||n==49999||
        n==499999||n==4999999||n==499999999||n==499999999||n==4999999999||
        n==49999999999||n==499999999999||n==4999999999999||n==49999999999999||
        n==499999999999999||
        n==3||
        n==39||n==399||n==3999||n==39999||
        n==399999||n==3999999||n==39999999||n==399999999||n==3999999999||
        n==39999999999||n==399999999999||n==3999999999999||n==39999999999999||
        n==399999999999999||
        n==2||
        n==29||n==299||n==2999||n==29999||
        n==299999||n==2999999||n==29999999||n==299999999||n==2999999999||
        n==29999999999||n==299999999999||n==2999999999999||n==29999999999999||
        n==299999999999999||
        n==1||
        n==19||n==199||n==1999||n==19999||
        n==199999||n==1999999||n==19999999||n==199999999||n==1999999999||
        n==19999999999||n==199999999999||n==1999999999999||n==19999999999999||
        n==199999999999999){
            dig*=9;
            dig+=head;
        }else{
    dig*=9;
    dig+=(head-1);
        }
        
        printf("%d",dig);
    

    return 0;
}


Measured memory_bytes: 384
def main() -> None:
    N = int(input())
    say = [input() for _ in range(N)]
    if len(say) != len(list(set(say))):
        print("No")
        exit()
    else:
        for i in range(N-1):
            if say[i][-1] != say[i+1][0]:
                print("No")
                exit()
            else:
                continue
    print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import fractions
import math

def primefact(n):
    facts = []
    prime = True
    while n > 1:
        for d in xrange(2,int(math.sqrt(n))+1):
            if n%d == 0:
                facts.append(d)
                n /= d
                prime = False
                break
        if prime:
            facts.append(n)
            n = 1
        prime = True
    return facts

a,b = map(int,raw_input().split())
g = fractions.gcd(a,b)
facts = set(primefact(g))
print len(facts)+1

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

#include<stdlib.h>
#include<iostream>
#include<math.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define INF 2000000000
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define PI 3.1415926535897932
using namespace std;

int main()
{
IOS;
double a,b,h,m;
cin>>a>>b>>h>>m;
double ans;
double a1=(30*h)+m/2;
double a2=(6*m);
double angle=abs(a1-a2)*PI/180;
ans=sqrt(a*a+b*b-2*a*b*cos(angle));
cout<<std::setprecision(15)<<ans;




return 0;
}

Measured memory_bytes: 4212
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;
 
const int inf = (int)1e9; 
 
char board[1010][1010];
int h,w;

bool check(int i,int j){
	return (i>=0)&&(i<h)&&(j>=0)&&(j<w);
}

int dist[1010][1010];
bool used[1010][1010];

int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};

int main(void){
	cin>>h>>w;
	int sx,sy,gx,gy;
	cin>>sx>>sy>>gx>>gy;
	sx--;
	sy--;
	gx--;
	gy--;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>board[i][j];
			dist[i][j]=inf;
		}
	}
	priority_queue<Q,vector<Q>,function<bool(Q,Q)> >que(
        [](Q a,Q b){return a.first >= b.first;});
	dist[sx][sy]=0;
	que.push(Q(0,P(sx,sy)));
	while(!que.empty()){
		Q q = que.top();
		que.pop();
		int cost = q.first;
		int nowx = q.second.first;
		int nowy = q.second.second;
		for(int i=0;i<4;i++){
			int nx = nowx+dx[i];
			int ny = nowy+dy[i];
			if(!check(nx,ny))continue;
			if(board[nx][ny]=='.'){
				if(dist[nx][ny]>cost){
					dist[nx][ny]=cost;
					que.push(Q(dist[nx][ny],P(nx,ny)));
				}
			}
		}
		for(int i=-2;i<=2;i++){
			for(int j=-2;j<=2;j++){
				if(i==0 && j==0)continue;
				int nx = nowx+i;
				int ny = nowy+j;
				if(!check(nx,ny))continue;
				if(board[nx][ny]=='.'){
					if(dist[nx][ny]>cost+1){
						dist[nx][ny]=cost+1;
						que.push(Q(dist[nx][ny],P(nx,ny)));
					}
				}
			}
		}
	}
	if(dist[gx][gy]==inf)cout<<-1<<endl;
	else cout<<dist[gx][gy]<<endl;
	return 0;
}

Measured memory_bytes: 8596
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  string a_;
  cin >> a_;
  int n = a_.length();
  vi a(n);
  rep (i, n) {
    a[i] = a_[i] - 'a';
  }
  vi cnt(26, 0);
  vll dp(n+1, 0);
  ll ans = 0;
  rep (i, n) {
    ans += (i - cnt[a[i]]);
    cnt[a[i]] += 1;
  }

  ans += 1;
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
ll M=(ll)1e9+7;

ll sum(ll n){
	return n*(n+1LL)/2LL;
}

int main(){
	// freopen("Input.txt","r",stdin); freopen("Output.txt","w",stdout);
	ll n,k,ans=0;cin>>n>>k;
	for(int i=k;i<=n;++i){
		ll l=sum(i-1);
		ll r=sum(n)-sum(n-i);
		ans+=(r-l+1);
	}
	ans++;
	ans=ans%M;
	cout<<ans<<"\n";
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if ((a<c && b>c) || (a>c && b<c)) {
		cout << "Yes" << endl;
	}
	else { cout << "No" << endl; }
    return 0;
}



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

int n,q,pos=0,ans=0;
int tag[10000005],v1[10000005],v2[10000005];

map<int,int> m;

struct node
{
	int l,r;
}b[10000005];

struct node2
{
	int rt;
	int num;
}cf[10000005];

struct segment_tree
{
	int maxv,minv;
}tree[10000005];

inline void pushup(int rt)
{
	tree[rt].maxv=max(tree[2*rt].maxv,tree[2*rt+1].maxv);
	tree[rt].minv=min(tree[2*rt].minv,tree[2*rt+1].minv);
}

inline void change_max(int nl,int l,int r,int rt,int k)
{
	if (l==r&&l==nl)
	{
		tree[rt].maxv=max(tree[rt].maxv,k);
		return;
	}
	int mid=(l+r)>>1;
	if (nl<=mid)  change_max(nl,l,mid,2*rt,k);
	else change_max(nl,mid+1,r,2*rt+1,k);
	
	pushup(rt);
}

inline void change_min(int nl,int l,int r,int rt,int k)
{
	if (l==r&&l==nl)
	{
		tree[rt].minv=min(tree[rt].minv,k);
		return;
	}
	int mid=(l+r)>>1;
	if (nl<=mid)  change_min(nl,l,mid,2*rt,k);
	else change_min(nl,mid+1,r,2*rt+1,k);
	
	pushup(rt);
}

int query_max(int nl,int nr,int l,int r,int rt)
{
	int sumv=0,mid=(l+r)>>1;
	
	if (nl<=l&&r<=nr)  return tree[rt].maxv;
	if (nl<=mid)  sumv=max(sumv,query_max(nl,nr,l,mid,2*rt));
	if (nr>mid)  sumv=max(sumv,query_max(nl,nr,mid+1,r,2*rt+1));
	return sumv;
}

int query_min(int nl,int nr,int l,int r,int rt)
{
	int sumv=1e18+7,mid=(l+r)>>1;
	
	if (nl<=l&&r<=nr)  return tree[rt].minv;
	if (nl<=mid)  sumv=min(sumv,query_min(nl,nr,l,mid,2*rt));
	if (nr>mid)  sumv=min(sumv,query_min(nl,nr,mid+1,r,2*rt+1));
	return sumv;
}

bool cmp(node2 x,node2 y)
{
	return x.num<y.num;
}

bool cmp2(node x,node y)
{
	return x.l<y.l;
}

inline void clear()
{
	for (int i=1;i<=8*n;i++)  tree[i].maxv=tag[i]=0,tree[i].minv=1e18+7;
}

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>b[i].l>>b[i].r;
	}
	sort(b+1,b+n+1,cmp2);
	for (int i=1;i<=n;i++)
	{
		v1[i]=b[i].l+b[i].r;
	  	v2[i]=b[i].r-b[i].l;
	}
	for (int i=1;i<=n;i++)
	{
		cf[++pos].num=b[i].l,cf[pos].rt=pos;
		cf[++pos].num=b[i].r,cf[pos].rt=pos;
	}
	sort(cf+1,cf+2*n+1,cmp);
	
	int now=0;
	for (int i=1;i<=2*n;i++)
	{
		if (cf[i].num!=cf[i-1].num)  now++,m[cf[i].num]=now;
	}
	for (int i=1;i<=n;i++)  b[i].l=m[b[i].l],b[i].r=m[b[i].r];
	
	clear();
	for (int i=1;i<=n;i++)
	{
		if (i!=1)  ans=max(ans,v1[i]-query_min(1,b[i].r,1,2*n,1));
		change_min(b[i].r,1,2*n,1,v1[i]);
	}
	clear();
	for (int i=1;i<=n;i++)
	{
		if (i!=1)  ans=max(ans,query_max(b[i].r+1,2*n,1,2*n,1)-v2[i]);
		change_max(b[i].r,1,2*n,1,v2[i]);
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 78624
X,Y,A,B,C  = map(int, input().split())
ps = sorted(list(map(int, input().split())),reverse=True)
qs = sorted(list(map(int, input().split())),reverse=True)
rs = sorted(list(map(int, input().split())),reverse=True)

ps = ps[:X]
qs = qs[:Y]
cnt_c = 0
ans = sum(ps)+sum(qs)
INF = 10**10
while cnt_c < C:
    if len(ps) != 0:
        p = ps.pop()
    else:
        p = INF
    if len(qs) != 0:
        q = qs.pop()
    else:
        q = INF
    r = rs[cnt_c]
    if p - r >= 0 and q - r >= 0:
        break
    elif r - p > r - q: #pのほうが差分が大きい
        qs.append(q)
        ans -= p
        ans += r
    else:
        ps.append(p)
        ans -= q
        ans += r
    cnt_c += 1
print(ans)



"""
2 2 2 2 4
2 4
5 1
10 10 10 10 10
"""

Measured memory_bytes: 106980
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var seqX = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        var s = int.MaxValue;
        for (int i = 0; i < 100; ++i)
        {
            var t = 0;
            for (int j = 0; j < seqX.Length; ++j)
            {
                var d = seqX[j] - i;
                t += d * d;
            }
            s = Math.Min(s, t);
        }

        Console.WriteLine(s);
    }
}


Measured memory_bytes: 13396
// https://atcoder.jp/contests/abc175/tasks/abc175_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> P(N), C(N);
    REP(i, N) cin >> P[i], P[i]--;
    REP(i, N) cin >> C[i];

    int ans = -1e12;
    // スタート位置
    REP(i, N) {
        vector<int> v;
        int now = i;
        while (true) {
            now = P[now];
            v.emplace_back(C[now]);
            if (now == i) {
                break;
            }
        }
        // 循環する要素の長さ
        int m = v.size();
        // 循環する要素の合計
        auto sum = accumulate(begin(v), end(v), 0LL);
        int64_t cur = 0;
        for (int r = 1; r <= m; ++r) {
            if (r > K)
                break;
            cur += v[r - 1];
            // 先頭からスコアを加算し、残りの長さに対して何回循環するか数える
            ans = max(ans, cur + (K - r) / m * max(sum, 0LL));
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3780
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cstdio>
#include<string.h>
#include<cmath>
using namespace std;
bool prime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;
	if (n == 3)return true;
	if (n == 4)return false;
	for (int i = 2; i < ceil(sqrt(n)); i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	for (int i = n;; i++) {
		if (prime(i)) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3584
s=input()
ans=0
for i in range(len(s)):
	if i%2==0:
		if s[i]=="R" or s[i]=="U" or s[i]=="D":
			ans+=1
	else:
		if s[i]=="L" or s[i]=="U" or s[i]=="D":
			ans+=1
if ans==len(s):
	print("Yes")
else:
	print("No")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define N 1003
#define LL long long
const int mod=1e9+7;
using namespace std;

#define M 2
struct matrix{
	int a[M][M];
	matrix(){memset(a,0,sizeof(a));}
	matrix(int v[M][M]){memcpy(a,v,sizeof(a));}
	matrix operator *(const matrix &b){
		matrix ret;
		for(int i=0;i<M;i++)
			for(int j=0;j<M;j++)
				for(int k=0;k<M;k++)
					ret.a[i][k]=(ret.a[i][k]+a[i][j]*1LL*b.a[j][k])%mod;
		return ret;
	}
};
#undef M

template <typename T>
T fastpow(T initial,T x,LL power){
	while(power){
		if(power&1) initial=initial*x;
		x=x*x;power>>=1;
	}
	return initial;
}

int fastpow(int x,int a){
	int ret=1;
	while(a){
		if(a&1) ret=ret*1LL*x%mod;
		a>>=1;x=x*1LL*x%mod;
	}
	return ret;
}

bitset<N> mp[N];
int h,w,bnum,cnum,rnum;//black right connect
LL k;

//num = num *bnum - rnum*pnum  4 = 1 * 6 - 2 * 1
//pnum = pnum *cnum            2 = 1*2
//

void readin(){
	scanf("%d%d%lld",&h,&w,&k);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++){
			char c=getchar();
			while(c!='.'&&c!='#') c=getchar();
			c=='#'? mp[i][j]=1,bnum++:0;
		}
}
int solve(){
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(mp[i][j+1]&&mp[i][j])
				rnum++;
	for(int i=1;i<=h;i++)
		if(mp[i][w]&&mp[i][1])
			cnum++;
	matrix base,tra;
	base.a[0][0]=1,base.a[0][1]=1;
	tra.a[0][0]=bnum,tra.a[1][0]=-rnum,
	tra.a[1][1]=cnum;
	return fastpow(base,tra,k-1).a[0][0];
}
int main(){
	readin();
	if(k<=1) return puts("1"),0;
	bool flag1=false,flag2=false;//横向 纵向 
	for(int i=1;i<=h;i++)
		if(mp[i][1]&mp[i][w]){
			flag1=true;break;
		}
	for(int i=1;i<=w;i++)
		if(mp[1][i]&mp[h][i]){
			flag2=true;break;
		}
	if(flag1&&flag2) return puts("1"),0;
	if(flag1==false&&flag2==false) return printf("%d\n",fastpow(bnum,(k-1)%(mod-1))),0;
	if(flag2){
		for(int i=1;i<=max(h,w);i++)
			for(int j=1,t;j<i;j++)
				t=mp[i][j],mp[i][j]=mp[j][i],mp[j][i]=t;
		swap(h,w);
	}
	cout<<(solve()+mod)%mod<<endl;
	return 0;
} 

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int D[5], k, E[5];
	
	int min = 500;
	int sum = 0;
	
	scanf("%d", &D[0]);
	scanf("%d", &D[1]);
	scanf("%d", &D[2]);
	scanf("%d", &D[3]);
	scanf("%d", &D[4]);
	
	for(k=0; k<5; k++){
		if(D[k] % 10 < min && D[k]% 10 != 0){
			min = D[k] % 10;
		}
	}
  
  if(min==500) min = 10;
	
	for(k=0; k<5; k++){
		if(D[k] % 10 == 0){
			E[k] = 0;
		}
		else{
			E[k] = 10 - D[k] % 10;
		}
		sum = sum + D[k] + E[k];
	}
	
	printf("%d", sum - 10 + min);
	
	return 0;
	
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <list>
#include <string>

void delete_value(std::list<int>& data, int number)
{
    for(std::list<int>::iterator iter = data.begin(); iter != data.end(); iter++) {
        if(*iter == number) {
            data.erase(iter);
            return;
        }
    }
}

void show_data(std::list<int>& data)
{
    printf("%d", data.front());
    for(std::list<int>::iterator iter = std::next(data.begin()); iter != data.end(); iter++) {
        printf(" %d", *iter);
    }
    putchar('\n');
}

int main()
{
    int input_size, number;
    std::string operation;
    std::list<int> data;

    std::cin >> input_size;
    for(int i = 0; i < input_size; i++) {
        std::cin >> operation;
        if(operation == "insert") {
            std::cin >> number;
            data.push_front(number);
        } else if(operation == "delete") {
            std::cin >> number;
            delete_value(data, number);
        } else if(operation == "deleteFirst") {
            data.pop_front();
        } else if(operation == "deleteLast") {
            data.pop_back();
        } else {
            fputs("Error: Invalid operation\n", stderr);
            exit(EXIT_FAILURE);
        }
    }

    show_data(data);

    return 0;
}

Measured memory_bytes: 34380
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <cmath>		// circle math ( sin, con, sinh
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation​
using namespace std;
#define rep(i, n) for(int i = 1; i <= (int)n; i++)
#define ll long long

int main(){
  int X;
  cin >> X;
  if(X >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
 
int main() 
{
  int number[3];
  int i;
  for(i = 0;i < 3;i++){
    cin >> number[i];
  }
  int max = number[0];
  int maxmode = 0;
  if(number[1] > max){
    max = number[1];
    maxmode = 1;
  }
  if(number[2] > max){
    max = number[2];
    maxmode = 2;
  }
  int ans = number[maxmode]*10;
  for(i = 0;i < 3;i++){
    if(i != maxmode){
      ans += number[i];
    }else{
      continue;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int Com(int n, int k) {
	int x=1, y=1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

signed main() {
	int n;
	cin >> n;
	int a[200005];
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int i = 1; i < n; i++) {
		if (a[i - 1] == a[i]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;

	return 0;
}

Measured memory_bytes: 1792
#![allow(unused_imports)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

//
// Macro debug!
//

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

//
// Macro input!
//

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

//
// IteratorExt
//

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}


//
// Main
//

fn main() {
    input! {
        n: usize,
        xs: [usize; n],
    }

    let a = *(xs.iter().max().unwrap());
    let i = xs.iter().enumerate().find(|&(_, &x)| x == a).unwrap().0;
    let b = *(xs.iter().enumerate().filter(|&(j, _)| j != i).map(|(_, x)| x).max().unwrap());
    for j in 0..n {
        println!("{}", if j == i { b } else { a });
    }
}


Measured memory_bytes: 9724
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())


using namespace std;
typedef long long ll;

int main(void) {
	int n;
	int cake = 4,donatu=7;
	cin >> n;
	for (int i = 0; i <= n / cake; i++) {
		for (int j = 0; j <= n/7; j++) {
			if (n == i * cake + j * donatu) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
from math import sqrt,ceil
n = int(int(1e5))

def prime():
    d = [True] * (n+1)
    d[0] = False
    d[1] = False
    for i in range(2,ceil(sqrt(n+1))):
        if d[i] == True:
            j = 2
            while i * j <= n:
                d[i*j] = False
                j += 1
    return d
d = prime()
#print(d)
cum = [0] * (n + 1)
for i in range(1,n+1):
    cum[i] = cum[i-1]
    if i % 2 == 1:
        if d[i] == True and d[(i+1)//2] == True:
            cum[i] += 1
#print(cum)
q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(cum[r] - cum[l-1])

Measured memory_bytes: 51672
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int N;

void gen(int d, string pre){
    map<char, int> cnt;
    rep(i, 0, pre.size()) cnt[pre[i]]++;

    if (d == N)
    {
        rep(i, 0, cnt.size() + 1) cout << pre + (char)('a' + i) << endl;
        return;
    }

    rep(i, 0, cnt.size() + 1) gen(d + 1, pre + (char)('a' + i));
    return;
}

int main() {
    // https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d

    cin >> N;

    gen(1, "");
}


Measured memory_bytes: 1536
#include <iostream>
#include<algorithm>

using namespace std;

long long abss(long long* A,int n,int b){
    long long ans=0;
    for(int i=0;i<n;i++){
        ans+=abs(A[i]-b);
    }
    return ans;
}

int main(){
    
    int n;
    cin>>n;
    long long A[n];
    for(int i=0;i<n;i++){
        cin>>A[i];
        A[i]=A[i]-(i+1);
    }

    
   /* for(int i=1;i<n;i++){
        long long v=A[i];
        int j=i-1;
        while(j>=0&&A[j]<v){
            swap(A[j],A[j+1]);
            j--;
        }
        A[j+1]=v;
    }*/
    sort(A,A+n);
    
    long long a;
    if(n%2==1){
        int a=A[n/2];
        cout<<abss(A,n,a)<<endl;
        return 0;
    }else{
        long long a=abss(A,n,A[n/2]);
        long long b=abss(A,n,A[(n/2)-1]);
        cout<<min(a,b)<<endl;
    }
    
    //cout<<a<<endl;
 //   int ans=abss(A,n,a);
   // cout<<ans<<endl;

return 0;
}


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

typedef pair<long long int, int> P;

long long int gcd(long long int A, long long int B) {
  if(A>B) {
    if(A % B == 0) {
      return B;
    } else {
      return gcd(A%B, B);
    }
  } else {
    if(B % A == 0) {
      return A;
    } else {
      return gcd(B%A, A);
    }
  }
}
// return all divisors of given integer
vector<long long int> divisors(long long int N) {
  vector<long long int> result(0);

  if(N == 1) {
    result.push_back(1);
  } else {
    int limit = ceil(sqrt(N));

    for(int i=1;i<limit;i++) {
      if(N % i == 0) {
        result.push_back(i);
        result.push_back(N / i);
      }
    }
  }

  return result;
}

bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.second > secondElof.second;
}

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

  long long int GCD = gcd(A, B);

  vector<long long int> D = divisors(GCD);

  sort(D.begin(), D.end());

  vector<long long int> result(0);

  for(int i=0;i<D.size();i++) {
    bool ok = true;
    for(int j=0;j<result.size();j++) {
      if(gcd(D[i], result[j]) == 1) {
        continue;
      } else {
        ok = false;
        break;
      }
    }
    if(ok) {
      result.push_back(D[i]);
    }
  }

  cout << result.size() << endl;
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void){
  int month=0;
  int day=0;
  scanf("2019/%d/%d",&month,&day);
  day=month*31+day;
  if(day<=154)
  {
    printf("Heisei");
  }
  else
  {
    printf("TBD");
  }
  return 0;
}

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

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

int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  int midhigh = b[n / 2], midlow = b[n / 2 - 1];
  rep(i, n){
    if(a[i] <= midlow){
      cout << midhigh << endl;
    }else{
      cout << midlow << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
string s;
int c=0;
signed main()
{
	cin>>s;
	rep(i,s.size()){
		if(c==1){
			if(s[i]=='F'){
				cout<<"Yes";
				return 0;
			}
		}else{
			if(s[i]=='C'){
				c++;
			}
		}
	}
	cout<<"No";
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int h,w;
  int i,j;
  
  while(1){
    scanf("%d",&h);
    scanf("%d",&w);

    if(h==0 && w==0){
      break;
    }
    
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
        if( (i%2==0 && j%2==1) || (i%2==1 && j%2==0)){
          printf(".");
        }else{
          printf("#");
        }
      }
      putchar('\n');
    }
    putchar('\n');
  }
  
  return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define gr vector<vector<pii>>
#define fi first
#define se second
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    int res = n / (a + b) * a;
    n %= (a + b);
    if (n >= a)
        n = a;
    res += n;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);

const int MAX_N = 1<<18, max_bit = 18, MAX_W = int(1e+5);
int v[MAX_N], w[MAX_N];
int dp[(1<<9)][MAX_W + 1];
int main() {
    cin>>N;
    rep(i,N) cin>>v[i + 1]>>w[i + 1];
    //rep(i,18) if((N>>i)&1) max_bit = i + 1;
    reps(i,1,min(N + 1, (ll)(1<<(max_bit / 2)))){
        if(i == 1){
            reps(j, w[1], MAX_W + 1) dp[1][j] = v[1];
        }else {
            rep(j, MAX_W + 1) {
                dp[i][j] = dp[i/2][j];
                if(j >= w[i]) dp[i][j] = max(dp[i][j], dp[i/2][j - w[i]] + v[i]);
                if(j > 0) dp[i][j] = max(dp[i][j], dp[i][j-1]);
            }
        }
    }
    cin>>Q;
    rep(i,Q){
        int tv, l;
        cin>>tv>>l;
        if(tv < (1<<(max_bit / 2))){
            cout<<dp[tv][l]<<"\n";
        }else{
            int pv = tv;
            vector<vector<int> >  memo(2, vector<int>(1, 0));
            while(pv >= (1<<(max_bit / 2))) {
                int temp_sz = memo[1].size();
                rep(j, temp_sz){
                    memo[0].push_back(memo[0][j] + v[pv]);
                    memo[1].push_back(memo[1][j] + w[pv]);
                }
                pv /= 2;
            }
            int res = 0, sz = memo[0].size();
            rep(j, sz) {
                if(memo[1][j] <= l) {
                    res = max(res, memo[0][j] + dp[pv][l - memo[1][j]]);
                }
            }
            cout<<res<<"\n";
        }
    }
}

Measured memory_bytes: 205264
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N;
    cin >> N;
    long long sum = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 3 != 0 && i % 5 != 0) sum += i;
    }

    cout << sum << endl;
    
    return 0;
}

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

int main(){
 string A;
 string B;
 int i;
 cin>>A>>B;
 
 if(A.size()>B.size()){
 	cout<<"GREATER"<<endl;
 }else if(A.size()<B.size()){
 	cout<<"LESS"<<endl;
 }else{
 	for(i=0;i<A.size();i++){
		if(A[i]>B[i]){
			cout<<"GREATER"<<endl;
			break;
		}else if(A[i]<B[i]){
			cout<<"LESS"<<endl;
			break;
		}
		if(i==A.size()-1){
			cout<<"EQUAL"<<endl;
		}
	}
 }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    sort(all(A));
    reverse(all(A));
    
    ll ans=0;
    
    for(int i=1;i<N;i++) ans+=A[i/2];
    
    cout<<ans<<endl;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    cout << (N + 1) / 2 << endl;
}

Measured memory_bytes: 256
n,m=gets.split.map(&:to_i)
ss = m.times.map{gets.split.map(&:to_i).tap(&:shift).map{|x|x-1}}
ps = gets.split.map(&:to_i)

puts (1<<n).times.select{|s| ss.each_with_index.all?{|ss,i| ss.map{|ss|s[ss]}.inject(0,&:+)%2 == ps[i]}}.size


Measured memory_bytes: 1916
while True:
    ans = 0
    n, x = map(int, input().split())
    if n == x == 0:
        break
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    ans += 1
    print(ans)


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

#define MP make_pair

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

using namespace std;

int A[100002];

int main() {
    //ios_base::sync_with_stdio(0);
    int n;
    cin >> n;

    FOR(i, 1, n) {
        scanf("%d", &A[i]);
        //cout << A[i] << endl;
    }

    int no = 0;
    FOR(i, 1, n) {
        if(i == A[A[i]]) {
            no++;
        }
    }
    printf("%d\n", no/2);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int n, a, b, c;
int l[10];
int mi = INT_MAX;

int dfs(int depth, int A, int B, int C, int Ai, int Bi, int Ci)
{
    if (depth == n)
    {
        if (Ai > 0 && Bi > 0 && Ci > 0)
        {
            int ans = 0;
            ans = abs(A - a) + abs(B - b) + abs(C - c) + (Ai - 1) * 10 + (Bi - 1) * 10 + (Ci - 1) * 10;
            mi = min(ans, mi);
        }
    }
    else
    {
        dfs(depth + 1, A + l[depth], B, C, Ai + 1, Bi, Ci);
        dfs(depth + 1, A, l[depth] + B, C, Ai, Bi + 1, Ci);
        dfs(depth + 1, A, B, C + l[depth], Ai, Bi, Ci + 1);
        dfs(depth + 1, A, B, C, Ai, Bi, Ci);
    }
}

int main()
{
    cin >> n >> a >> b >> c;
    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
    }
    dfs(0, 0, 0, 0, 0, 0, 0);
    cout << mi << endl;
}


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

int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    int ans = 1e9;
    for (int i = 0; i < n; ++i) {
        int x; scanf("%d", &x);
        if (x == 1) for (int j = i; j < i+k; ++j) {
            int l = ((j-k+1)+k-2)/(k-1);
            int r = (n-j-1 + k-2)/(k-1);
            ans = min(ans, l+r+1);
        }
    }
    printf("%d\n", ans);

    return 0;
}


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

using namespace std;

int n, s;
int x[maxn];
vector<int> v;
long long p[maxn], ans;

int main(){
	scanf("%d%d", &n, &s);
	for(int i = 1;i <= n;i++) scanf("%d%lld", &x[i], &p[i]);
	//if(x[1] >= s) return printf("%d", x[n] - s), 0;
	//if(x[n] <= s) return printf("%d", s - x[1]), 0;
	int l = 1, r = n;
	while(l < r){
		//特判全在一侧的情况 
		if(x[l] >= s){
			l = r;
			break;
		}
		if(x[r] <= s) break;
		if(p[l] >= p[r]) p[l] += p[r], v.push_back(r--);
		else p[r] += p[l], v.push_back(l++);
	}
	v.push_back(l);
	while(!v.empty()) ans += abs(s - x[v.back()]), s = x[v.back()], v.pop_back();
	printf("%lld", ans);
}

Measured memory_bytes: 5112
import java.util.Scanner;

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

		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = 0;

		for (int i = 0; i < m; i++) {
			sum += sc.nextInt();
		}

		if (n >= sum)
			System.out.println(n - sum);
		else
			System.out.println(-1);
	}

}


Measured memory_bytes: 39552
#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    int N,K; cin >> N >> K;
    vector<int> v(N);
    REP(i,N) cin >> v[i];

    REP(i,N) {
        if (v[i] != 1) continue;
        // cerr << i << endl;
        auto left = i;
        auto right = N - i - 1;

        auto left_cost = (i+K-1-1)/(K-1);
        if (left_cost && (left_cost * (K-1)) > left) right -= (left_cost * (K-1)) - left;

        chmax(right,0);
        auto right_cost = (right+K-2)/(K-1);
        cout << left_cost+right_cost << endl;
    }
    assert("bugged");
}

void solve2() {
    int N,K; cin >> N >> K;
    vector<int> v(N);
    REP(i,N) cin >> v[i];
    // find min
    int mini = INF;
    REP(i,N) chmin(mini,v[i]);
    int cnt = 0;
    int ans = 0;
    int buf = 0;
    REP(i,N) {
        if (mini == v[i]) {
            if (cnt < (K-1)) {
                buf = K-1-cnt;
                ans++;
            } else {
                // 削除動作回数
                auto del = (cnt+K-2)/(K-1);
                ans += del;
            }
            cnt = 0;
        }
        else {
            if (buf) {
                buf--;
                continue;
            }
            cnt++;
        }
    }
    ans += (cnt+K-2)/(K-1);
    cout << ans << endl;
}

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

Measured memory_bytes: 3684
using System;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int a = sc.NextInt();
        int b = sc.NextInt();
        if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
        {
            Console.WriteLine("Possible");
        }
        else
        {
            Console.WriteLine("Impossible");
        }
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

int main(){
    string data;
    cin >> data;
    int n = data.size()-1;
    __int64_t ans = 0;
    __int64_t tmp;
    for(int bit = 0; bit < (1 << n); bit++){
        tmp = data[0] - '0';
        for(int j = 0; j < n; j++){
            if(bit & (1 << j)){
                ans += tmp;
                tmp = 0;
            }
            tmp = tmp * 10 + (data[j+1] - '0');
        }
        ans += tmp;
    }
    std::cout << ans << std::endl;


}

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


int main() {
    int D, N; 
    cin >> D >> N;
 
	int S = 1; 
    for (int i = 0; i < D; i++) {
        S *= 100;
    }
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
}



Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int n = sc.nextInt();
			if(n == 0) break;
			int[][] a = new int[n][n];
			int i = n / 2 + 1;
			int j = n / 2;
			int num = 1;
			while(n * n >= num) {
				if(a[i % n][j % n] == 0) {
					a[i % n][j % n] = num;
					num++;
					i++;
					j++;
				}else {
					i++;
					j--;
					a[i % n][j % n] = num;
					num++;
					i++;
					j++;
				}
			}
			for(int k = 0; k < n; k++) {
				for(int l = 0; l < n; l++) {
					System.out.printf("%4d", a[k][l]);
				}
				System.out.println();
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 27792
///RAIYAN_MAHIN
        #include "bits/stdc++.h"
        using namespace std;
        using ll = long long;
        int main()
        {
            ll n; cin >> n;
            string s; cin >> s;
            ll d = s.size();
            ll cnt = 0;
            for(ll i = 0; i < d; i++)
            {
                if(s[i] == 'A')
                {
                    if(s[i + 1] == 'B')
                    {
                        if(s[i + 2] == 'C')
                        {
                            cnt++;
                        }
                    }
                }
            }
            cout << cnt << '\n';
            
    
            
        }

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(0);
	int N;
	bool ans=true;
	int D[200005];
	map<int, int> mp;

	cin >> N;
	rep(i,N){
		cin >> D[i];
		mp[ D[i] ]++;
	}

	int M;
	cin >> M;
	rep(i,M){
		int T;
		cin >> T;
		if( mp[T] <= 0 ) ans = false;
		else mp[T]--;
	}

	cout << (ans?"YES":"NO") << endl;

	return 0;
}

Measured memory_bytes: 12416
#include <iostream>
using namespace std;
int main(){
  int n, ans=1, max=0;
  cin >> n;
  int h[n];
  for(int i=0; i<n; i++)
    cin >> h[i];
  max=h[0];
  for(int i=1; i<n; i++){
    if(h[i]>=max){
      ans++;
      max=h[i];
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef struct directed_edge {
  int32_t vertex;
  int32_t next;
} graph_edge;

typedef struct directedGraph {
  graph_edge *edge;
  int32_t *start;
  int32_t pointer;
  int32_t vertex_num;
  int32_t edge_max_size;
} graph;

graph* new_graph (const int vertex_num) {
  graph *g = (graph *) calloc (1, sizeof (graph));
  g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));
  g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
  g->pointer = 0;
  g->vertex_num = vertex_num;
  g->edge_max_size = 1;
  for (int32_t i = 0; i < vertex_num; ++i) {
    g->start[i] = -1;
  }
  return g;
}

void add_edge (graph *g, int32_t from, int32_t to) {
  if (g->pointer == g->edge_max_size) {
    g->edge_max_size *= 2;
    g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);
  }
  g->edge[g->pointer] = (graph_edge) {to, g->start[from]};
  g->start[from] = g->pointer++;
}

int topological_sort (graph *g, int32_t *q) {
  int32_t n = g->vertex_num;
  int32_t *cnt = (int32_t *) calloc (n, sizeof (int32_t));
  for (int32_t i = 0; i < n; ++i) {
    for (int32_t p = g->start[i]; p != -1; p = g->edge[p].next) {
      const int32_t u = g->edge[p].vertex;
      cnt[u]++;
    }
  }
  int32_t front = 0;
  int32_t last = 0;
  for (int32_t i = 0; i < n; ++i) {
    if (cnt[i] == 0) {
      q[last++] = i;
    }
  }
  while (front < last && last < n) {
    const int32_t v = q[front++];
    for (int32_t p = g->start[v]; p != -1; p = g->edge[p].next) {
      const int32_t u = g->edge[p].vertex;
      cnt[u]--;
      if (cnt[u] == 0) {
	q[last++] = u;
      }
    }
  }
  free (cnt);
  return last == n;
}

typedef int32_t i32;

void run (void) {
  i32 v, e;
  scanf ("%" SCNi32 "%" SCNi32, &v, &e);
  graph *g = new_graph (v);
  while (e--) {
    i32 s, t;
    scanf ("%" SCNi32 "%" SCNi32, &s, &t);
    add_edge (g, s, t);
  }
  i32 *q = (i32 *) calloc (v, sizeof (i32));
  topological_sort (g, q);
  for (i32 i = 0; i < v; ++i) {
    printf ("%" PRIi32 "\n", q[i]);
  }
}

int main (void) {
  run ();
  return 0;
}



Measured memory_bytes: 2256