akhauriyash/Code-Regression huggingface dataset:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()
  if '7' in s:
    return 'Yes'
  return 'No'

# main()
print(main())


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

const long long MOD = 1000000007;

int main(){
  int n,a;
  bool ans = true;
  cin >> n;
  rep(i,n){
    cin >> a;
    if(a % 2 == 0){
      if(a%3 != 0 && a%5 != 0) ans = false;
    }
  }
  if(ans) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char [] l = s.toCharArray();
        int c1 = 0;
        int c2 = 0;

        for (int i = 0; i < l.length; i++){

            int dc1 = i % 2;
            int dc2 = (i + 1) % 2;

            if(l[i] - '0' != dc1) c1++;
            if(l[i] - '0' != dc2) c2++;
        }
        System.out.println(Math.min(c1,c2));

    }

    public static void q1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> l = new ArrayList<>();
        for (int i = 0; i < N; i++){
            l.add(sc.nextInt());
        }
        int max = -1;
        int count = 0;
        for (int i = 0; i < l.size();i++){
            if (l.get(i) >= max){
                count++;
            }
            max = Math.max(max,l.get(i));
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26988
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main() {
    int height, width;
    cin >> height >> width;
    int sy,sx,gy,gx;
    /* 盤面 */
    vector<string> field(height);
    for (int h = 0; h < height; ++h) cin >> field[h];

    int counter=0;
    for(ll q=0; q<width; q++){
    for(ll w=0; w<width; w++){
    for(ll e=0; e<height; e++){
    for(ll r=0; r<height; r++){
    sy=q; gy=w; sx=e; gx=r;
    //cout << sy <<" " << gy << " " << sx << " " << gx << endl;
    if((q==w)&&(e==r)) continue;
    if (field[sx][sy] == '#'||field[gx][gy]=='#')continue;
    //vector<vector<int> > dist(height, vector<int>(width, -1)); 
    int dist[height][width];
    for(int i=0; i<height; i++){
    for(int k=0; k<width; k++){
    dist[i][k]=-1;}}
    dist[sx][sy] = 0; 
    queue<pair<int, int> > que; 
    que.push(make_pair(sx, sy));
    while (!que.empty()) {
        pair<int, int> current_pos = que.front(); // キューの先頭を見る (C++ ではこれをしても pop しない)
        int x = current_pos.first;
        int y = current_pos.second;
        que.pop(); // キューから pop を忘れずに
    for (int direction = 0; direction < 4; ++direction) {
            int next_x = x + dx[direction];
            int next_y = y + dy[direction];
            if (next_x < 0 || next_x >= height || next_y < 0 || next_y >= width) continue; // 場外アウトならダメ
            if (field[next_x][next_y] == '#') continue; // 壁はダメ

           
            if (dist[next_x][next_y] == -1) {
              que.push(make_pair(next_x, next_y));
                dist[next_x][next_y] = dist[x][y] + 1; // (next_x, next_y) の距離も更新
               
            }
        }
        // 隣接頂点を探索
        
    }
    
                counter=max(counter,dist[gx][gy]);
    //cout << counter << endl;
    }}}}

        cout << counter << endl;
    }



Measured memory_bytes: 3564
//#define kotani int
#include<iostream>
#include<algorithm>
using namespace std;
int search(int rank);
int tim[100000];
int nagase_time[100000];
int n,k;
int ans,www;
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>tim[i];
	}
	/*k-=n;
	ans=n;
	if(k<0){
		int num=-1;
		for(int i=0;i<k;i++){
			num=+search(num);
			ans+=num;
		}
	}*/
	for(int i=1;i<n;i++){
		nagase_time[i-1]=tim[i]-tim[i-1]-1;
		//cout<<"ww"<<nagase_time[i-1]<<endl;
	}
	sort(nagase_time,nagase_time+(n-1));
	/*for(int i=0;i<n-1;i++){
		cout<<nagase_time[i]<<endl;
	}*/
	www=n-k;
	ans=0;
	for(int i=0;i<www;i++){
		ans+=nagase_time[i];
	}
	cout<<ans+n<<endl;
}
/*int search(int rank){
	int min=-1,sub;
	for(int i=0;i<n-1;i++){
		if(time[i+1]-time[i]<min||min==-1){
			sub=min;
			min=time[i+1]-time[i];
		}
		if(min<rank){
			min=sub;
		}
	}
	return min;
}*/


