akhauriyash/Code-Regression huggingface dataset:
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,m = LI()
    a = LI()
    b = LI()
    g = collections.defaultdict(int)
    h = collections.defaultdict(int)
    for d in a:
        for e in b:
            if d == e:
                g[d] += 1
                if g[d] > 1:
                    return 0
                continue
            if d < e:
                h[d] += 1
            else:
                h[e] += 1

    r = 1
    for d in a:
        if d in b:
            continue
        c = 0
        for e in b:
            if e > d:
                c += 1
        if c == 0:
            return 0
        r *= c
        h[d] -= 1
        g[d] = 1

    for e in b:
        if e in a:
            continue
        c = 0
        for d in a:
            if d > e:
                c += 1
        if c == 0:
            return 0
        r *= c
        h[e] -= 1
        g[e] = 1

    c = 0
    for i in range(n*m,0,-1):
        c += h[i]
        if g[i] == 1:
            continue
        if c == 0:
            return 0
        r *= c
        r %= mod
        c -= 1

    return r


print(main())





Measured memory_bytes: 151096
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  while(str[0]!='0'){
  int i,o=0;
  for(i=0;i<str.size();i++){
    o+=str[i]-'0'; 
  }
  cout << o << endl;
    cin >> str;
}
  return 0;
}



Measured memory_bytes: 3160
import itertools

n,m=list(map(int,input().split()))
c=[[] for i in range(n)]

for i in range(m):
    a,b=list(map(int,input().split()))
    c[a-1].append(b-1)
    c[b-1].append(a-1)

cnt=0

for p in itertools.permutations(range(n),n):
    if p[0]>0:
        continue

    for i in range(n-1):
        a=p[i]
        b=p[i+1]

        if not (b in c[a]):
            break
    else:
        cnt+=1

print(cnt)

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

int n,maxn;
long long a[200005];
long long xy[1000005];
long long x2[1000005];
long long ans;
long long mod=998244353;

long long c[1000005];
long long inv[1000005];

long long fast(long long x,int v){
    long long an=1;
    while(v)
    {
        if(v&1)an=(an*x)%mod;
        x=(x*x)%mod;
        v>>=1;
    }
    return an;
}

void pre()
{
    c[0]=1;
    for(int i=1;i<=1000000;i++)
        c[i]=(c[i-1]*i)%mod;
    inv[1000000]=fast(c[1000000],mod-2);
    for(int i=1000000;i>=1;i--){
        inv[i-1]=inv[i]*i%mod;
    }
}

int cnt;
int head[1000005];
int nxt[14000005];
int v[14000005];

int main()
{
    pre();
    scanf("%d",&n);

    for(register int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        maxn=max(maxn,(int)a[i]);
    }

    for(register int i=1;i<=maxn;i++){
        for(register int j=1;j*i<=maxn;j++){
            cnt++;
            v[cnt]=i;
            nxt[cnt]=head[i*j];
            head[i*j]=cnt;
        }
    }

    for(register int i=1;i<=n;i++){
        for(register int j=head[a[i]];j;j=nxt[j]){
            int x=v[j];
            xy[x]=(xy[x]+a[i]);
            while(xy[x]>=mod)xy[x]-=mod;
            x2[x]=(x2[x]+a[i]*a[i])%mod;
        }
    }

    for(register int i=maxn;i>=1;i--){
        xy[i]=(xy[i]*xy[i]-x2[i])%mod*inv[2]%mod;
        for(register int j=2;j*i<=maxn;j++){
            xy[i]=(xy[i]-xy[i*j])%mod;
        }
        ans=(ans+xy[i]*inv[i]%mod*c[i-1]%mod)%mod;
    }

    ans=(ans%mod+mod)%mod;

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

    return 0;
}


Measured memory_bytes: 146304
#include<iostream>
#include<cstdio>
#include<cstring>
#define _A_ true
using namespace std;
 
int main(){
  int n,AC=0,strA,strB;
  int dp[1010][1010];
  char *A = new char[1500];
  char *B = new char[1500];
 
  scanf("%d",&n);
  while(_A_){
    if(AC == n)break;
    scanf("%s",A);
    scanf("%s",B);
    for(int i=0;i<1010;i++)for(int j=0;j<1010;j++)dp[i][j]=0;
strA = strlen(A); 
strB = strlen(B);

    for(int i=0;i<strA;i++){
      for(int j=0;j<strB;j++){
    if(A[i] == B[j]){
      dp[i+1][j+1]=dp[i][j]+1;
    }
    else{
      if(dp[i+1][j] > dp[i][j+1]){
        dp[i+1][j+1]=dp[i+1][j];
      }
      else {
        dp[i+1][j+1] = dp[i][j+1];
      }
    }
      }
    }
    printf("%d\n",dp[strA][strB]);
    AC++;
  }
  delete [] A;
  delete [] B;
 
  return 0;
}

Measured memory_bytes: 5180
A,B,K = map(int,input().split())

ans_list = []

if A >= K:
    ans_list.append(str(A - K))
    ans_list.append(str(B))
else:
    ans_list.append(str(0))
    if (K - A) >= B:
        ans_list.append(str(0))
    else:
        ans_list.append(str(A + B - K))
print(" ".join(ans_list))

Measured memory_bytes: 3060
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;

int n;
ll m;
int v, p;

ll tab[nax];
ll sum[nax];

int wyn;

