akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=3010,mo=1e9+7,inv2=mo+1>>1;
ll f[N][N],n,q,pw2=1,a[N];
int main(){
	cin>>n>>q;
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++)
		f[i][j]=a[i]<a[j];
	while (q--){
		int x,y;
		scanf("%d%d",&x,&y);
		for (int i=1;i<=n;i++){
			if (i==x||i==y)continue;
			f[i][x]=f[i][y]=(f[i][x]+f[i][y])*inv2%mo;
			f[x][i]=f[y][i]=(f[x][i]+f[y][i])*inv2%mo;			
		}
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])*inv2%mo;
		pw2=pw2*2%mo;
	}
	ll ans=0;
	for (int i=1;i<=n;i++)
		for (int j=i+1;j<=n;j++)
			ans=(ans+f[j][i])%mo;
	cout<<ans*pw2%mo<<endl;
}

Measured memory_bytes: 70784
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
int a, b, c, d, n, ans;
int ar[234567];
string s;
bool b1, b2;
signed main() {
	cin >> n;
	for1(i, n) { cin >> a; ans += a; }
	cout << ans - (n*(n + 1) / 2) << endl;
}


Measured memory_bytes: 3168
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define For( i , a ) for(int i=1;i<=a;i++)
#define ort (b+s)/2
#define y2 asrwjaelkf
#define y1 asseopirwjaelkf
#define set multiset

using namespace std;

typedef long long Lint;
typedef double db;
typedef pair<int,int> ii;
typedef pair<int,char> ic;
typedef pair<db,db> dd;
typedef pair<ii,int> iii;
typedef pair<ii,ii> i4;

const int maxn = 100020;
const int maxm = 1000020;
const int MOd = 998244353;

Lint a, b;

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

void solve() {
	scanf("%lld %lld",&a,&b);
	Lint x = gcd(a,b);
	Lint cnt = 1;
	for(Lint i=2;i*i<=x;i++)
		if( x % i == 0 ) {
			while( x % i == 0 ) x /= i;
			cnt++;
		}
	if( x != 1 ) cnt++;
	cout << cnt << endl;
}

int main() {

    //freopen("asd.in","r",stdin);
    //freopen("output17.txt","w",stdout);

	int n = 1;
	//scanf("%d",&n);
	while( n-- ) solve();

	return 0;
}


