akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cmath>
bool isprime(int n)
{
    if(n==2) return true;
    if(n<2 || n%2==0) return false;
    for(int i=3; i<=sqrt(n); i+=2)
        if(n%i==0) return false;
    return true;
}

using namespace std;
int main()
{
    int n, cnt=0, p;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        scanf("%d", &p);
        if(isprime(p)) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 2672
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main(){

    int n;
    int divCount = 0;

    cin >> n;
    for(int i = 0; i < n; i++){
        long long val;
        cin >> val;
        while(val % 2 == 0){
            val = val / 2;
            divCount += 1;
        }
    }
    cout << divCount << endl;

}

Measured memory_bytes: 256
import java.util.*;
class Main{
  static Scanner sc = new Scanner(System.in);
  public static void main(String[] args){
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    double thetaH = 2*Math.PI*(H+M/60)/12;
    double thetaM = 2*Math.PI*M/60;
    double theta = Math.abs(thetaH-thetaM);
    double distance = Math.sqrt(A*A + B*B -2*A*B*Math.cos(theta));
    System.out.println(distance);
  }
}

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

unsigned int *a, x, y, z;

void sum(unsigned int k, unsigned int l, unsigned int r)
{
  if (r<x || y<l) return;// 0;
  if (x<=l && r<=y) {z+=a[k]; return;}//return a[k];
  k<<=1;
  int m=(l+r)>>1;
  //return sum(k, l, m)+sum(k+1, m+1, r);
  sum(k, l, m);
  sum(k+1, m+1, r);
}

int main()
{
  unsigned int i, n;
  char buf[32], *p;
  buf[31] = 0;
  buf[30] = '\n';
  fgets(buf, 32, stdin);
  for (n=0,p=buf; *p!=' '; n=n*10+*(p++)-'0');
  unsigned int s = n>=2 ? pow(2,ceil(log2(n))) : 1;
  a = (unsigned int*)malloc((s+n)*sizeof(unsigned int));
  bzero(a, sizeof(int)*(s+n));
  while (fgets(buf, 32, stdin)) {
    for (x=0,p=buf+2; *p!=' '; x=x*10+*(p++)-'0');
    for (y=0,p++; *p!='\n'; y=y*10+*(p++)-'0');
    if (buf[0]=='0') {
      for (i=s+x-1; i>0; i>>=1)   a[i]+=y;
    } else { // getSum xi, yi
      z=0;
      sum(1, 1, s);
      if (z==0) {
	putc_unlocked('0', stdout);
	putc_unlocked('\n', stdout);
      } else {
	for (i=30; z>0; buf[--i]='0'+z%10,z/=10);
	fputs_unlocked(buf+i, stdout);
      }
    }
  }
  return 0;
}



Measured memory_bytes: 2744
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(n)]
for i in range(n-1, -1, -1):
	tmp = 0
	for j in range(2*(i+1)-1, n, i+1):
		tmp ^= b[j]
	b[i] = a[i]^tmp
ans = [i+1 for i in range(n) if b[i]]
print(len(ans))
print(*ans)

Measured memory_bytes: 14140
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    a,b,c,k=L()
    if k<a:
        print(k)
    elif a+b>=k:
        print(a)
    else:
        tmp=k-(a+b)
        print(a-tmp)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9200
#include<stdio.h>
int main(void){
  int t[4][14] = {0};
  int i,x,n,w;
  char m;
  scanf("%d", &n);
  for(i=0;i<n;i++){
  scanf("%c",&m);
  scanf("%c %d",&m, &x);
  if(m=='S'){
    w=0;
  }else if(m=='H'){
    w=1;
  }else if(m=='C'){
    w=2;
  }else if(m=='D'){
    w=3;
  }
  t[w][x]=1;
  }
    for(w=0;w<4;w++){
      for(x=1;x<14;x++){
    if(t[w][x]==0){
      if(w==0){
	m='S';
      }else if(w==1){
	m='H';
      }else if(w==2){
	m='C';
      }else if(w==3){
	m='D';
      }
      printf("%c %d\n",m,x);
    }
      }
    }
  return 0;
}



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

using namespace std;