int main()
{
	scanf("%d%lld%d%d", &n, &m, &v, &p);
	for (int i=1; i<=n; i++)
		scanf("%lld", &tab[i]);
	sort(tab+1, tab+1+n);
	for (int i=1; i<=n; i++)
		sum[i]=sum[i-1]+tab[i];
	for (int i=1; i<=n; i++)
	{
		if (n-i+1<=p)
		{
			wyn++;
			continue;
		}
		int a=i+1;
		int b=n-p+1;
		int jesz=v-(i+(p-1));
		jesz=max(jesz, 0);
		ll bede=tab[i]+m;
		if (tab[n-p+1]>bede)
			continue;
		ll miej=(b-a+1)*bede-(sum[b]-sum[a-1]);
		if (miej>=m*jesz)
			wyn++;
	}
	
	printf("%d\n", wyn);
	return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair  <int,int> ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef set   <int>     si;
typedef set   <ii>      sii;
typedef vi::iterator itt;
typedef si::iterator jtt;

#define fori(i,x) for(itt i=x.begin();i!=x.end();i++)
#define forj(j,x) for(jtt j=x.begin();j!=x.end();j++)
#define all(x)   x.begin(), x.end()
#define clr(x,v) memset(x,v,sizeof(x))

#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#define pb push_back
#define endl "\n"
#define MOD int(1e9+7)
#define N 200123
int n, m, v, sum;
int main(){_
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> v;
        sum+=v;
    }
    if(sum>n){
        cout << -1 << endl;
        return 0;
    }
    else{
        cout << n-sum<< endl;
    }
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <tuple>
#include <iomanip>


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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


int main(void){
	string s;
	cin >> s;

	int ans = 0;
	if (s[0] == '0'){
		for (int i = 1; i < s.size(); i++){
			if (i % 2 == 0 && s[i] == '1'){
				ans++;
			}
			else if (i % 2 != 0 && s[i] == '0'){
				ans++;
			}
		}
	} else {
		for (int i = 1; i < s.size(); i++){
			if (i % 2 == 0 && s[i] == '0'){
				ans++;
			}
			else if (i & 2 != 0 && s[i] == '1'){
				ans++;
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 512
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

sa = a % 10
if sa == 0:
    sa = 10
sb = b % 10
if sb == 0:
    sb = 10
sc = c % 10
if sc == 0:
    sc = 10
sd = d % 10
if sd == 0:
    sd = 10
se = e % 10
if se == 0:
    se = 10


amari = min(sa,sb,sc,sd,se)


a = math.ceil(a / 10) *10
b = math.ceil(b / 10) *10
c = math.ceil(c / 10) *10
d = math.ceil(d / 10) *10
e = math.ceil(e / 10) *10


if amari == 0:
    print(int(a+b+c+d+e))
else:
    print(int(a+b+c+d+e-10+amari))

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#ifndef FOR
	#define FOR(i, a, b)  for(int i(a), i##_END_(b); i < i##_END_; i++)
	#define ROF(i, a, b)  for(int i(a), i##_BEG_(b); i > i##_BEG_; i--)
	#define FOR_(i, a, b) for(int i(a); i < (b); i++)
	#define ROF_(i, a, b) for(int i(a); i > (b); i--)
#endif
#define return_with(...) return (void) (__VA_ARGS__)
#define continue_with(...) {__VA_ARGS__; continue;}
#define break_with(...) {__VA_ARGS__; break;}
template<typename T, typename _> inline bool Max(T &x, _ y) {return x < y ? x = y, true : false;}
template<typename T, typename _> inline bool Min(T &x, _ y) {return x > y ? x = y, true : false;}
template<typename T> inline void Rd(T &x) {
	static char c; x = 0;
	while(c = getchar(), c < 48);
	do x = (x<<1) + (x<<3) + (c^48);
	while(c = getchar(), c > 47);
}
#define N 200005
#define P 1000000007
int A[N];
int cnt[N];
int main() {
	int n, x = 0;
	Rd(n);
	for(int i = 0; i < n; i++) {
		Rd(A[i]);
		if(A[i] == x) i--, n--;
		x = A[i];
	}
	int ans = 1;
	for(int i = 0; i < n; i++) {
		ans = cnt[A[i]] = (cnt[A[i]] + ans) % P;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1664
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int surplus = (a * b) %2;

		if(surplus == 0) {
			System.out.println("Even");
		}else {
			System.out.println("Odd");
		}
	}
}

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

int main() {
	int n,i;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++)
	  cin>>a[i];
	sort(a,a+n,greater <int >());
	long double ans=a[0];
	ans/=2;
	for(i=1;i<n;i++)
	  {
	  	 ans+=a[i];
	  }
	cout<<ans<<'\n';  
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   // ifstream cin("input.in");
   // ofstream cout("output2.out");
    ios::sync_with_stdio(0);cin.tie(0);
    long N,A[100009];
    cin>>N;
    for(long i=0;i<N;i++)
        cin>>A[i];
    sort(A,A+N);
    cout<<A[N-1]-A[0];
}

Measured memory_bytes: 256
class Dice:
    def __init__(self, num):
        self.num = num
    def roll(self, fn):
        if fn == "S":
            ue = self.num[4]
            self.num[4] = self.num[5]
            self.num[5] = self.num[1]
            self.num[1] = self.num[0]
            self.num[0] = ue
        elif fn == "W":
            ue = self.num[2]
            self.num[2] = self.num[5]
            self.num[5] = self.num[3]
            self.num[3] = self.num[0]
            self.num[0] = ue        
        elif fn == "N":
            ue = self.num[1]
            self.num[1] = self.num[5]
            self.num[5] = self.num[4]
            self.num[4] = self.num[0]
            self.num[0] = ue                
 
    def spin(self, fn):
        if fn == "migi":
            mae = self.num[3]
            self.num[3] = self.num[4]
            self.num[4] = self.num[2]
            self.num[2] = self.num[1]
            self.num[1] = mae

n = int(input())
dice = []
for i in range(n):
    num = list(map(int, input().split(" ")))
    dice.append(Dice(num))
for i in range(1, n):
    count = 0
    while dice[0].num[0] != dice[i].num[0] and count<5:
        dice[i].roll("S")
        count+=1
    count = 0
    while dice[0].num[0] != dice[i].num[0] and count<5:
        dice[i].roll("W")
        count+=1       
    count = 0
    while dice[0].num[1] != dice[i].num[1] and count<5:
        dice[i].spin("migi")
        count+= 1
count = 0
for i in range(0, len(dice)-1):
    for j in range(1, len(dice)):
        if dice[i].num == dice[j].num:
            count += 1
if count > n-2:
    print("No")
else:
    print("Yes")



Measured memory_bytes: 5620
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long llong;
#define MAXI 100002

int main(void){
    int n,m;
    cin>>n>>m;
    pair<int,int> ss[MAXI];
    for(int i=1;i<=m;i++){
        cin>>ss[i].second>>ss[i].first;
    }
    int t=0;int ans=0;
    sort(ss,ss+m+1);
    for(int i=1;i<=m;i++){
        if(t<=ss[i].second){
            t=ss[i].first;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000001

using namespace std;
#define ll long long
#define dbg if(0)



int main(){
    while(true){
        int n;
        ll ans= LLONG_MIN;
        cin>>n;
        if (n==0)break;

        ll rui[n+1];
        rui[0]=0;
        for(int i=1;i<=n;i++){
            cin >>rui[i];
            rui[i]+=rui[i-1];
            dbg cout <<rui[i]<<" ";
        }
        dbg cout <<endl;
        //次を見る
        //今までの最小値を更新したか？
        //したなら暫定解を確定しansと比較。最大値=最小値=発見した最小値にする
        //してなければ最大値の更新をする
        //見る場所が一番後ろまで行ったら終了。
//        rui[0]=min(rui[0],rui[1]);
//        ll nmin=rui[0],nmax=rui[0];
//        bool nmflag=false;
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                ans=max(rui[j]-rui[i-1],ans);
            }
        }
 /*       for(int i=0;i<=n;i++){
            if (rui[i]<nmin){
                ans=max(nmax-nmin,ans);
                nm=max(rui[i]-nmin,nm);
                nmax=rui[i];
                nmin=rui[i];
            }else{
                if(rui[i]>nmax){
                    nmax=rui[i];
                    nmflag=true;
                }
            }
            dbg cout <<nmax<<" "<<nmin<<" "<<nm<<endl;
        }
        ans=max(nmax-nmin,ans);
        dbg cout << endl;
        if(nmflag)cout<<ans<<endl;
        else cout<<nm<<endl;*/
        cout <<ans<<endl;
    }

    return 0;
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define EPS 0.00000000001
#define INF 1000000000
int main()
{
    char c;
    scanf("%c",&c);
    if('a'<=c&&c<='z')
    {
        printf("a");
    }
    else
    {
        printf("A");
    }
    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define int long long int
const int mod = 1000000007;
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

map<int,int>primes;

void factor(int n){
    map<int,int>m;
    for(int i=2; i*i<=n; i++){
        while(n%i == 0){
            m[i]++;
            n = n/i;
        }
    }
    if(n != 1){
        m[n] = 1;
    }
    for(auto x : m){
        primes[x.first]++;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin>>n;
    vector<int>arr(n);
    for(int i=0; i<n; i++){
        cin>>arr[i];
        factor(arr[i]);
    }
    string ans = "pairwise coprime";
    for(auto x : primes){
        if(x.second == n){
            ans = "not coprime";
            break;
        }
        if(x.second != 1){
            ans = "setwise coprime";
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 15764
class queue():
    def __init__(self):
        self.head = 0
        self.tail = 0
        self.MAX = 100000
        self.Q = [[0] for i in range(self.MAX)]

    def is_empty(self):
        return self.head == self.tail

    def is_full(self):
        return self.head == (self.tail + 1) % self.MAX

    def enqueue(self, x):
        if self.is_full():
            raise ValueError("エラー（オーバーフロー）")
        self.Q[self.tail] = x
        if self.tail + 1 == self.MAX:
            self.tail = 0
        else:
            self.tail += 1

    def dequeue(self):
        if self.is_empty():
            raise ValueError("エラー（アンダーフロー）")
        x = self.Q[self.head]
        if self.head + 1 == self.MAX:
            self.head = 0
        else:
            self.head += 1
        return x

n, q = input().split(" ")
n = int(n)
q = int(q)
q_name = queue()
q_val = queue()
for i in range(n):
    name, t = input().split(" ")
    t = int(t)
    q_name.enqueue(name)
    q_val.enqueue(t)

results = []
end_time = 0
while True:
    process_val = q_val.dequeue()
    process_name = q_name.dequeue()
    if process_val <= q:
        end_time += process_val
        results.append([process_name, end_time])
    else:
        end_time += q
        rest_val = process_val - q
        q_name.enqueue(process_name)
        q_val.enqueue(rest_val)
    
    if q_val.head == q_val.tail:
        break

for v in results:
    print("{} {}".format(v[0],v[1]))


Measured memory_bytes: 22036
#include<stdio.h>

int main(){

  int i,j,k=0,key,tmp,num;
  int A[1000];

  //Insertion Sort program

  scanf("%d",&num);

  for(i=0;i<num;i++) scanf("%d",&A[i]);

//for(i=0;i<num;i++) printf("%d ",A[i]);

/*  for(i=0;i<num;i++){
    for(j=0;j<num;j++){
      if(A[i]<A[j]){
        tmp = A[i];
        A[i] = A[j];
        A[j] = tmp;
      for(k=0;k<num;k++) printf("%d ",A[k]);
      printf("\n");
      }}}
*/

  for(i=0;i<num;i++){
        key = A[i];
  /* insert A[i] into the sorted sequence A[0,...,j-1] */
        j = i - 1;
        while(j >= 0 && A[j] > key){
        A[j+1] = A[j];
        j--;
        A[j+1] = key;
        }
        for(k=0;k<num;k++)
          if(k==num-1) printf("%d",A[num-1]);
        else printf("%d ",A[k]);
        printf("\n");
  }
//for(i=0;i<num;i++) printf("%d ",A[i]);
//printf("\n");

return 0;

}

Measured memory_bytes: 608
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
using namespace std;


int n,t,a,r=0;
float h[1010];
float rv;

int main(){
    scanf("%d %d %d",&n,&t,&a);
    for (int i=0;i<n;i++){
        scanf("%f",&h[i]);
        if(i==0)rv=abs(t-h[0]*0.006-a);
        else{
            if(abs(t-h[i]*0.006-a)<rv){
                rv=abs(t-h[i]*0.006-a);
                r=i;
            }
        }
    }
    cout<<r+1<<endl;

}

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

int main() {
	char b;
	cin >> b;

	if (b == 'A') cout << 'T' << endl;
	else if (b == 'C')cout << 'G' << endl;
	else if (b == 'T')cout << 'A' << endl;
	else cout << 'C' << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<algorithm>
#define NAX 100000
using namespace std;
int n,c[NAX],T[NAX+1];
int greedy(int);
void douteki(int);

int main(){
  int i,g,j,k,flag=0;

  k=1;
  while(1){
    flag=0;
    cin >> n;
    if(n == 0 )break;


    for(i=0;i<n;i++){
      cin >> c[i];
      if(i == 0 && c[i] != 1)flag=1;
    }
    if(n == 1 && c[i-1] == 1){
      cout << "Case #" << k << ": OK" << endl;
      k++;
      continue;
    }

    if(flag == 1){
      cout << "Case #" << k << ": Cannot pay some amount" << endl;
      k++;
      continue;
    }
    else{
      //     for(j=1;j<=100;j++){    
      //    douteki(n);                                                             
      ///   cout << "greedy(" << j << ") =" << greedy(j) << endl;                       
      //   cout << "douteki("<< j << ")="<< T[j] << endl;
      // 	}
   
      
      douteki(n); 
      for(j=1;j<=100000;j++){
	if(greedy(j) > T[j]){
	  flag=3;
	  break;
	}
      } 


    }                                                                      
    /* 
     for(i=1;i<n;i++){
        if(c[i]%c[i-1] != 0)flag = 2;
      }
*/
      if(flag == 0){
        cout << "Case #" << k << ": OK" << endl;
   k++;
      }else{
        cout << "Case #" << k << ": Cannot use greedy algorithm" << endl;
        k++;
        }


    }


}




int greedy(int a){
  int ans=0;
  for(int i = n-1;i>=0;i-- ){
    if(a >= c[i]){
      ans += a/c[i];
   a = a%c[i];
    }
  }
  return ans;

}


void douteki(int re){
  for(int j = 0; j <= NAX ; j++)T[j]=10000;
  T[0] = 0;
 for(int i = 0; i < re ; i++){
    for(int j=c[i];j<=NAX;j++){
      T[j]= min(T[j],T[j-c[i]]+1);
    }
 }

}

Measured memory_bytes: 1260
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        System.out.println((int)(k * Math.pow(k-1, n-1)));
    }
}


Measured memory_bytes: 23252
import sys
from typing import List


def get_distance(board: List[int]) -> int:
    sd = 0
    for i in range(16):
        p = board[i]
        if p == 0:
            continue
        sd += distance[p][i]
    return sd


def df_lower_search(limit: int, move: int, space: int, lower: int, pre_p: int) -> bool:
    global board
    global GOAL
    if move == limit:
        if board == GOAL:
            return True
    else:
        for i in adjacent[space]:
            p = board[i]
            if p == pre_p:
                continue
            board[space] = p
            board[i] = 0
            new_lower = lower - distance[p][i] + distance[p][space]
            if new_lower + move <= limit:
                if df_lower_search(limit, move + 1, i, new_lower, p):
                    return True
            board[space] = 0
            board[i] = p
    # Never reaches here.
    return False


if __name__ == "__main__":
    distance = (
        (),
        (0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
        (1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
        (2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
        (3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
        (1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
        (2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4),
        (3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3),
        (4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2),
        (2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4),
        (3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3),
        (4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2),
        (5, 4, 3, 2, 4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1),
        (3, 4, 5, 6, 2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3),
        (4, 3, 4, 5, 3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2),
        (5, 4, 3, 4, 4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1)
    )

    adjacent = (
        (1, 4),          # 0
        (0, 2, 5),       # 1
        (1, 3, 6),       # 2
        (2, 7),          # 3
        (0, 5, 8),       # 4
        (1, 4, 6, 9),    # 5
        (2, 5, 7, 10),   # 6
        (3, 6, 11),      # 7
        (4, 9, 12),      # 8
        (5, 8, 10, 13),  # 9
        (6, 9, 11, 14),  # 10
        (7, 10, 15),     # 11
        (8, 13),         # 12
        (9, 12, 14),     # 13
        (10, 13, 15),    # 14
        (11, 14)         # 15
    )

    GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]

    board = list(map(int, sys.stdin.read().split()))

    s = board.index(0)
    e_o = (0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0)
    n = get_distance(board)

    if e_o[s] != n % 2:
        n += 1

    for l in range(n, 46, 2):
        if df_lower_search(l, 0, s, n, -1):
            print(l)
            break



Measured memory_bytes: 7192
x, y, a, b, c = map(int, input().split())

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

A = sorted(A)
B = sorted(B)
C = sorted(C)

t = 0
s = 0

A = A[-x:]
B = B[-y:]

C.extend(A)
C.extend(B)
C = sorted(C)

print(sum(C[-x-y:]))

Measured memory_bytes: 113388
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

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

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) {
		cout << a - 1 << endl;
	}
	else {
		cout << a << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int kabe[5][5][5][5];

enum direct {
  RIGHT = 0,
  DOWN  = 1,
  LEFT  = 2,
  UP    = 3
};

const char *dstr = "RDLU";

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

#define D(d) (((d)+4)%4)

bool go(int x1, int y1, int x2, int y2){
  if(x2 < 0 || y2 < 0 || x2 >= 5 || y2 >= 5) return false;
  return kabe[x1][y1][x2][y2] == 1;
}

int main(){
  string str;
  REP(i,9){
    cin>>str;
    if(i%2 == 0){
      REP(j,4){
	int x = j;
	int y = i/2;
	if(str[j] == '1'){
	  kabe[x][y][x+1][y] = kabe[x+1][y][x][y] = 1;
	}
      }
    }else{
      REP(j,5){
	int x = j;
	int y = i/2;
	if(str[j] == '1'){
	  kabe[x][y][x][y+1] = kabe[x][y+1][x][y] = 1;
	}
      }
    }
  }
  int x = 0, y = 0;
  int d = RIGHT;
  while(x != 0 || y != 0 || d == RIGHT){
    d = D(d-1);
    while(!go(x,y,x+dx[d],y+dy[d])) d = D(d+1);
    putchar(dstr[d]);
    x += dx[d]; y += dy[d];
  }
  puts("");
  return 0;
}

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


void solve(long long N, std::vector<long long> H){
    ll cnt = 1;
    for(ll i=1; i< N; i++){
        bool isGood = true;
        for(ll j=0; j< i; j++){
            if(H[j]>H[i]) isGood = false;
        }
        if(isGood) cnt++;
    }
    cout << cnt << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, std::move(H));
    return 0;
}


Measured memory_bytes: 256
count = gets.to_i

for i in 1..count

	a = gets
	a = a.split(" ")
	a[0] = a[0].to_i
	a[1] = a[1].to_i
	a[2] = a[2].to_i
	
	a = a.sort
	
	if a[2]*a[2] ==a[0]*a[0]+a[1]*a[1]
		puts "YES"
	else
		puts "NO"
	end	
end

Measured memory_bytes: 6108
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	if((a==b && a!=c) || (a==c && b!=c) || (b==c && b!=a))
		printf("Yes");
	else 
		printf("No");
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll n;
struct M{
 vector<vector<ll>> a;
 M(){
  a.resize(n,vector<ll>(n));
 }
 void operator *= (const M& b){
  M ans=M();
  for(int i=0;i<n;i++){
   for(int j=0;j<n;j++){
    for(int k=0;k<n;k++){
     ans.a[i][j]=(ans.a[i][j]+a[i][k]*b.a[k][j]%mod)%mod;
    }
   }
  }
  a=ans.a;
 }
};
int main(){
 ll k;
 cin>>n>>k;
 M adj=M();
 for(int i=0;i<n;i++){
  for(int j=0;j<n;j++){
    cin>>adj.a[i][j];
  }
 }
 M res=M();
 for(int i=0;i<n;i++){
  res.a[i][i]=1;
 }
 while(k){
  if(k&1) res*=adj;
  adj*=adj;
  k>>=1;
 }
 ll ans=0;
 for(int i=0;i<n;i++){
  for(int j=0;j<n;j++){
   ans=(ans+res.a[i][j])%mod;
  }
 }
 cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char s[200005],t[200005];
int main()
{
    cin>>s>>t;
    int fs[26],ft[26];
    memset(fs,-1,sizeof(fs));
    memset(ft,-1,sizeof(ft));
    int l=strlen(s);
    int flag=0;
    for(int i=0;i<l;i++)
    {
        if(fs[s[i]-'a']==-1)
        {
            fs[s[i]-'a']=t[i];
        }
        else
        {
            if(fs[s[i]-'a']!=t[i]) {flag=1;break;}
        }
        if(ft[t[i]-'a']==-1)
        {
            ft[t[i]-'a']=s[i];
        }
        else
        {
            if(ft[t[i]-'a']!=s[i]) {flag=1;break;}
        }

    }
    if(flag) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


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

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

    int n;
    string s;
    cin >> n >> s;

    vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));

    int ans = 0;
    for (int i = s.size() - 1; i >= 0; --i)
    {
        for (int j = s.size() - 1; j > i; --j)
        {
            if (s[i] == s[j])
            {
                dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1);
                ans = max(ans,
                          min(dp[i][j], j - i));
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 101152
from collections import deque
n,m=map(int,input().split())
r=[[] for i in range(n+1)]
R=[[] for i in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    r[a].append(b)
    r[b].append(a)
    R[a].append(b)
    R[b].append(a)
dep=[-1]*(n+1)
dep[0]=0
dep[1]=0
data=deque([1])
d=0
while len(data)>0:
    p=data.popleft()
    for i in r[p]:
        if dep[i]==-1:
            dep[i]=dep[p]+1
            data.append(i)
    r[p]=[]
if not all(dep[i+1]>=0 for i in range(n)):
    print("No")
else:
    print("Yes")
    for i in range(2,n+1):
        for j in R[i]:
            if dep[j]==dep[i]-1:
                print(j)
                break


Measured memory_bytes: 123532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll N, T;
vector<ll> t(200001, 0);

int main(void){
	
	scanf("%lld %lld", &N, &T);
	for(int i = 0; i < N; ++i) scanf("%lld", &t[i]);
	
	ll stop = 0;
	for(int i = 1; i < N; ++i){
	    if(t[i - 1] + T < t[i]) stop += t[i] - (t[i - 1] + T);
	}
	printf("%lld\n", t[N - 1] + T - stop);
	
	
    return 0;
}


Measured memory_bytes: 1792
import java.awt.geom.Point2D;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {	
	Scanner in = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){		
		new AOJ1104();
	}
	
	class AOJ1104{
		int x,y,mx,my,muki=3;
		public AOJ1104() {
			while(true){
				x = 1;y = 1;muki=3;
				mx = in.nextInt();
				my = in.nextInt();
				if(mx+my==0)break;
				while(true){
//					System.out.println(x+" "+y);
					if(doit(in.next()))break;
				}
				System.out.println(x+" "+y);
			}
		}
		
		boolean doit(String meirei){
			int num=0;
			if(meirei.equals("FORWARD")||meirei.equals("BACKWARD")){
				num=in.nextInt();
				if(meirei.equals("FORWARD")){
					int nx[] = {1,0,-1,0};
					int ny[] = {0,-1,0,1};
					for(int i=0;i<num;i++){
						if(x+nx[muki]<=0||x+nx[muki]>mx||y+ny[muki]<=0||y+ny[muki]>my)break;
						x+=nx[muki];
						y+=ny[muki];
					}
				}else{
					int nx[] = {-1,0,1,0};
					int ny[] = {0,1,0,-1};
					for(int i=0;i<num;i++){
						if(x+nx[muki]<=0||x+nx[muki]>mx||y+ny[muki]<=0||y+ny[muki]>my)break;
						x+=nx[muki];
						y+=ny[muki];
					}
				}
			}else if(meirei.equals("STOP")){
				return true;
			}else if(meirei.equals("RIGHT")){
				//右=0,下=1,左=2,上=3(向き)
				muki = (muki+1)%4;
			}else if(meirei.equals("LEFT")){
				muki = (muki+3)%4;
			}
			return false;
		}
	}

			
			
	class AOJ2503{
		int MAX = 0;
		public AOJ2503() {
			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			int m = in.nextInt();

			int[][] cost = new int[n][n];

			int[] dp = new int[n];
			for(int i=0;i<n*n;i++){
				cost[i/n][i%n]=MAX;
			}
			for(int i=0;i<m;i++){
				int a = in.nextInt();
				int b = in.nextInt();
				cost[a][b]=in.nextInt();
			}	
			//			TODO 一番大きいパスを0のポイントからn-1のポイントまでの

			for(int s=1;s<n;s++){
				for(int i=0;i<=s;i++){
					if(cost[i][s]==MAX)continue;
					dp[s]=Math.max(dp[s],dp[i]+cost[i][s]);
				}
			}
			for(int s=0;s<n;s++)for(int i=0;i<n;i++){
				if(cost[s][i]==MAX)continue;
				dp[i]=Math.max(dp[s]+cost[s][i],dp[i]);
			}
			for(int i=0;i<n;i++)System.out.print(dp[i]+" ");
			System.out.println();
			System.out.println(dp[n-1]);
		}
	}
}

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

const int INF = 1e15;

int N, A[305], sum[305][305], dp[305][305];

void update(int a, int b){
  
  for(int i=a;i<=b;i++) sum[a][b] += A[i];
    
}

int cal(int a, int b, int c, int d){
  
  int X = sum[a][b], Y = sum[c][d];
  
  int xprev = 0, yprev = 0, cprev = 0;
  
  int res = 0, cnt = 15;
  
  while(cnt--){
    
    if( xprev + yprev + cprev < 10 ) cprev = 0;
    else cprev = 1;
    
    int xi = X % 10, yi = Y % 10, ci = cprev;
    
    X /= 10, Y /= 10;
    
    res += xi * yi + ci;
    
    xprev = xi, yprev = yi;
    
  }
  
  return res;
}

signed main(){
  
  cin>>N;
  
  for(int i=0;i<N;i++) cin>>A[i];
  
  for(int i=0;i<N;i++){
    
    for(int j=i;j<N;j++){
      
      update( i, j );
      
      if( i != j ) dp[i][j] = INF;
      else dp[i][j] = 0;
      
    }
    
  }
  
  for(int l=1;l<N;l++){
    
    for(int i=0;i<N;i++){
      
      if( i + l >= N ) continue;
      
      for(int j=i;j<i+l;j++){
	
	int add = cal( i, j, j + 1, i + l );
	
	dp[i][i+l] = min( dp[i][i+l], dp[i][j] + dp[j+1][i+l] + add );
	
      }
      
    }
    
  }
  
  cout<<dp[0][N-1]<<endl;
  
  return 0;
}



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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

int main(){

    bool flag=false;
    ll ans=0,sum=0;

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

    vector<vector<int>> g(n);
    vector<int> cand;

    for (int i = 0; i < m; i++){
        int a,b;
        cin >>a>>b;
        --a;--b;

        g[a].pb(b);
        g[b].pb(a);

        if(a==n-1)cand.pb(b);
        if(b==n-1)cand.pb(a);
    }

    for(int c:cand){
        sort(all(g[c]));
        if(binary_search(all(g[c]),0)){
            puts("POSSIBLE");
            return 0;
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << "IMPOSSIBLE" << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> num(n);
	vector<bool> judge(n);
	for(int i = 0; i < n; i++){
		num[i] = 1;
		judge[i] = false;
	}
	judge[0] = true;
	for(int i = 0; i < m; i++){
		int x, y;
		cin >> x >> y;
		x--; y--;
		num[x]--;
		num[y]++;
		if(judge[x]) judge[y] = true;
		if(num[x] == 0) judge[x] = false;
	}
	
	int c = 0;
	for(int i = 0; i < n; i++){
		if(judge[i]){
			c++;
		}
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 640
def main():
    N, M = map(int, input().split(" "))
    X = list(map(int, input().split(" ")))
    X.sort()
    dist = []
    for i in range(M - 1):
        dist.append(X[i + 1] - X[i])
    dist.sort(reverse=True)
    print(X[-1] - X[0] - sum(dist[:N - 1]))


if __name__ == '__main__':
    main()

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if(a <= 5){
    cout << 0 << endl;
  }else if(a >= 13){
    cout << b << endl;
  }else{
    cout << b / 2 << endl;
  }
}


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

int main() {
  int X,Y,Z;
  cin >> X >> Y >> Z;
  int a,b,c;
  a = X;
  b = Y;
  c = Z;
  X = c;
  Y = a;
  Z = b;
  cout << X << " " << Y << " " << Z << " " << endl;
}


Measured memory_bytes: 3580
#D - Div Game
N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
A = factorization(N)
#print(factorization(N))
ans = 0
if N == 1:
    print(0)
    exit()

for i in range(len(A)):
    if A[i][1] == 1:
        ans += 1
    else:
        k = A[i][1]
        for j in range(A[i][1]):
            if k-j > j:
                k -= j
                ans += 1
            else:
                break
print(ans)

Measured memory_bytes: 9504
#include <stdio.h>
#define N 100
#define INF 1000000000

int G[N][N];

int Stamp[N];

int min[N];

int parent[N];

int prim(int n){
  int i,mincost,sum = 0,u,j;
  for(i = 0; i < N; i++){
    Stamp[i] = -1;
    min[i] = INF;
    parent[i] = -1;
  }

  min[0] = 0;

  while(1){
    mincost = INF;
    for(i = 0; i < n; i++){
      if(Stamp[i] != 1 && min[i] < mincost){
	mincost = min[i];
	u = i;
      }
    }

    if(mincost == INF) break;
    Stamp[u] = 1;

    for(i = 0; i < n; i++){
      if(Stamp[i] != 1 && G[u][i] != -1){
	if(G[u][i] < min[i]){
	  min[i] = G[u][i];
	  parent[i] = u;
	  Stamp[i]  = 0;
	}
      }
    }
  }
  
  for(i = 0; i < n; i++){
    if(parent[i] != -1) sum += G[parent[i]][i];
  }
  return sum;
}

int main()
{
  int i,j,n;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      scanf("%d",&G[i][j]);
    }
  }
  
  printf("%d\n",prim(n));

  return 0;
}
  
  



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

using namespace std;

typedef vector<char> vc;
typedef vector<vc> vvc;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<char, pii> mcpii;
typedef pair<pair<string, string>, int> ppssi;
typedef vector<ppssi> vppssi;

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define read freopen("..\\in.txt", "r", stdin)
#define write freopen("..\\out.txt", "w", stdout)

const int dir_x[]{0, 0, -1, 1}, dir_y[]{-1, 1, 0, 0};

const int INF = 1e9 + 5;

int main() {
    //read;
    int T = 1;
    //cin >> T;
    for (int tc = 1; tc <= T; ++tc) {
        ll n, k;
        cin >> n >> k;
        if (n >= k) {
            n %= k;
            n = min(n, abs(k - n));
        } else {
            n = min(n, k - n);
        }
        cout << n << "\n";
    }
    return 0;
}

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF (INT_MAX)/2-1
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  int N,K;
  cin>>N>>K;
  vector<ll>a(N);
  for(int i=0;i<N;i++)cin>>a[i];
  vector<ll>b;
  for(int i=0;i<N;i++){
    ll sum=0;
    for(int j=i;j<N;j++){
      sum+=a[j];
      b.push_back(sum);
    }
    sum-=a[i];
  }
  vector<ll>c=b;
  for(int i=40;i>=0;i--){
    vector<ll>m;
    for(auto it:c){
      if(((it>>i)&1))m.push_back(it);
    }
    if(m.size()>=K)c=m;
  }
  ll ans=c[0];
  for(int i=1;i<K;i++)ans&=c[i];
  cout<<ans<<endl;
  return 0;
}


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

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

    int n;
    cin >> n;

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

    int ans = 0;
    int odd = 1;
    ans = pow(3,n);
    for(int i = 0; i < n; i++){
        if(a[i] % 2 == 0) odd *= 2;
        else odd *= 1;
    }

    ans -= odd;
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a int
	var b int
	fmt.Scanf("%d %d", &a, &b)
	if b != 1 {
		i := 1
		c := i * a
		for {
			if c >= b {
				break
			}
			i++
			c = i*a - (i - 1)
		}
		fmt.Println(i)
	} else {
		fmt.Println(0)
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

int main() {
	cout << fixed << setprecision(15);
	double a, b, c, pi = 3.1415926535897932;
	cin >> a >> b >> c;
	double si = sin(c*pi/180.0),co=cos(c * pi / 180.0);
	double d=sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * co);
	cout << 0.5 * a * b * si << endl;
	cout << a + b + d << endl;
	cout << b * si << endl;
}



Measured memory_bytes: 3588
#include <iostream>

using namespace std;

long long nums[100000];
long long n;
long long memo[100000];
bool memoed[100000];
long long memo_r[100000];
bool memoed_r[100000];

long long dp(unsigned long long idx, bool reversed) {
  if( (reversed && memoed_r[idx]) || (!reversed && memoed[idx]) )
    return (reversed ? memo_r[idx] : memo[idx]);
  if (idx == 0)
    return reversed ? - 1 * 100000 : 0;
  long long num = nums[idx - 1];
  long long res;
  if (reversed) {
    res = max(dp(idx - 1, false) - num, dp(idx - 1, true) + num);
    memo_r[idx] = res;
    memoed_r[idx] = true;
  }
  else {
    res = max(dp(idx - 1, false) + num, dp(idx - 1, true) - num);
    memo[idx] = res;
    memoed[idx] = true;
  }
    return res;
}

int main(void) {
    cin >> n;
    // cout << n << endl;
    for (int i = 0; i < n; i++) {
        // cout << i << endl;
        cin >> nums[i];
    }
    cout << dp(n, false) << endl;
}

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

using namespace std;
typedef long long ll;

#define MAX 1000002
ll MOD  = 1e9 + 7;
ll Inv[MAX], fact[MAX], factInv[MAX];

void calc_modinv() {
    Inv[1] = 1;
    for(int i=2; i<=MAX; i++) {
        Inv[i] = (MOD - MOD / i) * Inv[MOD%i] % MOD;
    }
}

void calc_factinv() {
    fact[0] = factInv[0] = 1;
    for(int i=1; i<=MAX; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
        factInv[i] = (factInv[i-1] * Inv[i]) % MOD;
    }
}

ll nCr(int n, int r) { 
    if(n - r >= 0 && r >= 0) return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    else return 0;
}

int main(void) {
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    calc_modinv();
    calc_factinv();
    ll ans = 0;
    for(int i=b+1; i<=w; i++) {
        ans = (ans + nCr(i-1+h-a-1, i-1) * nCr(a-1+w-i, a-1)) % MOD;
    }

    return !printf("%lld\n", ans);
}

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

int main()
{
  string c;
  cin >> c;

  if (c == "a" || c == "i" || c == "u" || c == "e" || c == "o")
  {
    cout << "vowel" << endl;
  }
  else
  {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
    double a,b,x,v;
    cin>>a>>b>>x;
    v=a*a*b;
    cout<<setprecision(15);
    if(x*2==v){
        cout<<atan((double)a/b)*(180.0/M_PI)<<endl;
        return 0;
    }
    if(x*2>v){
        cout<<atan((((v-x)*2)/(a*a))/a)*(180.0/M_PI)<<endl;
        return 0;
    }
    if(x*2<v){
        cout<<atan( b/((x*2)/(a*b)))*(180.0/M_PI)<<endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
#define int long long
const int MAXN=20005;
int h,n;
int dp[MAXN];
int a[MAXN],b[MAXN];

signed main()

{
	cin>>h>>n;
	memset(dp,0x3f3f3f3f,sizeof(dp));

	int mx=0;
	for (int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		mx=max(mx,a[i]);
	}

	dp[0]=0;
	int ans=0x3f3f3f3f;
	for (int i=1;i<=n;i++){
		for (int j=0;j<=h+mx;j++){
			if (j+a[i]<=h+mx) dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i]);
			if (j>=h) ans=min(ans,dp[j]);
		}
	}

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

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

using namespace std;

int main() {
    int n,m = 0;
    cin >> n >> m;

    long long array[n] = {0};
    int checker[n] = {1};

    for(int i = 0; i < n ; i++){
        cin >> array[i];
    }

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

    int a,b = 0;

    for(int i = 0; i < m ; i++){
        cin >> a >> b;
        if(array[a - 1] < array[b - 1]){
            checker[a - 1] = 0;
        }else if(array[a - 1] > array[b - 1]){
            checker[b - 1] = 0;
        }else{
            checker[a - 1] = 0;
            checker[b - 1] = 0;
        }
    }

    int counter = 0;

    for(int i = 0; i < n ; i++){
        if(checker[i] == 1){
            counter ++ ;
        }
    }
    
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 4808