Measured memory_bytes: 384
//ALDS1_3_D Elementary data structures - Areas on the Cross-Section Diagram
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    stack<int> S1;
    stack<pair<int, int>> S2;
    char ch;
    int sum = 0;
    for (int i = 0; cin >> ch; i++)
    {
        if (ch == '\\')
            S1.push(i);
        else if (ch == '/' && S1.size() > 0)
        {
            int j = S1.top();
            S1.pop();
            sum += i - j;
            int a = i - j;
            while (S2.size() > 0 && S2.top().first > j)
            {
                a += S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }

    vector<int> ans;
    while (S2.size() > 0)
    {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for (int i = 0; i < ans.size(); i++)
    {
        cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3244
#include <iostream>
#include <stack>

int main() {

	std::stack<int> st;//line
	int inp;//input

	while (std::cin >> inp)
	{
		if (inp == 0) {//output data and pop data
			std::cout << st.top() << std::endl;
			st.pop();
		}
		else {//push data
			st.push(inp);
		}
	}

	return 0;
}

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

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

Measured memory_bytes: 3592
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let checkOne (ss, p) (ary: int []) =
    List.map (fun i -> ary.[i - 1]) ss
    |> List.sum
    |> fun x -> x % 2
    |> fun x -> x = p

let checkAll xs ary =
    List.forall (fun x -> checkOne x ary) xs

[<EntryPoint>]
let main _ =
    let [n;m] = reads int
    let kss = List.map (fun _ -> reads int |> List.tail) [1..m]
    let ps = reads int
    let qs = List.zip kss ps

    let t = [| for i = 1 to 10 do yield pown 2 i - 1 |]
    [
        for i = 0 to t.[n - 1] do
            yield
                [|
                    for j = 0 to n - 1 do
                        yield ((i >>> j) &&& 1)
                |]
    ]
    |> List.map (checkAll qs)
    |> List.filter id
    |> List.length
    |> printfn "%i"
    0

Measured memory_bytes: 14416
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    ll n; cin >> n;
    ll div = 1;
    auto vec = prime_factorize(n-1);
    for(auto val : vec){
        ll p = val.second;
        div *= p+1;
    }

    ll ans = div-1;

    auto check = [&](ll k){
        if(k == 1) return false;
        ll N = n;
        while(N % k == 0){
            N /= k;
        }
        if(N % k == 1) return true;
        else return false;
    };

    for(ll i = 1; i*i <= n; i++){
        if(n % i != 0) continue;
        if(check(i)) ans++;
        if(n/i != i && check(n/i)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
class Main{
	public static void main(String args[])
	throws java.io.IOException{
		int c;
		c=System.in.read();
		if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
			System.out.println("vowel");
		}else{
			System.out.println("consonant");
		}	
	}
}


Measured memory_bytes: 8148
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repe(i, n) REPN(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
template <typename T>
void coVec(const Vec1<T> &v){for(T i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll k;
	cin >> k;
	ll n = 50, p = k/n, r = k%n;
	Vec ans(n, n-1+p);
	rep(i, n){
		if(i < r) ans[i] += n-r+1;
		else ans[i] -= r;
	}
	co(n);
	coVec(ans);

	return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            string[] n = Console.ReadLine().Split();
            int a = int.Parse(n[0]);
            int b = int.Parse(n[1]);
            if(a>b)
            {
                for(int x = 0;x < a;x++)
                {
                    Console.Write(b);
                }
            }
            else
            {
                for(int y = 0;y < b;y++)
                {
                    Console.Write(a);
                }
            }
        }
    }
}

Measured memory_bytes: 27312
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-18
inline ll read()
{
    ll tmp=0; char c=getchar(),f=1;
    for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
    for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0';
    return tmp*f;
}
using namespace std;
char a[1010][1010];
int n,m,x,y;
int main()
{
	int i,j;
	n=read(); m=read(); x=read(); y=read();
	int A=x,B=y;
	memset(a,'.',sizeof(a));
	if(n&1){
		int cnt=m/2;
		for(i=1;i<=cnt;i++)
			if(A>0)--A,a[n][i*2-1]='<',a[n][i*2]='>';
	}
	if(m&1){
		int cnt=(n&1)?(n-1)/2:n/2;
		for(i=1;i<=cnt;i++)
			if(B>0)--B,a[i*2-1][m]='^',a[i*2][m]='v';
	}
	int r=n/2*2,c=m/2*2;
	for(i=1;i<r;i+=2)
		for(j=1;j<c;j+=2)
			if(A>=2&&a[i][j]=='.'&&a[i+1][j]=='.'&&a[i][j+1]=='.'&&a[i+1][j+1]=='.'){
				a[i][j]=a[i+1][j]='<';
				a[i][j+1]=a[i+1][j+1]='>';
				A-=2;
			}
			else if(B>=2&&a[i][j]=='.'&&a[i+1][j]=='.'&&a[i][j+1]=='.'&&a[i+1][j+1]=='.'){
				a[i][j]=a[i][j+1]='^';
				a[i+1][j]=a[i+1][j+1]='v';
				B-=2;
			}
			else if(A>0&&a[i][j]=='.'&&a[i][j+1]=='.'){
			    a[i][j]='<'; a[i][j+1]='>'; --A;
			}
			else if(B>0&&a[i][j]=='.'&&a[i+1][j]=='.'){
			    a[i][j]='^'; a[i+1][j]='v'; --B;
			}
	if(A==0&&B==0){
	    printf("YES\n");
		for(i=1;i<=n;i++){
			for(j=1;j<=m;j++)
				printf("%c",a[i][j]);
			printf("\n");
		}
		return 0;
	}
	memset(a,'.',sizeof(a));
	A=x; B=y;
	if(n&1){
		int cnt=m/2;
		for(i=1;i<=cnt;i++)
			if(A>0)--A,a[n][i*2-1]='<',a[n][i*2]='>';
	}
	if(m&1){
		int cnt=(n&1)?(n-1)/2:n/2;
		for(i=1;i<=cnt;i++)
			if(B>0)--B,a[i*2-1][m]='^',a[i*2][m]='v';
	}
	if((n&1)&&(m&1)&&n>=3&&m>=3){
	    A++; B++;
	    if(A)a[n][m-2]='<',a[n-2][m-1]='>',--A;
	    if(B)a[n-1][m]='^',a[n][m]='v',--B;
	    if(A)a[n-2][m-1]='<',a[n-2][m]='>',--A;
	    if(B)a[n-2][m-2]='^',a[n-1][m-2]='v',--B;
	}
	r=n/2*2,c=m/2*2;
	for(i=1;i<r;i+=2)
		for(j=1;j<c;j+=2)
			if(A>=2&&a[i][j]=='.'&&a[i+1][j]=='.'&&a[i][j+1]=='.'&&a[i+1][j+1]=='.'){
				a[i][j]=a[i+1][j]='<';
				a[i][j+1]=a[i+1][j+1]='>';
				A-=2;
			}
			else if(B>=2&&a[i][j]=='.'&&a[i+1][j]=='.'&&a[i][j+1]=='.'&&a[i+1][j+1]=='.'){
				a[i][j]=a[i][j+1]='^';
				a[i+1][j]=a[i+1][j+1]='v';
				B-=2;
			}
			else if(A>0&&a[i][j]=='.'&&a[i][j+1]=='.'){
			    a[i][j]='<'; a[i][j+1]='>'; --A;
			}
			else if(B>0&&a[i][j]=='.'&&a[i+1][j]=='.'){
			    a[i][j]='^'; a[i+1][j]='v'; --B;
			}
	if(A==0&&B==0){
	    printf("YES\n");
		for(i=1;i<=n;i++){
			for(j=1;j<=m;j++)
				printf("%c",a[i][j]);
			printf("\n");
		}
		return 0;
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
//16:05
int N,M;
int f[8][8] = {0};

int search(vector<bool> &used,int i,int t)
{
    int ans = 0;
    t++;
    if(t == N)
    {
        t--;
        return 1;
    }
    used[i] = true;
    for(int j = 0;j<N;j++)
    {
        if(!used[j] && f[i][j] != 0)
        {
            ans += search(used,j,t);
        }
    }
    used[i] = false;
    t--;
    return ans;
}
int main()
{
    cin >> N >> M;
    for(int i=0;i<M;i++)
    {
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        f[a][b] = 1;
        f[b][a] = 1;
    }
    
    vector<bool> used(N,false);

    int count = search(used,0,0);
    
    cout <<count << endl;
 
    return 0;
    
}

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

int main(){
    int n, k; cin >> n >> k;
    vector<ll> x(n); cin >> x[0];
    ll jud = x[0]; x[0] = 0;
    rep(i,n-1){
        cin >> x[i+1];
        x[i+1] -= jud;
    }

    ll ans = 1002003004005006007;
    rep(i,n-k+1){
        ans = min(ans, x[i+k-1]-x[i] +min(abs(x[i]+jud), abs(x[i+k-1]+jud)));
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


ll M,N,A,B,C,D;

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll gcd(ll x,ll y){
	if(x < y){
		swap(x,y);
	}
	if(y == 0){
		return x;
	}else{
		return gcd(y,x%y);
	}
}

ll lcm(ll x,ll y){

	return (x*y)/gcd(x,y);
}

int main(){

	scanf("%lld %lld %lld %lld %lld %lld",&M,&N,&A,&B,&C,&D);

	ll e = lcm(M/gcd(A,M),N/gcd(B,N));

	vector<ll> V;

	for(ll i = 1; i*i <= M*N; i++){
		if((M*N)%i != 0)continue;

		V.push_back(i);
		V.push_back((M*N)/i);
	}

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

	for(int i = 0; i < V.size(); i++){

		ll f = V[i];

		if(f*C%gcd(A,M) != 0 || f*D%gcd(B,N) != 0)continue;

		ll L = (f*C/gcd(A,M))*mod_inverse(A/gcd(A,M),M/gcd(A,M));
		ll R = (f*D/gcd(B,N))*mod_inverse(B/gcd(B,N),N/gcd(B,N));
		ll tmp_mod = gcd(M/gcd(A,M),N/gcd(B,N));

		if(L%tmp_mod == R%tmp_mod){

			printf("%lld\n",e*f-1);
			return 0;
		}
	}

	return 0;
}



Measured memory_bytes: 3308
//50
#include<iostream>
#include<vector>

using namespace std;

struct C{
  int f,a,s;
};

int main(){
  for(int n;cin>>n,n;){
    vector<C> v(1);
    C is={-1,0,1000000001};
    v[0]=is;
    while(n--){
      char c;
      cin>>c;
      if(c=='W'){
	int l,s;
	cin>>l>>s;
	for(int i=0;s;i++){
	  if(v[i].f==-1){
	    v[i].f=l;
	    if(v[i].s<=s){
	      s-=v[i].s;
	    }else{
	      C n={-1,v[i].a+s,v[i].s-s};
	      v[i].s=s;
	      v.insert(v.begin()+i+1,n);
	      break;
	    }
	  }
	}
      }else if(c=='D'){
	int l;
	cin>>l;
	for(int i=0;i<v.size();i++){
	  if(v[i].f==l){
	    v[i].f=-1;
	  }
	}
      }else{
	int p;
	cin>>p;
	for(int i=0;i<v.size();i++){
	  if(v[i].a<=p&&p<v[i].a+v[i].s){
	    cout<<v[i].f<<endl;
	  }
	}
      }
    }
    cout<<endl;
  }
  return 0;
}
	    

Measured memory_bytes: 1352
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	println(a * b / 2);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
const double PI = acos(-1);

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

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

//素因数分解
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}
//const auto &pf = prime_factorize(i);
//for (auto p : pf) cout << p.first << " " << p.second;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main()
{
    int x; cin >> x;
    if (x == 1)
        cout << 0 << endl;
    else
        cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
int main(void){
   
   int H, W;
   int i, t;
   
   while(1){
        scanf("%d %d\n", &H, &W);
        if(H == 0 && W == 0) break;
        for(i = 0; i < H; i++){
            for(t = 0; t < W; t++){
                if (i % 2 == 0 && t % 2 == 0) printf("#");
                else if (i % 2 != 0 && t % 2 != 0) printf("#");
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
   }
   
  return 0;
   
}

Measured memory_bytes: 576
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	int n, ans = 1, ansHow = 0;
	cin >> n;
	for(int i = 1;i <= n;i++){
		int now = i, how = 0;
		while(now % 2 == 0){
			now /= 2;
			how++;
		}
		if(ansHow < how){
			ans = i;
			ansHow = how;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] vOdd = new int[100001];
		int[] vEven = new int[100001];
		int maxOdd=0,maxEven=0,maxNumOdd=0,maxNumEven=0;
		for( int i=1; i<=N/2; i++ ){
			vOdd[sc.nextInt()]++;
			vEven[sc.nextInt()]++;
		}
		for( int i=1; i<=100000; i++ ){
			if( vOdd[i]>maxOdd ){
				maxOdd = vOdd[i];
				maxNumOdd = i;
			}
			if( vEven[i]>maxEven ){
				maxEven = vEven[i];
				maxNumEven = i;
			}
		}
		int ans = 0;      
		if( maxNumOdd!=maxNumEven ){
			ans = N - maxOdd - maxEven;
		}else{
			Arrays.sort(vOdd);
			Arrays.sort(vEven);
			ans = N - Math.max(maxOdd,maxEven) - Math.max(vOdd[99999],vEven[99999]);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 57624
#! /usr/bin/python3
# 居合を終え、青い絵を覆う / UOIAUAI
"""
英小文字 c が与えられるので、c が母音であるか判定してください。
ここで、英小文字のうち母音は a、e、i、o、uの 5 つです。
"""

c = input()

if c in ('a', 'i', 'u', 'e', 'o'):
    print('vowel')
else:
    print('consonant')


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


void maxHeapify(int *A, int N, int node_idx){
    
    int tmp;
    int largest = node_idx;
    int left_child_idx = 2 * node_idx + 1;
    int right_child_idx = 2 * node_idx + 2;
    
    // ????????????????????????????????§???????????§????????????????????¶
    if ( left_child_idx < N && A[left_child_idx] > A[node_idx]) {
        largest = left_child_idx;
    }else{
        largest = node_idx;
    }
    if ( right_child_idx < N && A[right_child_idx] > A[largest]) {
        largest = right_child_idx;
    }
    
    // ???node_idx?????????????????????????????§????????´???
    if (largest != node_idx) {
        tmp = A[largest];
        A[largest] = A[node_idx];
        A[node_idx] = tmp;
        
        // ?????°??????????????????
        maxHeapify(A, N, largest);
    }
}


void buildMaxHeap(int *A, int N){
    int i;
    
    for (i = N/2; i >= 0; i--) {
        maxHeapify(A, N, i);
    }
}


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

Measured memory_bytes: 2552
#include<iostream>
#include<vector>
#include<cmath>

int main(){
	int n;
	std::vector<int> cList;

	std::cin>>n;
	cList.resize(n);
	for(int i=0; i<n; i++)
		std::cin>>cList[i];

	int cMaxNum=-1;
	int cMaxIdx=-1;

	for(int i=0; i<n; i++)
		if(cMaxNum< cList[i])
			cMaxIdx=i, cMaxNum=cList[i];
	
	int dMaxNum=-1;
	int dMaxIdx=-1;

	for(int i=0; i<n; i++){
		if(i==cMaxIdx)
			continue;

		int dNum= std::min(cMaxNum-cList[i], cList[i]);
		if(dMaxNum< dNum)
			dMaxIdx=i, dMaxNum=dNum;
	}

	std::cout<<cList[cMaxIdx]<<" "<<cList[dMaxIdx]<<std::endl;

	return 0;
	
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))

N,M=map(int, input().split())
AB=[list(map(int,input().split())) for i in range(N)]
CD=[list(map(int,input().split())) for i in range(M)]

tmp = 10**10
for i in range(N):
    kyori = tmp
    ans = 0
    for j in range(M):
        tmp2 = abs(AB[i][0]-CD[j][0])+abs(AB[i][1]-CD[j][1])
        if kyori > tmp2:
            kyori = tmp2
            ans = j+1
    print(ans)


Measured memory_bytes: 76708
#include <stdio.h>

#define IS_LEAP(y)    (((y) % 4 == 0) && ((y) % 100 != 0) || ((y) % 400 == 0))

int month_days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int last_day(int y, int m)
{
    if (IS_LEAP(y) && m == 2){
        return (29);
    }
    return (month_days[m]);
}

int main(void)
{
    int y1, m1, d1;
    int y2, m2, d2;
    int y, m;
    int days;
    
    while (1){
        scanf("%d%d%d%d%d%d", &y1, &m1, &d1, &y2, &m2, &d2);
        if (y1 < 0 || m1 < 0 || d1 < 0 || y2 < 0 || m2 < 0 || d2 < 0){
            break;
        }
        
        days = 0;
        for (y = y1 + 1; y < y2; y++){
            days += 365;
            if (IS_LEAP(y)){
                days++;
            }
        }
        
        if (y1 != y2){
            for (m = m1 + 1; m <= 12; m++){
                days += last_day(y1, m);
            }
            days += (last_day(y1, m1) - d1 + 1);
            for (m = 1; m < m2; m++){
                days += last_day(y2, m);
            }
            days += (d2 - 1);
        }
        else {
            if (m1 != m2){
                for (m = m1 + 1; m < m2; m++){
                    days += last_day(y1, m);
                }
                days += (last_day(y1, m1) - d1 + 1);
                days += (d2 - 1);
            }
            else {
                days = d2 - d1;
            }
        }
        
        printf("%d\n", days);
    }
    return (0);
}

Measured memory_bytes: 0
# coding: utf-8
# Your code here!

import itertools

N, M = map(int, input().split())

graph= [[False]*N for i in range(N)]

for i in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a][b] = True
    graph[b][a] = True

lst = [i-1 for i in range(N)]
cnt = 0

for v in itertools.permutations(lst, N):
    if v[0] != 0:
        continue
    for i in range(N-1):
        if graph[v[i]][v[i+1]] == False:
            break
        if i == N-2:
            cnt += 1

print(cnt)









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

int main(void)
{
    int a, b, c; cin >> a >> b >> c;
    if (a == b && b == c && c == a)
        cout << "No" << endl;
    else
    {
        if (a == b || b == c || c == a)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
//Compiler optimization
#pragma GCC optimize("Ofast")

//include
#include <bits/stdc++.h>
using namespace std;

//typedef
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;

//macro
#define reverse(a) reverse(a.begin(),a.end())
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define each(x, v) for (auto &x : v)

//abbreviation
#define pb push_back
#define elif else if
#define mp make_pair
#define endl '\n'

//debug
#define debug(x) cerr << #x << ": " << x << endl
#define v_debug(v) cerr << #v << endl;fr(i,v.size()) cerr << i << ": " << v[i] << endl

//const
const  ll INF = 1e18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(20);
    ll n,m,k;cin >> n>> m>> k;
    vl a(n), b(m);
    fr(i,n)cin >> a[i];
    fr(i,m)cin>> b[i];
    vl a_sum(n+1), b_sum(m+1);
    a_sum[0] = b_sum[0] = 0;
    fr(i,n)a_sum[i+1] = a_sum[i] + a[i];
    fr(i,m)b_sum[i+1] = b_sum[i] + b[i];
    ll ans = 0, now = 0;
    ll ok = 0, ng = m, mid;
    fr(i,n+1){
        now = a_sum[i];
        //debug(now);
        if(now + b_sum[m] <= k){
            ans = max(ans, i+m);
            continue;
        }
        if(now > k)break;
        ok = 0;
        ng = m;
        while(ng - ok > 1){
            mid = (ok + ng)/2;
            if(now + b_sum[mid] <= k)ok = mid;
            else ng = mid;
        }
        ans = max(ans, i + ok);
    }
    cout << ans << endl;
}

Measured memory_bytes: 9536
#include<iostream>
#include<math.h>
using namespace std;
int main(){
  int x=0,n,a[100],ans=2147483647;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=1;i<100;i++){
    x=0;
    for(int j=0;j<n;j++)
      x+=pow(a[j]-i,2);
    ans=min(x,ans);
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
    int N,K;cin>>N>>K;
    int cnt = 0;
    int x = 1;
    while(x <= N){
        cnt++;
        x*=K;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
def p_e():
    n, k = map(int, input().split())
    *A, = map(int, input().split())
    *F, = map(int, input().split())
    A.sort()
    F.sort(reverse=True)

    def check(x):
        count = 0
        for a, f in zip(A, F):
            count += max(a - x // f, 0)
        return count <= k

    max_num = 0
    for a, f in zip(A, F):
        if max_num < a * f:
            max_num = a * f
    l, h = 0, max_num
    while l <= h:
        mid = (l + h) // 2
        if check(mid):
            h = mid - 1
        else:
            l = mid + 1
    print(h + 1)
    
p_e()

Measured memory_bytes: 122004
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
#define F first
#define S second
int main()
{
    Hello
    int n;
    cin >> n;
    int arr[n + 5];
    bool ok = true;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if(arr[i] % 2 == 0)
        {
            if(arr[i] % 3 != 0 && arr[i] % 5 != 0)
                ok = false;
        }
    }
    if(ok)
        cout << "APPROVED";
    else
        cout << "DENIED";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

bool is_ok(string s) {
  int f = 1;
  int l;
  if(s.size() % 2 == 0) l = s.size() / 2;
  else
    l = (s.size() - 1) / 2;
  REP(i, l) {
    if(s[i] != s[s.size() - 1 - i]) f = 0;
  }
  if(f == 1) return true;
  else
    return false;
}

void solve(istream& cin, ostream& cout) {
  string s;
  cin >> s;
  int n = s.size();
  string a, b;
  a = s.substr(0, (n - 1) / 2);
  b = s.substr((n + 3) / 2 - 1, (n - 1) / 2);
  if(is_ok(s) && is_ok(a) && is_ok(b))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    string s;
    cin >> s;
    
    bool ans = false;
    
    if (s.size() >= 4 && s.substr(0, 4) == "YAKI") {
        ans = true;
    }
    
    cout << (ans ? "Yes" : "No");

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) { ll res=1; a%=mod; assert(b>=0); for(;b;b>>=1) { if(b&1) res=res*a%mod; a=a*a%mod; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }

int main() {
	int t;
	// cin >> t;
    t = 1;

	while(t--) {
		int x, y;
        cin >> x >> y;
        
        int val = y - (2*x);
        if(val >= 0 && (val % 2 == 0)) {
            if(x - (val/2) >= 0) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        
        cout << "No" << endl;
	}

	return 0;
}

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


int get(int x, int m) {
	int s = 0;
	while(x) {
		s += x % m;
		x /= m;
	}
	return s;
}

int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, s; cin >> n >> s;
	if(s == n) {
		cout << n + 1 << endl;
		return 0;
	}

	for(int i = 2; i <= min(n, 10000000LL); i++) {
		if(get(n, i) == s) {
			cout << i << endl;
			return 0;
		}
	}
	int ans = 1e18;
	for(int i = 1; i <= min(s, 10000000LL); i++) {
		int c = s - i;
		int bm = n - c;
		if(bm < 0) continue;
		if(bm % i == 0) {
			int m = bm / i;
			if(m > 1 && get(n, m) == s) {
				ans = min(ans, m);
			}
		}
	}
	if(ans == 1e18) ans = -1;
	cout << ans << endl;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
edge = [[] for k in range(n)]
for k in range(m):
    a, b = list(map(int, input().split()))
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

start = 0

from collections import deque
que = deque([start])
done = {start}
depth = [1e9]  * n
depth[start] = 0
parents = [-1] * n
while True:
    if len(que) == 0:
        break
    now = que.popleft()
    dep = depth[now]
    
    for node in edge[now]:
        if node not in done:
#             if dep < depth[node]:
            depth[node] = dep + 1
            parents[node] = now
            que.append(node)
        done.add(node)
#     done.add(now)
#     print(now)
if max(depth) == 1e9:
    print("No")
else:
    print("Yes")
    for k in range(1, n):
        print(parents[k] + 1)

Measured memory_bytes: 106336
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define FOR(i, n) for(int i = 1; i<=n; i++)
#define F0R(i, n) for(int i = 0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second


//var 
LL n, MOD, x, ans = 0, sq, nosq;
vector<LL> seq, pf, oseq, bef;
map<LL, LL> prv;

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

	cin >> n >> x >> MOD;
	LL tmp = x; prv[tmp] = 1;
	oseq.pb(tmp);
	tmp *= tmp; tmp %= MOD; int cur = 1;
	while(1){
		if(prv[tmp]) {
			for(int i = prv[tmp]-1; i<oseq.size(); i++)
				seq.pb(oseq[i]);
			for(int i = 0; i<prv[tmp]-1; i++)
				bef.pb(oseq[i]);
			break;
		}
		oseq.pb(tmp); cur++; prv[tmp] = cur; 
		tmp *= tmp;
		tmp %= MOD;
	}

	for(auto u : seq)
		pf.pb(u);

	for(int i = 1; i<seq.size(); i++)
		pf[i] += pf[i-1];

	sq = seq.size(); nosq = bef.size();
	if(n < nosq){
		for(int i = 0; i<n; i++)
			ans += bef[i];
		cout << ans << endl;
		return 0;
	}

	for(int i = 0; i<nosq; i++)
		ans += bef[i];
	n -= nosq;

	ans += (n/sq) * pf[sq-1];
	n %= sq;
	if(n != 0)ans += pf[n-1];
	cout << ans << endl;


	cout.flush();
	return 0;
}

Measured memory_bytes: 7780
#include<iostream>
using namespace std;
int main(){
int a=0;cin>>a;
int c[4][14]={0};
for(int i=0;i<a;i++){
  char z;
  cin>>z;
  int n;
  cin>>n;
  if(z=='S')
c[0][n]=1;
   else if(z=='H')
c[1][n]=1;
   else if(z=='C')
c[2][n]=1;
   else if(z=='D')
  c[3][n]=1;
  
}

for(int i=0;i<4;i++){
  for(int j=1;j<14;j++){
  if(c[i][j]==0){
    char z;
    if(i==0)
    z='S';
    else if(i==1)
    z='H';
      else if(i==2)
    z='C';
      else if(i==3)
    z='D';
    cout<<z<<' '<<j<<'\n';
  }
  }
}
return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <string>

using namespace std;

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

    int l = S.length();

    int a = 'a';
    int z = 'z';

    bool flag = true;
    if (S[0] != 'A'){
        flag = false;
    }

    int countC = 0;
    int C;
    if (flag == true){
        for (int i = 2; i < l-1; i++){
            if (S[i] == 'C'){
                countC ++;
                C = i;
            }
        }
        if (countC != 1){
            flag = false;
        }
    }
    if (flag == true){
        for (int i = 1; i < C; i++){
            int num = S[i];
            if (num >= a && num <= z){
            }else{
                flag = false;
            }
        }
    }
    if(flag == true){
        for (int i = C + 1; i < l; i++){
            int num = S[i];
            if (num >= a && num <= z){
            }else{
                flag = false;
            }
        }    
    }
    if (flag == false){
        cout << "WA" << endl;
    }else{
        cout << "AC" << endl;
    }
    
    
    
    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int x,y,z; cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100000000000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

double dp[3010][3010];

int main(){
   ll N;
   cin >> N;
   vector<double> P(N);
   rep(i,N) cin >> P[i];
   double ans = 0;
   dp[0][0] = 1; 
   rep(i,N){
       rep(j,N){
           dp[i+1][j+1] += P[i] * dp[i][j];
           dp[i+1][j] += (1-P[i]) * dp[i][j];
       }
   }
   rep(i,N+1){
       if(i * 2 >= N) ans += dp[N][i];
   }
   cout << setprecision(20) << fixed;
   cout << ans << endl;
}



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

vector<string> dp(10010);

string compare_str(string now, string before, int n) {
    if (now == "impossible") now = "";
    if (now.size() > before.size() + 1) return now;
    if (now.size() < before.size() + 1) return to_string(n) + before;
    bool now_large = true;
    rep(i, now.size()) {
        int int_now = now[i] - '0', int_before;
        if (i==0) int_before = n;
        else int_before = before[i-1] - '0';

        if (int_now < int_before) {
            now_large = false;
            break;
        } else if (int_now > int_before) {
            now_large = true;
            break;
        }
    }

    if (now_large) return now;
    else return to_string(n) + before;
}

int main() {
    int N, M, ai;
    cin >> N >> M;
    bool A[10] = {};
    rep(i, M) cin >> ai, A[ai] = true;

    rep(i, N+1) dp[i] = "impossible";
    dp[0] = "";
    rep(k, N+1) {
        if (dp[k] != "impossible"){
            if (A[1]) dp[k+2] = compare_str(dp[k+2], dp[k], 1);
            if (A[2]) dp[k+5] = compare_str(dp[k+5], dp[k], 2);
            if (A[3]) dp[k+5] = compare_str(dp[k+5], dp[k], 3);
            if (A[4]) dp[k+4] = compare_str(dp[k+4], dp[k], 4);
            if (A[5]) dp[k+5] = compare_str(dp[k+5], dp[k], 5);
            if (A[6]) dp[k+6] = compare_str(dp[k+6], dp[k], 6);
            if (A[7]) dp[k+3] = compare_str(dp[k+3], dp[k], 7);
            if (A[8]) dp[k+7] = compare_str(dp[k+7], dp[k], 8);
            if (A[9]) dp[k+6] = compare_str(dp[k+6], dp[k], 9);
        }
        // rep(i, N+1) cout << dp[i] << ",";
        // cout << endl;
    } 

    cout << dp[N] << endl;

    return 0;
}

 

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

int main(){
  int R;
  cin >> R;
  
  if(R < 1200){
    cout << "ABC" << endl;
  }else if(R < 2800){
    cout << "ARC" << endl;
  }else{
    cout << "AGC" << endl;
  }
}

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

#define NIL -1

typedef struct _node {
	int parent;
	int child;
	int sibling;
} node;

node *allocNode() {
	node *p = (node *)malloc(sizeof(node));
	p->parent = NIL;
	p->child = NIL;
	p->sibling = NIL;
	return p;
}

void terminate(node **root, int n) {
	int i;
	for (i = 0; i < n; i++)	free(root[i]);
	free(root);
}

int countDepth(node **root, int cur) {
	int count, parent;
	count = 0;
	parent = root[cur]->parent;
	while (parent != NIL) {
		parent = root[parent]->parent;
		count++;
	}
	return count;
}

int getType(node *p) {
	if (p->parent == NIL) return 0;
	if (p->child != NIL) return 1;
	return 2;
}
int main() {
	int c, i, j, n, k, id, prev, child;
	node **root;
	char strtype[3][14] = {"root","internal node","leaf"};

	scanf("%d", &n);
	root = (node **)malloc(sizeof(node *) * n);
	for (i = 0; i < n; i++) root[i] = NULL;

	for (i = 0; i < n; i++) {
		scanf("%d %d", &id, &k);
		if (root[id] == NULL) root[id] = allocNode();
		for (j = 0; j < k; j++) {
			scanf("%d", &c);
			if (j == 0) root[id]->child = c;
			else root[prev]->sibling = c;
			if (root[c] == NULL) root[c] = allocNode();
			root[c]->parent = id;
			prev = c;
		}
	}

	for (i = 0; i < n; i++) {
		printf("node %d: ", i);
		printf("parent = %d, ", root[i]->parent);
		printf("depth = %d, ", countDepth(root, i));
		printf("%s, ", strtype[getType(root[i])]);
		child = root[i]->child;
		printf("[");
		while (child != NIL) {
			printf("%d", child);
			child = root[child]->sibling;
			if (child != NIL) printf(", ");
		}
		printf("]\n");
	}

	terminate(root, n);
	return 0;
}


Measured memory_bytes: 5444
#include <stdio.h>




int main(int argc, char *argv[])
{
	int A[20][20];
	int B[20];
	int C;
	int N, M;
	int i, j;
	int sum, cnt;

	scanf("%d %d %d", &N, &M, &C);
	
	for (i = 0; i < M; i++) {
		scanf("%d", &B[i]);
	}

	for (j = 0; j < N; j++) {
		for (i = 0; i < M; i++) {
			scanf("%d", &A[j][i]);
		}
	}

	cnt = 0;
	for (j = 0; j < N; j++) {
		sum = 0;
		for (i = 0; i < M; i++) {
			sum +=  A[j][i]*B[i];
		}
		sum += C;
		if (sum > 0) {
			cnt++;
		}
	}
	
	printf("%d\n", cnt);
	return 0;
}


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

#define ull unsigned long long

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    ull N;
    ull *A, *c;
    ull sigma = 0;
    cin >> N;
    A = new ull[N];
    c = new ull[N];
    for(ull i = 0;i < N;i++) {
        cin >> A[i];
        c[A[i] - 1] += 1; 
    }
    for(ull i = 0;i < N;i++) sigma += c[i] * (c[i] - 1) / 2;
    for(ull i = 0;i < N;i++) cout << sigma - (c[A[i] - 1] - 1) << endl;
    return 0;
}


Measured memory_bytes: 4736
//
// ABC178 C - Ubiquity
//

/*
0≤Ai≤9 なる長さ N の整数列 {A}全体について考えます。
Ai=0 なる i が存在しないような {A} は、9N 通りあります。
Ai=9 なる i が存在しないような {A} は、9N 通りあります。
Ai=0 なる i と Ai=9 なる i がともに存在しないような {A} は、8N 通りあります。
Ai=0 なる i と Ai=9 なる i の少なくとも一方が存在しないような {A} は、9N+9N−8N 通りあります。
{A}は、10N 通りあります。
Ai=0 なる i と Ai=9 なる i がともに存在するような {A} は、10N−9N−9N+8N 通りあります。
答えは 10N−9N−9N+8N です。

この解法は包除原理の適用であるといえます。 
包除原理はより難易度の高い問題を解く際にも活躍します。

https://atcoder.jp/contests/abc178/editorial/104
*/

#include <bits/stdc++.h>
using namespace std;

const long long MOD = 1000000007;

long long modpow(long long x, long long y, long long mod)
{
    long long res = 1;
    for (long long i = 0; i < y; i++)
    {
        res = res * x % mod;
    }
    return (res);
}

int main()
{
    // 標準入力から値を受け取る
    long long n;
    cin >> n;

    // 答えを計算する。
    long long ans;
    ans = modpow(10, n, MOD) - (modpow(9, n, MOD) + modpow(9, n, MOD) - modpow(8, n, MOD));
    ans %= MOD;
    ans = (ans + MOD) % MOD;

    // 標準出力に答えを出力する。
    cout << ans << endl;

    // 戻り値
    return (0);
}


Measured memory_bytes: 3608
#include <iostream>

using namespace std;

int main ()
{
	int a[100],b[100],a1,a2,a3,b1;

	a1 = 0;
	a2 = 0;
	a3 = 0;
	b1 = 0;

	for (int i = 0; i < 4; i++)
	{
		cin >> a[i];
	}
	for (int j = 0; j < 2; j++)
	{
		cin >> b[j];
	}

	for (int i = 0; i < 4; i++)
	{
		if (a[i] >= a1)
		{
			a3 = 0;
			a3 = a2;
			a2 = 0;
			a2 = a1;
			a1 = 0;
			a1 = a[i];
		}
		else if (a[i] >= a2)
		{
			a3 = 0;
			a3 = a2;
			a2 = 0;
			a2 = a[i];
		}
		else if (a[i] >= a3)
		{
			a3 = 0;
			a3 = a[i];
		}
	}
	for (int j = 0; j < 2; j++)
	{
		if (b1 < b[j])
		{
			b1 = 0;
			b1 = b[j];
		}
	}

	cout << a1 + a2 + a3 + b1 << endl;
}

Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>

using namespace std;


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

  cout << max(0, C - (A - B)) << endl;

  return 0;
}


Measured memory_bytes: 256
import math

X = int(input())
max_ko = math.floor(X/100)
if(float.is_integer(X/105)):
    min_ko = math.floor(X/105)
else:
    min_ko = math.floor(X/105)+1

for kosu in range(min_ko, max_ko+1):
    big_val = 100*kosu
    max_small_val = 5*kosu
    mokuhyou = X - big_val
    if(mokuhyou >= 0 and mokuhyou <= max_small_val):
        print(1)
        exit()
print(0)


Measured memory_bytes: 3060