int main ( ) {
    int A, B, C, D;
    int sumLeft = 0, sumRight = 0;

    cin >> A >> B >> C >> D;

    sumLeft = A + B;
    sumRight = C + D;

    if (sumLeft > sumRight) {
        cout << "Left" << endl;
    } else if (sumLeft == sumRight) {
        cout << "Balanced" << endl;
    } else if (sumLeft < sumRight) {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef struct{
	int x;
	int y;
	int z;
	int r;
}Check;
Check check[1001];
int ans[303];
int a,b,c,n;

void checking(int k){
	if(ans[check[k].x]==1&&ans[check[k].y]==1){
		ans[check[k].z]=0;
	}else if(ans[check[k].z]==1&&ans[check[k].y]==1){
		ans[check[k].x]=0;
	}else if(ans[check[k].x]==1&&ans[check[k].z]==1){
		ans[check[k].y]=0;
	}

}


int main(){
	while(1){
		cin >>a >>b >>c;
		if(a==0&&b==0&&c==0)break;
		cin >>n;

		for(int i=1;i<=a+b+c;i++){
			ans[i]=2;
		}

		for(int i=0;i<n;i++){
			cin >>check[i].x >>check[i].y >>check[i].z >>check[i].r;
			if(check[i].r==1){
				ans[check[i].x]=1;
				ans[check[i].y]=1;
				ans[check[i].z]=1;
			}
		}

		for(int i=0;i<n;i++){
			if(check[i].r==1)continue;
			checking(i);
		}

		for(int i=1;i<=a+b+c;i++){
			cout <<ans[i] << endl;
		}

	}
	return 0;
}

Measured memory_bytes: 3080
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200005
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


int main()
{	
	int n,d;
	cin >> n >> d;
	int grid[n][d];
	for (int i=0 ; i<n ; i++)
	{
		for (int j=0 ; j<d ; j++)
		{
			cin >> grid[i][j];
		}
	}
	int cnt = 0;
	for (int i=0 ; i<n ; i++)
	{
		for (int j=i+1 ; j<n ; j++)
		{
			double y=0;
			{
				for (int k=0 ; k<d ; k++)
				{
					double x = grid[i][k] - grid[j][k];
					y+=x*x;
				}
				y=sqrt(y);
				if(y-(int)y==0) cnt++;
			}
		}
	}
	cout << cnt << endl;
}

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

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

int main()
{
    char inp[10 + 3];
    scanf("%s", inp);

    int ans = 0;
    for (int i = 0; i < (int)strlen(inp); i++) {
        for (int j = 0; j < (int)strlen(inp); j++) {
            for (int k = i; k <= j; k++) {
                char c = inp[k];
                if (c == 'A' || c == 'T' || c == 'G' || c == 'C')
                    continue;
                else
                    goto fail;
            }
            ans = max(ans, j - i + 1);
fail:
            continue;
        }
    }
    printf("%d\n", ans);

    return 0;
}


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

int main(){
  int N;
  string S;
  bool flag=true;
  cin >> N >> S;
  if(N%2!=0){
    cout << "No" << endl;
  }else{
    for(int i=0;i<N/2;i++){
      if(S.at(i)!=S.at(N/2+i)){
        cout << "No" << endl;
        flag=false;
        break;
      }
    }
    if(flag){
      cout << "Yes" << endl;
    }
  }
  return 0;
}


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


void func(set<int> &a,int &l,int &r){
  if(a.count(l)==1&&a.count(r)==1){
    if(a.count(1))a.erase(l),l--;
    else a.erase(r),r++;
  }else if(a.count(l)==1){
    a.erase(l),l--;
  }else if(a.count(r)==1){
    a.erase(r),r++;
  }
}

int main(){
  int Tc;
  cin>>Tc;
  while(Tc--){
    set<int> a,b;
    for(int i=0;i<6;i++){
      int x;
      cin>>x;
      a.insert(x);
    }
    for(int i=1;i<=13;i++)
      if(a.count(i)==0&&i!=7)b.insert(i);

    bool ans;
    int l=6,r=8;
    while(1){
      func(a,l,r);
      if(a.empty()){
        ans=true;
        break;
      }
      func(b,l,r);
      if(b.empty()){
        ans=false;
        break;
      }
    }
    cout<< (ans?"yes":"no") <<endl;
  }
  return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s; cin >> s;
    int r = 0, ans = 0;
    for(auto c : s)
    {
        if(c == 'R') r++;
        else r = 0;
        ans = max(ans, r);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int n,m,K;
char a[1010][1010];
int main() {
	scanf("%d%d%d",&n,&m,&K);
	for(int i=1;i<=n;++i) {
		for(int j=1;j<=m;++j) {
			int x=(i+j)-1, y=(i-j)-(1-m)+1;
			int a=((x-1)/K+1)&1, b=((y-1)/K+1)&1;
			if(!a && !b) putchar('R');
			if(!a && b) putchar('G');
			if(a && !b) putchar('B');
			if(a && b) putchar('Y');
		}
		puts("");
	}
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

struct UnionFind {
#define MAX 100001
    int ElementCount[MAX],Adress[MAX];
    void Init() {rep(i,MAX) ElementCount[i] = 1,Adress[i] = i;}
    void unite(int a ,int b) {
        int a_root = find(a),b_root = find(b);
        if (a_root != b_root) {
            ElementCount[a_root] += ElementCount[b_root];
            Adress[b_root] = a_root;
        }
    }
    int find(int a) {
        if (a == Adress[a]) return Adress[a];
        else {
            Adress[a] = find(Adress[a]);
            return Adress[a];
        }
    }
    int size(int a) {
        int root = find(a);
        return ElementCount[root];
    }
    /*
     * ElementCount : 属するグループの要素数
     * Adress : rootの番号
     * unite : 併合
     * find : aのrootを返す
     * size : aのrootのElementCountを返す
     * */
};


int n,m,x,y,z;
UnionFind UF;
set<int> s;

signed main() {
    UF.Init();
    cin >> n >> m;
    rep(i,m) {
        cin >> x >> y >> z;
        UF.unite(x,y);
    }
    rep1(i,n) s.insert(UF.find(i));
    cout << s.size() << endl;
}


Measured memory_bytes: 6528
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll   long long
#define ld long double
#define endl '\n'
#define INF 10000000000000000
#define pll pair<ll,ll>
#define ff first
#define ss second

using namespace std;
const ll N = 1000005;
const ll MOD = 1e9+7;
ll mul(ll a,ll b) {
    return (a*b)%MOD;
}
vector<ll> g[N];
pll dfs(ll v,ll p=-1) {
    ll white = 1;
    ll black = 0;
    for(ll i =0;i<g[v].size();i++) {
        if(g[v][i]!=p) {
            pll q = dfs(g[v][i],v);
            black = (mul(white,q.ff)+mul(black,q.ff+q.ss))%MOD;
            white = mul(white,q.ss);
        }
    }

    return {white,(black+white)%MOD};
}
int main()
{
 //freopen("input.txt","r",stdin);
 //  freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n;
    for(ll i =1;i<n;i++) {
        ll u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    pll p = dfs(1);
    cout<<(p.ff+p.ss)%MOD<<endl;
    // ������ ������

}


Measured memory_bytes: 31360
// 基本テンプレート (縮小版)

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N, K, a[5010];
bool dp[5010][5010];

// 必要ならば true
bool d(int x) {
    if(a[x] > K) return true;
    memset(dp, false, sizeof(dp));
    dp[0][0] = true;
    rep(i,0,N) repq(j,0,K) {
        dp[i+1][j] |= dp[i][j];
        if(i != x) dp[i+1][min(K, j+a[i])] |= dp[i][j];
    }
    bool ret = false;
    rep(i,max(0LL, K-a[x]),K) {
        ret |= dp[N][i];
    }
    return ret;
}

signed main() {
    cin >> N >> K;
    rep(i,0,N) cin >> a[i];
    sort(a, a+N);

    int lb = -1, ub = N;
    while(ub - lb > 1) {
        int mid = (ub + lb) / 2;
        if(d(mid)) ub = mid;
        else lb = mid;
    }
    cout << ub << endl;
    return 0;
}

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

using namespace std;

int main(){
    string str;
    while(1){
        getline(cin,str);
        int sum=0;
        for(int i=0;i<str.length();i++){
            sum+=str[i]-'0';
        }
        if(sum==0){
            break;
        }else{
            cout<<sum<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3176
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[105],cnt[105],mx;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        cnt[a[i]]++; mx=max(mx,a[i]);
    }
    if(mx%2==0){
        if(cnt[mx/2]!=1){puts("Impossible");return 0;}
        for(int i=mx/2+1;i<=mx;i++)
            if(cnt[i]<2){puts("Impossible");return 0;}
    }
    else{
        if(cnt[(mx+1)/2]!=2){puts("Impossible");return 0;}
        for(int i=(mx+1)/2+1;i<=mx;i++)
            if(cnt[i]<2){puts("Impossible");return 0;}
    }
    puts("Possible");
    return 0;
}

Measured memory_bytes: 256
let () =
  let open Queue in
  let (n:int),(quantum:int) = Scanf.scanf "%d %d\n" (fun a b -> a,b) in
  let (q:(string * int) t) = create () in
  try
    while true do
      add (Scanf.scanf "%s %d\n" (fun a b -> a,b)) q
    done;
  with _ ->
    let (sum:int ref) = ref 0 in
    try
      while true do
        let (p:string),(t:int) = take q in
        if t <= quantum then (sum := !sum+t; Printf.printf "%s %d\n" p !sum)
        else (add (p,t-quantum) q; sum := !sum+quantum)
      done;
    with _ -> ()

Measured memory_bytes: 12740
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    string S;
    cin >> S;
    string ans = "Yes";

    REP(i,S.length()){
        if(i%2 == 0 && S[i] == 'L'){
            ans ="No";
            break;
        }
        else if(i%2 == 1 && S[i] == 'R'){
            ans ="No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("0"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
//

mint dp[305][305][305];

int main() {
  df(n); df(m);
  dp[0][1][0] = 1;
  rep(i,m)rep(j,n+1)rep(k,n+1) {
    dp[i+1][j][k] += dp[i][j][k]*k;
    dp[i+1][j+k][0] += dp[i][j][k]*j;
    dp[i+1][j][k+1] += dp[i][j][k]*(n-j-k);
  }
  cout << dp[m][n][0] << endl;
  return 0;
}







Measured memory_bytes: 221952
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

int main(){

    string S;
    cin >> S;

    string ans = "yes";
    vector<int> alphabet(26, 0);
    for(int i = 0; i < S.length(); i++){
        if(alphabet[S[i] - 'a']) ans = "no";
        else alphabet[S[i] - 'a']++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
const int maxn = 200500;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    set < int > st;
    for(int i = 1 ; i <= 3 ; ++i)
        st.insert(i);
    int x;
    cin >> x; st.erase(x);
    cin >> x; st.erase(x);
    cout << *st.begin();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
    int n,t,a,sa = 1000000,ans=0,c;
    cin >> n >> t >> a;
    t *= 1000;
    a *= 1000;
    vec(b,n);
    REP(i,n){
        cin >> b[i];
        b[i] *= 6;
        b[i] = t-b[i];
        c = abs(b[i]-a);
        if(c<sa){
            ans = i+1;
            sa = c;
        }

    }
    cout << ans << endl;

    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var resultArray = new int[N];
            for (int i = 0; i < N; i++)
            {
                resultArray[array[i] - 1] = i + 1;
            }

            Console.WriteLine(string.Join(" ", resultArray.Select(i => i.ToString())));
        }
    }
}


Measured memory_bytes: 27740
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc133/tasks/abc133_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 
 N*AとBを比較して小さい方を出力
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,A,B;
    cin >> N >> A >> B;
    res = min(N*A,B);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 256
//By Vlgd
#include<bits/stdc++.h>
#define INF 200000000
using namespace std;
int p[101],n;
int dp[101][101];
void solve(){
	for (int i=1;i<=n;i++) dp[i][i]=0;
	for (int i=2;i<=n;i++){
		for (int j=1;j<=n-i+1;j++){
			int b=j+i-1;
			dp[j][b]=INF;
			for (int k=j;k<b;k++)
				dp[j][b]=min(dp[j][b],dp[j][k]+dp[k+1][b]+p[j-1]*p[k]*p[b]);
		}
	} 
	printf("%d\n",dp[1][n]);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int xx,yy;
		scanf("%d%d",&xx,&yy);
		if (i==1) p[i-1]=xx;
		p[i]=yy;
	}
	solve();
	return 0;
}


Measured memory_bytes: 3240
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

double d_round(double frac, int digit) {
	double copy = frac * pow(10, digit - 1);
	copy = copy - (int)copy;
	return frac + (int)(copy + (copy > 0.5 ? 0.5 : 0));;
}

int main() {
	double a, b, c, d, e, f, x, y;
	cout << fixed << setprecision(3);
	while (cin >> a >> b >> c >> d >> e >> f) {
		x = (c * e - b * f) / (a * e - b * d);
		y = (c - a * x) / b;
		x = d_round(x, 4); y = d_round(y, 4);
		cout << x << " " << y << endl;
	}
	return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n ;
    vector<int> a(n);
    for ( int i = 0; i < n; i++ ) {
        cin >> a[i];
    }
    reverse(a.begin(), a.end());
    for ( int i = 0; i < n-1; i++ ){
        cout << a[i] << " ";
    }
    cout << a[n-1] << endl;
}


Measured memory_bytes: 3080
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a, b, c, d;
        a = Integer.parseInt(sc.next());
        b = Integer.parseInt(sc.next());
        c = Integer.parseInt(sc.next());
        d = Integer.parseInt(sc.next());
        int left = a + b;
        int right = c + d;
        if (left > right) {
            System.out.println("Left");
        } else if (left < right) {
            System.out.println("Right");
        } else {
            System.out.println("Balanced");
        }
        sc.close();
    }
}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

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

signed main(){
    init();
    run();
    return 0;
}

vvi g;
int n,k;

int dfs(int v,int u){
    int c=k-2;
    if(u==-1)c++;
    if(k<g[v].size())return 0;
    int ret=1;
    for(int e:g[v]){
        if(e==u)continue;
        ret*=c;
        ret%=mod;
        c--;
    }
    for(int e:g[v]){
        if(e==u)continue;
        ret*=dfs(e,v);
        ret%=mod;
    }
    return ret;
}

void run(){
    cin>>n>>k;
    g=vvi(n);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    int ans=k*dfs(0,-1)%mod;
    cout<<ans<<endl;
}

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

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!{
        n: usize,
        k: usize,
        s: usize,
    }
    let mut ans = Vec::with_capacity(n);
    ans.append(&mut vec![s; k]);
    if n - k >= s { ans.append(&mut vec![s + 1; n - k]); }
    else { ans.append(&mut vec![1; n - k]); }
    for a in ans { print!("{} ", a); }
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int h, w, k, ans = 0;
    cin >> h >> w >> k;
    vector<string> s(h);
    for (int i=0; i<h; i++) {
        cin >> s[i];
    }

    for (int i=0; i<(1<<h); i++) {
        for (int j=0; j<(1<<w); j++) {
            int cnt = 0;
            for (int y=0; y<h; y++) {
                if (!(i&(1<<y))) continue;
                for (int x=0; x<w; x++) {
                    if (!(j&(1<<x))) continue;
                    if (s[y][x] == '#') cnt++;
                }
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;
}


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

int main(){
  string s = "1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51";
  stringstream ss; ss << s;
  string buf;
  vector<string> v;
  ll k; cin >> k;
  while(getline(ss,buf,',')){
    v.push_back(buf);
  }
  cout << v[k-1];    
  

}

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

int main() {
	string S;
	cin >> S;
	int topping = 0;
	for (int i = 0; i <= 2; i++) {
		if (S[i] == 'o') topping += 100;
	}
	cout << 700 + topping;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
using namespace std;
 
int main () {
  int n;
  cin >> n;
  int t[n];
  for (int h = 0; h<n; h++){
    t[h] = h + 1;
  }
  int p[n];
  int q[n];
  for (int i = 0; i < n; i++){
    cin >> p[i];
  }
  for (int j = 0; j < n; j++){
    cin >> q[j];
  }
  int a = 0;
  int b = 0;
  bool fa = true;
  bool fb = true;
  int m = 1;
  do{
    for (int k=0; k<n; k++){
      if (t[k] != p[k]){
        fa = false;
      }
      if (t[k] != q[k]){
        fb = false;
      }
    }
    if (fa){
      a = m;
    } 
    if (fb) {
      b = m;
    }
    m ++;
    fa = true;
    fb = true;
  }while(next_permutation(t, t+n));
  
  cout << abs(a-b);
  return 0;
}

Measured memory_bytes: 256
N, M, Q = gets.split.map(&:to_i)
LRs = M.times.map{gets.split.map(&:to_i)}
PQs = Q.times.map{gets.split.map(&:to_i)}

a = LRs.each_with_object(Array.new(N + 1){Array.new(N + 1, 0)}){|(l, r), a| a[l][r] += 1}
[*1 .. N].repeated_permutation(2){|i, j| a[i][j] += a[i][j - 1] + a[i - 1][j] - a[i - 1][j - 1]}
PQs.each{|p, q| p -= 1; puts a[q][q] - a[p][q] - a[q][p] + a[p][p]}

Measured memory_bytes: 30200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    int k;
    sort(d.begin(), d.end());
    if (n % 2) {
        k = 0;
    } else {
        k = d.at(n / 2) - d.at(n / 2 - 1);
    }
    cout << k << endl;
    return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

char change(char c, int n) {
  if(c>='a' && c<='z') {
    if((int)(c-'a')>=n) return c-n;
    else {
      int d=n-(int)(c-'a')-1;
      if(d<26) return 'Z'-d;
      else return 'z'-(d-26);
    }
  } else {
    if((int)(c-'A')>=n) return c-n;
    else {
      int d=n-(int)(c-'A')-1;
      if(d<26) return 'z'-d;
      else return 'Z'-(d-26);
    }
  }
}
int main() {
  int n;
  while(cin >> n && n) {
    int a[n];
    rep(i,n) cin >> a[i];
    string s;
    cin >> s;
    rep(i,s.size()) s[i]=change(s[i],a[i%n]);
    pr(s);
  }
  return 0;
}


Measured memory_bytes: 1204
char buf[250000];sz;
char out[50505];outsz;
char tmp[10];tmpsz;
int d[5000];
main()
{
	read(0,buf,250000);
	int k=0,q=0;
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		k=k*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		q=q*10+c-'0';
	}
	for(int i=0;i<k;i++)
	{
		int D=0;
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			D=D*10+c-'0';
		}
		d[i]=D;
	}
	for(;q--;)
	{
		int N=0,X=0,M=0;
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			N=N*10+c-'0';
		}
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			X=X*10+c-'0';
		}
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			M=M*10+c-'0';
		}
		long B=X;
		for(int i=0;i<k;i++)
		{
			long y=d[i]%M;
			y+=!y*M;
			B+=(N-i-2+k)/k*y;
		}
		int ans=N-1-B/M+X/M;
		tmpsz=10;
		do{
			tmp[--tmpsz]=ans%10+'0';
		}while(ans/=10);
		for(;tmpsz<10;)out[outsz++]=tmp[tmpsz++];
		out[outsz++]='\n';
	}
	write(1,out,outsz);
}


Measured memory_bytes: 512
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

  double a = 380000, sum = 0;
  REP(i, n)
  {
    double x;
    string u;
    cin >> x >> u;
    sum += u == "BTC" ? x * a : x;
  }

  cout << sum << '\n';

  return 0;
}


Measured memory_bytes: 256
<?php

while (true) {
    fscanf(STDIN, '%d %d', $H, $W);
    if (!($H || $W)) { break; }

    $col = sprintf('%s%s', str_repeat('#', $W), PHP_EOL);
    $rects[] =  str_repeat($col, $H);
}

echo implode(PHP_EOL, $rects), PHP_EOL;

Measured memory_bytes: 6692
# reffer https://atcoder.jp/contests/tenka1-2019-beginner/submissions/5060831
N = int(input())
S = [1 if x == '.'  else 0 for x in list(input())]

cost = sum(S)
min_cost = cost

for i in range(N):
    if S[i] == 0:
        cost += 1
    else:
        cost -= 1

    if min_cost > cost:
        min_cost = cost

print(min_cost)


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

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

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

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

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

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    long double n;
    cin>>n;


    cout <<fixed<<setprecision(16)<< (n/3)*(n/3)*(n/3)<< endl;
    
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<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()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	string s;
	cin >> s;

	int ans = 0;
	rep(i, n - 2){
		if(s.substr(i, 3) == "ABC") ans++;
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  unordered_map<int,int> cnt;
  rep(i,n) {
    int a;
    cin >> a;
    if (cnt.count(a) == 0) cnt[a] = 0;
    cnt[a]++;
  }
  int ans = 0, dim = 0;
  for (auto p : cnt) {
    debug(p.first, p.second);
    if (p.second >= 2) {
      if (p.second % 2 == 0)  {
        if (dim > 0) {
          dim -= 1;
          p.second--; //1枚減らして奇数にする
        }
        else dim++; //他の1枚を減らして1枚にできる
      }
      ans++;
    }
    else ans++; //1枚にできる
  }
  debug(dim);
  ans -= dim;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4388
#include<iostream>
#include <cmath>

#define MAX 9223372036854775807LL;

int main()
{
    int N;
    int X[101];
    long long min = MAX;
    std::cin >> N;
    for (int i=0;i<N;i++)std::cin >> X[i];
    for (int p=1;p < 101;p++)
    {
        long long sum = 0;
        for (int i=0;i<N;i++)
        {
            sum += pow(X[i]-p,2);
        }
        if (sum < min) min = sum;
    }
    std::cout << min << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.util.OptionalInt;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.nextString();
            int[] cnt = new int[3];
            for (int i = 0; i < s.length(); i++) {
                cnt[s.charAt(i) - 'a']++;
            }

            int max = Arrays.stream(cnt).max().getAsInt();
            int min = Arrays.stream(cnt).min().getAsInt();

            out.println(max - min <= 1 ? "YES" : "NO");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 29012
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

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

int n;

int main() {
    cin >> n;

    ll res = 0;
    REP2(i, 1, n+1) REP2(j, 1, n+1) REP2(k, 1, n+1) {
        res += gcd(i, gcd(j, k));
    }

    cout << res << '\n';

    return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "No";
  if(a+b == c) ans = "Yes";
  if(b+c == a) ans = "Yes";
  if(c+a == b) ans = "Yes";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d;
  int p;
  p=1;
  cin>>a>>b>>c>>d;
  while(1)
  {
    if(p%2!=0)
    {c=c-b;}
    else
    {a=a-d;}
    if(a<=0)
    {cout<<"No";
    break;}
    if(c<=0)
    {cout<<"Yes";
    break;}
    p++;
  }
  return 0;
}
  


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    bool t = true;
    while (t){
        t = false;
        rep(i,n-2){
            if (s.substr(i,3) == "ABC"){
                t = true;
                ans++;
                s.replace(i,3,"");
                n -= 3;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a[300000],sum[300000],xsu[300000],ans;
int main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
	  scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++)
	  sum[i]=sum[i-1]+a[i];
	xsu[1]=a[1];
	for (int i=2;i<=n;i++)
	  xsu[i]=xsu[i-1]^a[i];
	ll l,r;
	l=r=1;
	while (l<=r && r<=n)
	{
		while (sum[r]-sum[l-1]!=(xsu[r]^xsu[l-1]))
		  l++;
		ans+=r-l+1;
		r++;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 6144
def v():
 import sys
 from collections import deque
 H,W,N=map(int,input().split())
 e='X'*(W+2)
 M=e+''.join('X'+e[:-1]+'X'for e in sys.stdin)+e
 m=(1,-1,W+2,-W-2)
 def f(s,g):
  p,t=s,0
  q=deque()
  b=[1]*len(M);b[s]=0
  while 1:
   for d in m:
    n=p+d
    if'X'!=M[n]and b[n]:
     if M[n]==g:return(n,t+1)
     b[n]=0;q.append([n,t+1])
   p,t=q.popleft()
 s=M.find('S')
 a=0
 for i in range(1,N+1):
  s,t=f(s,str(i))
  a+=t
 print(a)
if'__main__'==__name__:v()


Measured memory_bytes: 14816
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int n;
	double a,b,d;
	char c;
	cin >> n;
	for (;n>0;n--) {
	scanf("%lf%c%lf",&a,&c,&b);
	a= a>=12 ? a-12 : a;
	a=a*30+b*0.5; b*=6;
	if (a>b) { d=a; a=b; b=d;}
	b-=a;
	b= b>180 ? 360-b : b;
	if (b<30) cout << "alert" << endl; else
		if (b>=90) cout << "safe" << endl; else cout << "warning" << endl;
	}
return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#define N 801000
#define int long long
typedef long long ll;
template<typename T> inline void read(T &x) {
  x = 0; char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
}
using namespace std;
const int inf = 1e10;
inline void MIN(int &a, int b) {
  if (b < a)  a = b;
}
int n, q;
struct Edge{
  int u, v, w;
}E[N << 1];
int Etot;
bool cmp(const Edge &a, const Edge &b) {
  return a.w < b.w;
}
inline void Addedge(int x, int y, int w) {
  E[++Etot] = (Edge){x, y, w};
}
ll tag[N];
int fa[N];
int find(int cur) {
  return fa[cur] == cur ? cur : fa[cur] = find(fa[cur]);
}
signed main() {
  memset(tag, 0x3f, sizeof(tag));
  read(n), read(q);
  for (int i = 1; i <= q; ++i) {
    int a, b, c;
    read(a), read(b), read(c);
    Addedge(a, b, c);
    MIN(tag[a], c + 1);
    MIN(tag[b], c + 2);
  }
  int np = 0, nw = inf;
  for (int i = 1; i <= n + n; ++i) {
    MIN(nw, tag[np]);
    MIN(tag[np], nw);
    int nxt = (np + 1) % n;
    Addedge(np, nxt, nw);
    np = nxt; nw += 2;
  }
  for (int i = 1; i <= n; ++i)  fa[i] = i;
  ll ans = 0;
  sort(E + 1, E + 1 + Etot, cmp);
  for (int i = 1; i <= Etot; ++i) {
    int u = E[i].u, v = E[i].v;
    ++u; ++v;
    u = find(u), v = find(v);
    if (u == v) continue;
    ans += E[i].w; fa[u] = v;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 28172
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, H, M):
    s = [0, A]
    l = [0, B]
    sr = -2*math.pi * (H*60+M) / (12*60)
    lr = -2*math.pi * (M) / (60)

    s = [-math.sin(sr)*s[1],
         math.cos(sr)*s[1]]
    l = [-math.sin(lr)*l[1],
         math.cos(lr)*l[1]]
    return math.sqrt((s[0]-l[0])**2 + (s[1]-l[1])**2)


def main():
    A, B, H, M = read_int_n()
    print(slv(A, B, H, M))


if __name__ == '__main__':
    main()


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

int main()
{
    int N = 0;
    scanf("%d",&N);
    struct point{
        int timet;
        int xt;
        int yt;
    };
    struct point *information = (struct point *)malloc((N + 1) * sizeof(struct point));
    information[0].timet = 0;
    information[0].xt = 0;
    information[0].yt = 0;
    for(int i = 1;i <= N;i++)
    {
        scanf("%d",&(information[i].timet));
        scanf("%d",&(information[i].xt));
        scanf("%d",&(information[i].yt));
    }
    int can_or_not = 1;
    for(int i = 1;i <= N && can_or_not == 1;i++)
    {
        if(information[i].timet - information[i - 1].timet < abs(information[i].xt - information[i - 1].xt) + abs(information[i].yt - information[i - 1].yt))
        {
            can_or_not = 0;
            break;
        }
        else
        {
            if( (information[i].timet - information[i - 1].timet)  % 2 != (abs(information[i].xt - information[i - 1].xt) + abs(information[i].yt - information[i - 1].yt)) % 2)
            {
                can_or_not = 0;
                break;
            }
            
        }
    }
    if(can_or_not == 1)
    {
        printf("Yes");
    }
    else if(can_or_not == 0)
    {
        printf("No");
    }
    free(information);
    return 0;
}


Measured memory_bytes: 1280
s = list(input())
t = ''
cnt = len(s) - 1
while cnt >= 0:
    if s[cnt] == 'm':
        t = 'dream' + t
        cnt -= 5
        continue
    if s[cnt] == 'e':
        t = 'erase' + t
        cnt -= 5
        continue
    if s[cnt] == 'r':
        if cnt - 2 >= 0 and s[cnt - 2] == 'm':
            t = 'dreamer' + t
            cnt -= 7
            continue
        elif cnt - 2 >= 0 and s[cnt - 2] == 's':
            t = 'eraser' + t
            cnt -= 6
            continue
    break
s = ''.join(s)
if s == t:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 4140