Measured memory_bytes: 3944
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int cnt=0;
	for(int i=0;i<3;i++){
		if(s1[i]==s2[i])cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
N=int(input())
B={}
for i in range(N):
    tmp=input()
    if tmp not in B:
        B.setdefault(tmp,1)
    else:
        B[tmp]+=1
M=int(input())
R={}
for i in range(M):
    tmp=input()
    if tmp not in R:
        R.setdefault(tmp,1)
    else:
        R[tmp]+=1
Ans=0
for i in B:
    if i in R:
        if B[i]-R[i]>Ans:
            Ans=B[i]-R[i]
    else:
        if B[i]>Ans:
            Ans=B[i]
print(Ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int a[123456];
bool b[123456];
signed main() {
	int n, k;
	while (cin >> n >> k, n) {
		for (int i = 0; i <= n; i++) { a[i] = 0; b[i] = 0; }
		for (int i = 0; i < k; i++) {
			int p; cin >> p;
			b[p] = 1;
		}
		int ans = 0, cnt1 = 0, cnt2 = 0;
		for (int i = 1; i <= n; i++) {
			if (b[i]) {
				a[i] = a[i - 1] + 1;
				ans = max(a[i], ans);
			}
		}
		if (b[0]) {
			ans++;
			int cnt = 0;
			for (int i = 1; i <= n; i++) {
				if (b[i]) {
					if (i >= 2 && !b[i - 1])cnt = a[i - 2] + 1;
					cnt++; ans = max(ans, cnt);
				}
				else cnt = 0;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3564
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N, M = MAP()
if N*M == 1:
	print(1)
elif N == 1 or M == 1:
	print(max(N, M)-2)
	exit()
else:
	C = (N+M-2)*2
	print(N*M-C)

Measured memory_bytes: 5328
import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, P = map(int, input().split())
S = list(map(int, list(input())))
# print(S)
S.reverse()

ans = 0
if P == 2 or P == 5:
    cnt = 0
    for i in range(N):
        if S[i] % P == 0:
            ans += N - i

else:
    cummod = [0] * P

    d = 1
    prev = 0
    for i in range(N):
        m = (S[i] * d) % P
        m += prev
        m %= P
        cummod[m] += 1
        d *= 10
        d %= P
        prev = m

    #cummod[0] += 1

    for n in cummod:
        if n <= 1:
            continue
        ans += n * (n - 1) // 2

    ans += cummod[0]

print(ans)


Measured memory_bytes: 6816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}

ll A[N];

int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	int n;scanf("%d",&n);
	REP(i,n)	scanf("%lld",&A[i]);
	ll ans = 0;
	// sort(all(A[i]));
	REP(i,n){
		ans += (A[i]/2);
		A[i]%=2;
		if(A[i] && A[i+1])	ans++,A[i]--,A[i+1]--;
	}
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
 
using namespace std;
 
int main(){
  int n,q,A[3000],M[3000];
  int dp[3000];
 
  cin >> n;
  rep(i,n)cin >> A[i]; // sortされて与えられるみたいなのでソートは略
  cin >> q;
  rep(h,q){
    cin >> M[h];
    rep(i,M[h]+1)dp[i]=-1;
    dp[0] = 0;
    rep(i,n){
      for(int j=0;j<=M[h];j++){//0からM[h](確かめたい値)まで１つずつ増やして作れるか確かめていく
	if(dp[j] >= 0){//もし0 or 1ならばその値は作れているので１をいれる(今回は１だが複数回使えるときは使える回数を代入しても良い)
	  dp[j] = 1;
	}
	else if(dp[j-A[i]] <= 0 || j<A[i]){//今の値の場所からA[i]（与えられた値）を引いたところが０orマイナスならもう既に使っているかもとよりつくれないのでスルー　jがA[i]より小さいのであれば作れないので明らかなのでスルー
	  dp[j]=-1;
	}else{//以上の条件を満たしていないなら作れるので配列DPにいれる　マイナス１しているのは使った値をまた使わないため
	  dp[j] = dp[j-A[i]]-1;
	}
	//  cout << dp[j] << endl;
      }
    }
    if(dp[M[h]] >= 0)cout << "yes" << endl;
    else cout << "no" << endl;
    
  }
  
  return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    lli num , sumH = 0 , sumC = 0 ;
    cin >> num ;
    pair <lli , lli> a[num] ;
    loop(num)
        cin >> a[i] . F ;

    loop(num)
        cin >> a[i] . S ;

    loop(num)
    {
        if (a[i] . F - a[i] . S > 0 ){
            sumH += a[i] . F ;
            sumC += a[i] . S ;
        }
    }
    cout << sumH - sumC << endl ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#define LL long long

LL gcd(LL a, LL b) { return b ? gcd(b, a%b) : a; }

int main() {
	LL A, B;
	while (std::cin >> A >> B) {
		if (A < B)std::swap(A, B);
		LL g = gcd(A, B);
		std::cout << g << " " << (A*B) / g << std::endl;
	}
	return 0;
}


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

const ll MOD = 1e9+7;
ll N;
vector<ll> prime;
vector<ll> primeex;

bool isprime(ll num) {
    if (num<2) return false;
    else if (num == 2) return true;
    else if (!(num%2)) return false;

    for (int i = 3; i*i <= num; i+=2) {
        if (!(num%i)) return false;
    }
    return true;
}

ll getexp(ll num, ll p) {
    ll ans = 0;
    while(!(num%p)) {
        ans++;
        num/=p;
    }
    return ans;
}

int main() {
    cin >> N;
    for (int i = 0; i < 1000; i++) if (isprime(i)) prime.push_back(i);
    ll pn = prime.size();
    primeex.resize(pn);
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j < pn; j++) {
            primeex[j] += getexp(i,prime[j]);
        }
    }
    ll ans = 1;
    for (int i = 0; i < pn; i++) {
        ans *= primeex[i]+1;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int sum = 0;
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i = 0;i < N;i++) {
        cin >> d.at(i);
    }
    for(int i = 0;i < N - 1;i++) {
        for(int j = i + 1;j < N;j++) {
            sum += d.at(i) * d.at(j);
        }
    }
    cout << sum << endl;
}


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

int main() {
    ll N, t, ans = 0;
    cin >> N >> t;
    vector<ll> time(N);
    rep(i, 0, N) cin >> time[i];
    rep(i, 0, N-1){
        if(time[i+1]-time[i] < t) ans += time[i+1]-time[i];
        else ans += t;
    }
    ans += t;
    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main{
	public static void main(String[] arg){
    	Scanner sc=new Scanner(System.in);
      int x=sc.nextInt();
      long ans=0;
      ans+=1000*(long)((x)/500);
      ans+=5*(long)((x-500*(long)(x/500))/5);
      System.out.println(ans);
        
    }
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    if(N >= 64) cout << 64 << endl;
    else if(N >= 32) cout << 32 << endl;
    else if(N >= 16) cout << 16 << endl;
    else if(N >= 8) cout << 8 << endl;
    else if(N >= 4) cout << 4 << endl;
    else if(N >= 2) cout << 2 << endl;
    else cout << 1 << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount



int t, n, m, k, a[300010], q, l, r, x, y;



int32_t main(){
INIT
cin>>x>>y;


if( (y%2==0) && (y<=(4*x) ) && (y>=(2*x)) ){
    cout<<"Yes";
}
else{
    cout<<"No";
}



return 0;
}


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

enum FACE{ TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT };
struct Dice {
    vector<int> v;
    Dice() {
        v = {1,  6, 3, 4, 2, 5};
    }
    void roll_x() {
        roll(TOP, BACK, BOTTOM, FRONT);
    }
    void roll_y() {
        roll(TOP, LEFT, BOTTOM, RIGHT);
    }
    void roll_z() {
        roll(FRONT, RIGHT, BACK, LEFT);
    }
    void roll_r(int r) {
        if(r == 0) roll(TOP, LEFT, BOTTOM, RIGHT);
        if(r == 1) roll(TOP, BACK, BOTTOM, FRONT);
        if(r == 2) roll(TOP, RIGHT, BOTTOM, LEFT);
        if(r == 3) roll(TOP, FRONT, BOTTOM, BACK);
    }
    void roll(int a, int b, int c, int d) {
        int tmp = v[a];
        v[a] = v[b];
        v[b] = v[c];
        v[c] = v[d];
        v[d] = tmp;
    }
};
vector<Dice> all_dice() {
    vector<Dice> res;
    Dice d;
    REP(i, 6) {
        REP(j, 4) {
            res.push_back(d);
            d.roll_z();
        }
        if(i & 1) d.roll_x();
        else d.roll_y();
    }
    return res;
}
int main() {
    vector<Dice> dices = all_dice();
    int n;
    typedef pair<int, int> P;
    while(cin >> n && n) {
        map<P, int> height;
        map<P, int> top;
        REP(_, n) {
            int t, f;
            cin >> t >> f;
            Dice d;
            for(Dice di : dices) {
                if(di.v[TOP] == t && di.v[FRONT] == f) {
                    d = di;
                }
            }
            int cx = 0, cy = 0;
            while(true) {
                //cout << cx << " " << cy << endl;
                vector<pair<int, int>> cand; // (val, nr)
                int dx[4] = {1, 0, -1, 0};
                int dy[4] = {0, 1, 0, -1};
                REP(r, 4) {
                    int nx = cx + dx[r];
                    int ny = cy + dy[r];
                    Dice nd = d;
                    nd.roll_r(r);
                    //cout << "b" << nd.v[BOTTOM] << endl;
                    if(nd.v[BOTTOM] <= 3) continue;
                    if(height[make_pair(cx, cy)] > height[make_pair(nx, ny)]) {
                        cand.push_back(make_pair(nd.v[BOTTOM], r));
                    }
                }
                if(cand.size() == 0) break;
                sort(cand.begin(), cand.end());
                int nr = cand[cand.size() - 1].second;
                //cout << "r " << nr << endl;
                cx += dx[nr];
                cy += dy[nr];
                d.roll_r(nr);
                //cout << "B " << d.v[BOTTOM] << endl;
            }
            height[make_pair(cx, cy)]++;
            top[ make_pair(cx, cy) ] = d.v[TOP];
        }
        vector<int> ans(6);
        for(auto p : top) {
            ans[ p.second - 1] ++;
        }
        REP(i, 6) {
            cout << ans[i];
            if(i + 1 < 6) cout << " ";
            else cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1224
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Bool
import Data.Fixed
import Data.Tuple
import Data.Ratio
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V
 
getI = read <$> getLine :: IO Int
getIs = map read . words <$> getLine :: IO [Int]
getD = read <$> getLine :: IO Double
getDs = map read . words <$> getLine :: IO [Double]
getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]
 
type Row = Integer
type Col = Integer
type PointI = (Integer, Integer)
type Point = (Int, Int)
 
mmm = 1000000007
fact n
    | n < 1 = 1
    | True = foldr1 (*) [1..n]
fi = fromInteger
fig = fromIntegral
rf = realToFrac
 
(.<.) f g -- combination
    | f < g = 0 
    | g < 1 || f < 1 = 1
    | True = foldr1 (*) (take g [f,f-1..]) `div` fact g
(.>.) f g --combination with repetition
    | g < 1 || f < 1 = 1
    | True = fact (f + g - 1) `div` (fact (f - 1) * fact g)
comb = (.<.)
combWp = (.>.)
 
unique a = unique_ (reverse . sort $ a) [] Nothing
    where
        unique_ [] arr _ = arr
        unique_ (x:xs) arr n
            | n == Just x = unique_ xs arr n
            | otherwise = unique_ xs (x:arr) $ Just x
 
zeroume keta num
    | (length . show $ num) > keta = show num
    | otherwise = do 
        let zeros = take keta $ repeat '0'
        reverse . take keta $ (reverse . show $ num) ++ zeros
 
i2b num
    | num < 2 = show num
    | otherwise = i2b_ num []
        where
            i2b_ num str
                | num == 0 = str
                | num == 1 = '1':str
                | otherwise = do
                    let next = num `div` 2
                    let this = if odd num then '1' else '0'
                    i2b_ next (this:str)
 
mapIncr = mapPlus 1
mapPlus n Nothing = Just n
mapPlus n a = (+) n <$> a
 
countIf f = length . filter f
 
-- 
--
--
enumAll :: (Int, Int) -> Int -> [((Int, Int), Int)]
enumAll (x, y) h = [((a, b), h + abs (x - a) + abs (y - b)) | a <- [0..100], b <- [0..100]]

main = do
  time <- getI
  points <- reverse . sortOn snd . map (\[x,y,z] -> ((x, y), z)) <$> replicateM time getIs
  let candidates = uncurry enumAll $ head points
      inputs = if length points > 1 then map isCorrect $ tail points else []
      ans = foldr filter candidates inputs
  putStrLn . format $ head ans
  where
    isCorrect ((a, b), c) ((x, y), z) = max (z - dist) 0 == c
      where dist = abs (a - x) + abs (b - y)
    format ((a, b), c) = show a ++ " " ++ show b ++ " " ++ show c


Measured memory_bytes: 1020
#include<iostream>
#include<vector>
#include<cmath>
#include<limits.h>
using namespace std;
int main(){
    long long int n;
    cin>>n;
    vector<long long int>v(n);
    for(long long int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    long long int sum=0;
    for(long long int i:v)
        sum+=i;
    long long int min=INT_MAX;
    long long int first=0;
    for(long long int i=0;i<n-1;i++)
    {
        first+=v[i];
        sum-=v[i];
        if(min>abs(first-sum))
        {
            min=abs(first-sum);
        }
    }
    cout<<min;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int main() {
    int n,x,y;cin>>n>>x>>y;
    vector<int> tree[2005];
    int seen[2005];
    rep(i,n) {
        tree[i].push_back(i+1);
        tree[i+1].push_back(i);
    }
    tree[x-1].push_back(y-1);
    tree[y-1].push_back(x-1);
    int dist[2005][2005];
    for(int i=0;i<n;i++) {
        rep(j,n) seen[j]=0;
        queue<int> que;
        que.emplace(i);
        seen[i]=1;
        while(!que.empty()) {
            int now = que.front();
            que.pop();
            for(int j = 0;j<int(tree[now].size());j++) {
                int nxt = tree[now][j];
                if(!seen[nxt]) {
                    seen[nxt]=1;
                    dist[i][nxt] = dist[i][now]+1;
                    que.emplace(nxt);
                }
            }
        }
    }
    int ans[2005];
    rep(i,n) {
        rep(j,n) {
            ans[dist[i][j]]++;
        }
    }
    rep(i,n) {
        if(i!=0) cout<< ans[i]/2 <<endl;
    }
}

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

template <typename T>
ll lcm(T a, T b){
  return (ll)a * (ll)b / (ll)__gcd(a, b);
}

int main(){
  ll N, M;
  cin >> N >> M;


  vll a(N);
  ll lcm1;
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    if(i == 0) lcm1 = a.at(0);
    else lcm1 = lcm(lcm1, a.at(i));
  }

  if(N == 1){
    if(a.at(0) / 2 > M) cout << 0 << endl;
    else{
      ll minnum = a.at(0)/2;
      int result = 1 + (M - minnum) / a.at(0);
      cout << result << endl;
    }
    return 0;
  }

  sort(ALL(a), greater<ll>());
  int minnum = -1;
  for(int i = a.at(0)/2; i <= M; i+= a.at(0)){
    bool flag = true;
    for(int j = 1; j < N; j++){
      if( (i-a.at(j)/2) % a.at(j) != 0 ){
        flag = false;
        break;
      }
    }
    if(flag){
      minnum = i;
      break;
    }    
  }
  if(minnum == -1) cout << 0 << endl;
  else{
    ll result = 1 + (M - minnum) / lcm1;
    cout << result << endl;
  }
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int a,b,d[100];
	int c,i,j,n,kk,dm;
	int max,temp,max1;
	int cnt;
	max=0;
	cnt=0;
	dm=0;
	kk=0;
	scanf("%d",&n);
	scanf("%d %d",&a,&b);
	scanf("%d",&c);
	for (i=0;i<n;i++) {
		scanf("%d",&d[i]);
	}
	for (i=0;i<n-1;i++) {
		for(j=i+1;j<n;j++){
			if(d[i]<d[j]){
				temp=d[i];
				d[i]=d[j];
				d[j]=temp;
			}
		}
	}
	for(i=0;i<n;i++){
		kk=(dm+c)/(a+b*cnt);
		dm+=d[i];
		cnt++;
		if(max<kk){
			max=kk;
		}
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
A = [int(X) for X in input().split()]
Stock = 0
Money = 1000
for T in range(0,N-1):
    if A[T+1]>A[T]:
        Purchase = Money//A[T]
        Stock += Purchase
        Money -= Purchase*A[T]  
    elif A[T+1]<A[T]:
        Money += Stock*A[T]
        Stock = 0
if Stock>0:
    Money += Stock*A[N-1]
    Stock = 0
print(Money)

Measured memory_bytes: 9188
import java.util.Scanner;

class Main {
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int w = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        int r = Integer.parseInt(sc.next());
        if(0<=x-r&&x+r<=w&&0<=y-r&&y+r<=h) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 26256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
    return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

int main(){
    int n;cin >> n;
    vector<ll> a(n);
    mint total = 0;
    mint tot2 = 0;
    rep(i,n){
        cin >> a[i];
        total += a[i];
        tot2 += a[i]*a[i];
    }
    mint ans = (total*total - tot2)*mint(2).inv();
    cout << ans << endl;

}



Measured memory_bytes: 4824
# 駐車場があり、以下の二種類のプランのどちらかを選んで駐車できます。 プラン 1 : T 時間駐車した場合、 A × T 円が駐車料金となる。
# プラン 2 : 駐車した時間に関わらず B 円が駐車料金となる。 N 時間駐車するとき、駐車料金は最小でいくらになるか求めてください。

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

print(min(N * A, B))

Measured memory_bytes: 9096
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, x, a[100], ans = 0;

	cin >> N >> x;
	rep(i, N) cin >> a[i];

	sort(a, a + N);

	rep(i, N) {
		if (x >= a[i]) {
			if (i == N - 1 && x > a[i]) break;
			else {
				ans++;
				x -= a[i];
			}
		}
		else break;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import bisect
import itertools
import sys

A, B, Q = map(int, input().split())
s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]


def most_simRL(ds, x):
    index = bisect.bisect_left(ds, x)
    if index == 0:
        return [ds[0]]
    elif index == len(ds):
        return [ds[-1]]
    return ds[index-1:index+1]


def calc(a, b, x):
    return min(abs(a-x), abs(b-x)) + abs(a-b)


for x in X:
    s_RL = most_simRL(s, x)
    t_RL = most_simRL(t, x)
    ans = sys.maxsize
    for st in itertools.product(s_RL, t_RL):
        ans = min(ans, calc(st[0], st[1], x))
    print(ans)


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

int main() {
    int h, w;
    while (true) {
        cin >> h >> w;
        if (h == 0 && w == 0) {
            break;
        }

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (i % 2 == 0) {
                    if (j % 2 == 0) {
                        cout << "#";
                    } else {
                        cout << ".";
                    }
                } else {
                    if (j % 2 == 0) {
                        cout << ".";
                    } else {
                        cout << "#";
                    }
                }
                
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3096
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	a,b,c,d = map(int, input().split(" "))
	
	if abs(a-c) <= d:
		print("Yes")
	elif abs(a-b) <= d and abs(b-c) <= d:
		print("Yes")
	else:
		print("No")
	
if __name__ == "__main__":
	main()


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

int main ()
{
    string SS,T;
    cin>>SS>>T;
    int N = SS.length();
    int M = T.length();

    set<string> ans;
    for(int R = N; R >= M; R--)
    {
        int L = R-M;//文字列Tの最初の位置
        bool ok = true;
        REP(i,M){//文字列Tが入るか考える
            if(SS[L+i]!='?' and SS[L+i] != T[i]){
                ok = false;
            }
        }
        if(ok){
            string S;
            REP(i,N) S+=SS[i];
            REP(i,M) S[L+i] = T[i];
            REP(i,N) if(S[i]=='?') S[i] = 'a';
            ans.insert(S);
        }
    }
    if(ans.size() == 0){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }
    cout<<*(ans.begin())<<endl;
    return 0;
}

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


long long int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  int N;
  cin >> N;
  if(N>=30){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}


long long int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Measured memory_bytes: 3628
#include <stdio.h>
int main() {
  int A[101][101];
  int i,n,u,j,k;
  int v;

  for(i=0;i<101;i++){
    for(j=0;j<101;j++){
      A[i][j]=0;
    }
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u=u-1;
    if(k!=0){
      for(j=0;j<k;j++){
        scanf("%d",&v);
        v=v-1;
        A[u][v]=1;
      }
    }
  }

  for(i=0;i<n;i++){
    for (j=0;j<n;j++) {
      printf("%d",A[i][j]);
      if(j!=n-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}

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

int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;

  if(e-a <= k){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    s = S()

    return len(s.split('ABC')) - 1


print(main())





Measured memory_bytes: 5460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
const ll mod=1e9 + 7;
ll power(ll a,ll n)
{
        ll ans=1;
        a=a%mod;
        while(n>0)
        {
                if(n%2==1)
                {
                        ans=(ans*a)%mod;
                }
                n=n/2;
                a=(a*a)%mod;
        }
        return ans;
}
bool comp(pair<ll,ll> &a,pair<ll,ll> &b)
{
        if(a.ff==b.ff)
        {
                return a.ss<b.ss;
        }
        a.ff<b.ff;
}
int main()
{
   ll n,k;
   cin>>n>>k;
   if(k>((n-1)*(n-2))/2)
   {
           cout<<"-1";
           return 0;
   }
   else
   {
           vector<pair<ll,ll> > g;
           for(int i=2;i<=n;i++)
           {
                   g.pb(mp(1,i));
           }
           int x=((n-1)*(n-2))/2  - k;
           if(x<0)
           {
                   cout<<"-1";
                   return 0;
           }
           int j=2;
           while(1)
           {
           for(int i=j+1;i<=n;i++)
           {
                   if(x!=0)
                   {
                           g.pb(mp(j,i));
                           x--;
                   }
                   else
                   {
                           break;
                   }
           }
           j++;
           if(x==0)
           {
                   break;
           }
           }
           cout<<g.size()<<endl;
           for(int i=0;i<g.size();i++)
           {
                   cout<<g[i].ff<<" "<<g[i].ss<<endl;
           }
           }
        return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
int a[102][102],b,c,i,j;
scanf("%d %d\n",&b,&c);
a[b][c]=0;
for(i=0;i<b;i++){
for(j=0;j<c;j++){
scanf("%d",&a[i][j]);
a[b][c]=a[b][c]+a[i][j];
}
scanf("\n");
}
for(i=0;i<b;i++){
a[i][c]=0;
for(j=0;j<c;j++){
a[i][c]=a[i][c]+a[i][j];
}
}
for(i=0;i<c;i++){
a[b][i]=0;
for(j=0;j<b;j++){
a[b][i]=a[b][i]+a[j][i];
}
}
for(i=0;i<=b;i++){
for(j=0;j<=c;j++){
if(j==0){
printf("%d",a[i][j]);
}
else{
printf(" %d",a[i][j]);
}
}
printf("\n");
}
return 0;
}



Measured memory_bytes: 2108
#include<stdio.h>

int main(){
long int a[8][1000],b[8][1000],c[8];
long int i,j,k,p,q,r,tmp,N,M;

scanf("%ld %ld",&N,&M);
for(i=0;i<1000;i++){
scanf("%ld %ld %ld",&p,&q,&r);
a[0][i]=p+q+r;
a[1][i]=p+q-r;
a[2][i]=p-q+r;
a[3][i]=p-q-r;
a[4][i]=-p+q+r;
a[5][i]=-p+q-r;
a[6][i]=-p-q+r;
a[7][i]=-p-q-r;
}
for(i=0;i<8;i++){
for(j=0;j<N;j++){
b[i][j]=a[i][j];
}
}

for(k=0;k<8;k++){
for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (b[k][i] < b[k][j]) {
        tmp =  b[k][i];
        b[k][i] = b[k][j];
        b[k][j] = tmp;
      }
    }
  }
}

for(k=0;k<8;k++){
for(i=0;i<M;i++){
c[k]=c[k]+b[k][i];
          }
}

for (i=0; i<8; ++i) {
    for (j=i+1; j<8; ++j) {
      if (c[i] < c[j]) {
        tmp =  c[i];
        c[i] = c[j];
        c[j] = tmp;
      }
    }
  }

printf("%ld",c[0]);
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <bitset>

using namespace std;

int main(void)
{
  while (true) {

    int n;
    cin >> n;
    if (n == 0) break;
    int p[n];
    for (int i = 0; i < n; i++)
      cin >> p[i];
    int top,bottom,sum;
    top = -1;
    bottom = 1001;
    sum = 0;
    for (int i = 0; i < n; i++) {
      if (top < p[i])
	top = p[i];
      if (bottom > p[i])
	bottom = p[i];
    }
    //cout << top << "  " << bottom << endl;
    
    bool t, b;
    t = b = true;
    for (int i = 0; i < n; i++) {
      if (top == p[i] && t) {
	t = false;
      }
      else if (bottom == p[i] && b) {
	b = false;
      }
      else
	sum+=p[i];
    }
    cout << (int)(sum/(n-2)) << endl;
    
  }
  return 0;	
}

Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define MAX_N 2000001

int par[MAX_N]; //親
int ran[MAX_N]; //木の深さ

//初期化
void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    ran[i]=0;
  }
}

//根を求める
int find(int x){
  if(par[x]==x)return x;
  else return par[x]=find(par[x]);
}

//集合を合併
void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(ran[x]<ran[y])par[x]=y;
  else {
    par[y]=x;
    if(ran[x]==ran[y])ran[x]++;

  }
}

//xとyが同じ集合に属するのか?
bool same(int x,int y){
  return find(x)==find(y);
}

int main(){
  int n,k,l,a,b;
  cin>>n>>k>>l;
  init(n);
  for(int i=0;i<k;i++){
    cin>>a>>b;
    a--,b--;
    unite(a,b);
  }
  int ar[MAX_N];
  for(int i=0;i<n;i++)ar[i]=find(i);
  init(n);
  for(int i=0;i<l;i++){
    cin>>a>>b;
    a--,b--;
    unite(a,b);
  }
  map<P,int> m;
  for(int i=0;i<n;i++)m[P(ar[i],find(i))]++;
  for(int i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<m[P(ar[i],find(i))];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 18432
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String line[] = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		String x = "Impossible";

		if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
			x = "Possible";
		}
		System.out.println(x);
	}
}

Measured memory_bytes: 23124
use std::io;
fn read() -> Vec<i32> {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().split(' ').map(|x| x.parse().ok().unwrap()).collect()
}

fn main() {
    let inputs = read();
    println!("{}", inputs[0] * inputs[1] / 2);
}



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

int main () {
  map<int,int> mp;
  int n;
  cin >> n;
  for (int i=0; i<n; i++) {
    int a;
    cin >> a;
    mp[a]++;
  }
  int a=0,b=0;
  long long ans=0;
  for (auto p:mp) {
    int x=p.first, c=p.second;
    if ( c>=4 ) {
      ans=max(ans,(long long)x*x);
    }
    if ( c>=2 ) {
      b=a;
      a=x;
    }
    ans=max(ans,(long long)a*b);
  }
  cout << ans << '\n';
  return 0; 
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N, K;
  string S;
  cin >> N >> K >> S;
  
  int cnt = 0;
  for (int i = 0; i < N-1; i++) {
    if (S.at(i) != S.at(i+1)) cnt++;
  }
  cnt = max(0, cnt - 2*K);
  cout << N - cnt - 1 << endl;

  return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll mod=1e9+7;

ll f(int n)
{
    ll ret = 1;
    for(int i=1; i<=n; ++i) (ret*=i)%=mod;
    return ret;
}

ll solve(int n, int m)
{
    if(abs(n-m)>=2) return 0;

    ll ret = (f(n)*f(m))%mod;
    if(n==m) (ret*=2)%=mod;
    return ret;
}

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


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

using namespace std;

int main(){
	int N, total = 0;
	int L[10] = {0};
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> L[i];
	}
	sort(L, L + 10, greater<int>());
	for(int i = 1; i < N; i++){
		total += L[i];
	}
	if(total > L[0]) cout << "Yes";
	else cout << "No";
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a * b == 15){
    cout << "*" << endl;
  }
  else if(a + b == 15){
    cout << "+" << endl;
  }
  else {
    cout << "x" << endl;
  }
}


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

ans_dict = {
  "AC":0,
  "WA":0,
  "TLE":0,
  "RE":0
}

for i in range(N):
  S = str(input())
  ans_dict[S] = ans_dict.get(S,0) + 1

for key in ans_dict.keys():
  print("{} x {}".format(key,ans_dict[key]))


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

int main(){
  string str;
  cin >> str;
  int n;
  n = str.size();
  if(n%2 == 1) n-=1;
  for(int i = n-2; i >= 0; i = i-2){
    if(str.substr(0,i/2) == str.substr(i/2,i/2)){
      cout << i << endl;
      return 0;
      }
  }
}

Measured memory_bytes: 3616
from itertools import combinations, chain

def main():
    n,m,x = map(int, input().split())
    books = [list(map(int, input().split())) for _ in range(n)]
    comb = [*chain(*(combinations(books, n+1) for n in range(len(books))))]
    m_list = []
    for c in comb:
        valid = True
        for i in range(1,m+1):
          if not valid:
            break
          s = sum([k[i] for k in c])
          if s < x:
            valid = False
            break
        if valid:
            m_list.append(sum([k[0] for k in c]))
    if len(m_list) == 0:
        print(-1)
    else:
        print(min(m_list))

if __name__ == '__main__':
    main()

Measured memory_bytes: 69140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int mod = 1000000007;
map <ll, int> dp;
int DP(ll n) {
    if (n < 0) return 0;
    if (n == 0) return 1;
    if (dp.count(n)) return dp[n];
    int res = 0;
    if (n & 1) res = (DP(n / 2) * 2 % mod + DP(n / 2 - 1)) % mod;
    else res = (DP(n / 2) + DP(n / 2 - 1) * 2 % mod) % mod;
    return dp[n] = res;
}
int main() {
    ios :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    cout << DP(n) << endl;
    return 0;
}

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

int main(){
    long int x1,x2,sum;
    cin >> x1 >> x2;

    if(x1<x2){
        sum=x2-x1;
    }else if(x1>x2){
        sum=x1-x2;
    }else{
        sum=0;
    }

    cout << sum << '\n';
   

    return 0;


}


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

int main() {
    int n,x,sum=0,ans=0;
    cin>>n>>x;
    vector<int> m(n);
    rep(i,n) {
        cin>>m[i];
        sum+=m[i];
        ans++;
    }
    sort(m.begin(),m.end());
    while(sum<=x) {
        sum+=m[0];
        ans++;
    }
    if (sum>x) ans--;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[200005],n,b[200005];
int P(int x){for(int i=1;i<=n*2-1;i++)b[i]=(a[i]>=x);b[0]=b[1];
	for(int i=n;i<=n+n;i++){if(b[i]==b[i+1])return b[i];if(b[n+n-i]==b[n+n-i-1])return b[n+n-i];}
}
int main(){
cin>>n;
for(int i=1;i<=n*2-1;i++)cin>>a[i];
int l=1,r=n*2,A=0,M;
while(l<=r){M=(l+r)/2;if(P(M))l=M+1,A=M;else r=M-1;}cout<<A;}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;
 


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

    vector<bool>r(105);
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        r[t]=1;
    }
   // r[x] = 1;
    int ans = x;
    int d = 9999999;
    for (int i = 0; i <= 101; i++) {
        if (r[i])continue;
        if (d <= abs(x - i))continue;
        d = abs(x - i);
        ans = i;

    }
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3624
#include<stdio.h>
#define  N 100

int SelectionSort(int *B, int n) {
  int i, j, tmp, count = 0, mini;
  
  for(i = 0; i < n; i++) {
    mini = i;
    for(j = i; j < n; j++){
      if(B[j] < B[mini]) mini = j;
      }
    if(B[i] != B[mini]) {
      tmp = B[i];
      B[i] = B[mini];
      B[mini] = tmp;
      count++;
    }
  }
  return count;
}

int main() {
  int i, A[N], n, cnt;
  
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  
  cnt = SelectionSort(A, n);
  
  for(i = 0; i < n; i++) {
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n%d\n", cnt);
  
  return 0;
}

Measured memory_bytes: 604