akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  int l = 0 , r = n - 1;
  int ans = 0;
  while(l < r) {
    if(s[l] == 'W' && s[r] == 'R') {
      ans++;
      swap(s[l] , s[r]);
    }
    if(s[l] == 'R') l++;
    if(s[r] == 'W') r--;
  }
  // dg1(ans);
  // dg1(s);
  // int cntw = 0 , cntr = 0;
  // bool W = false , R = false;
  // for(char i : s) {
  //   if(W && i == 'R') cntr++;
  //   if(i == 'W') W = true;
  //   if()
  // }
  // ans += min(cntw , cntr);
  cout << ans << '\n';
} 

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

bool isprime(int p){
	bool f=1;
	for(int i=2;i<=sqrt(p);i++){
		if(p%i==0) f=0;
	}
	return f;
}

int main(){
  int N;
  cin>>N;
  int p=16;
  cout<<11;
  while(1){
	if(N==1) break;
	if(isprime(p)){
		N-=1;
		cout<<" "<<p;
		p+=5;
	}
	else p+=5;
  }
  cout<<endl;				  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int dp[210][100010];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x;
    cin >> n >> x;
    vector<int> s(n);
    rep(i, 0, n){
        cin >> s[i];
    }
    sort(s.rbegin(), s.rend());
    dp[0][x] = 1;
    rep(i, 0, n){
        rep(j, 0, 100001){
            if(dp[i][j] == 0) continue;
            (dp[i + 1][j % s[i]] += dp[i][j]) %= mod;
            (dp[i + 1][j] += dp[i][j] * (n - 1 - i) % mod) %= mod;
        }
    }
    int ans = 0;
    rep(i, 0, 100001){
        (ans += i * dp[n][i] % mod) %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 156032
#include <stdio.h>

int main(void) {
  double a, be, ans;
  int i;
  while(scanf("%lf", &a) != EOF) {
    be = a, ans = a;
    for(i = 1; i < 10; ++i) {
      if(i % 2) be *= 2.0;
      else be /= 3.0;
      ans += be;
    }
    printf("%.12lf\n", ans);
  }
  return 0;
}


Measured memory_bytes: 2584
#include <stdio.h>
int main(){
   
  int a,b,c,x,y,z;
   
  scanf("%d%d%d",&a,&b,&c);
   
  if(a>b){ 
    x=a;
    a=b;
    b=x;
  }
   
  if(b>c){
    y=b;
    b=c;
    c=y;
  }
   
  if(a>b){
    z=a;
    a=b;
    b=z;
  }
   
  printf("%d %d %d\n",a,b,c);
   
  return 0;
}

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

int a[9999];
int b[9999];
int c[10000];
int res[10000];

using namespace std;

int main(void) {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> a[i];
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    res[i] = 0;
    sum += c[i];
  }
  sort(c, c+n);

  res[a[0] - 1] = c[n - 1];
  res[b[0] - 1] = c[n - 2];
  sum -= c[n - 1];

  for (int i = n - 3; i >= 0; i--) {
    int j = 0;
    for (int j = 0; j < n - 1; j++) {
      if (res[a[j] - 1] != 0 && res[b[j] - 1] == 0) {
        res[b[j] - 1] = c[i];
        break;
      }
      if (res[a[j] - 1] == 0 && res[b[j] - 1] != 0) {
        res[a[j] - 1] = c[i];
        break;
      }
    }
  }
  cout << sum << endl;
  //cout << 10 << endl;
  for (int i = 0; i < n; i++) {
    if (i != 0) cout << " ";
    cout << res[i];
    //cout << i + 1;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int N = sc.nextInt();
        long t = sc.nextLong();
        long a = sc.nextLong();

        for (int i = 1; i < N; i++) {
            int T = sc.nextInt();
            int A = sc.nextInt();

            var tdiv = t / T;
            if (t % T != 0) tdiv++;
            var adiv = a / A;
            if (a % A != 0) adiv++;
            var div = Math.Max(tdiv, adiv);

            t = div * T;
            a = div * A;
        }

        WriteLine(t + a);
    }
}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int n; cin >> n;

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

    vector<ll> sum_l(2 * n + 1, 0);
    priority_queue<ll, vector<ll>, greater<ll> > que_l;
    for (int i = 0; i < n; ++i) {
        sum_l[i + 1] = sum_l[i] + a[i];
        que_l.push(a[i]);
    }
    for (int i = n; i < 2 * n; ++i) {
        ll tmp = que_l.top();
        if (a[i] > tmp) {
            sum_l[i + 1] = sum_l[i] - tmp + a[i];
            que_l.pop();
            que_l.push(a[i]);
        }
        else{
            sum_l[i + 1] = sum_l[i];
        }
    }

    vector<ll> sum_r(2 * n + 1, 0);
    priority_queue<ll> que_r;
    for (int i = 0; i < n; ++i) {
        sum_r[i + 1] = sum_r[i] + a[3 * n - 1 - i];
        que_r.push(a[3 * n - 1 - i]);
    }
    for (int i = n; i < 2 * n; ++i) {
        ll tmp = que_r.top();
        if (a[3 * n - 1 - i] < tmp) {
            sum_r[i + 1] = sum_r[i] - tmp + a[3 * n - 1 - i];
            que_r.pop();
            que_r.push(a[3 * n - 1 - i]);
        }
        else sum_r[i + 1] = sum_r[i];
    }

    ll ans = -1 * INF64;
    for (int i = n; i <= 2 * n; ++i) {
        ans = max(ans, sum_l[i] - sum_r[3 * n - i]);
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 6900
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define pll pair<lli, lli>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mpr  make_pair
#define ss  second
#define ff  first
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int tc;cin>>tc;while(tc--)
#define clean(x) memset(x,0,sizeof(x))
const lli maxn = 1e5+9;
vector<lli> catlan(int n) {
    vector<lli> dp(n + 1, 0);
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= n; i ++) {
        for (int j = 0; j < i; ++ j) {
            dp[i] += dp[j] * dp[i - j - 1];
        }
    }
    return dp;
}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli set_bits(lli n)
{
    int c=0;
    if(n==0)return 0;
    while(n)
    {
        if((n&1)==1)
        {
           cout<<c<<" ";
        }
        c++;
        n=n>>1;
    }
    return c;
}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///
map<int,int>m;
void solve()
{
    lli n;cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;cin>>a;
        m[a]++;
    }
    priority_queue<int>q;
    int c=0;
    for(pii i:m)
    {
        if(i.ss>1)q.push(-i.ss);
        else if(i.ss==1)c++;
    }
    while(!q.empty())
    {
        int x=-1*q.top();
        int y;
        q.pop();
        if(!q.empty())
        {
            y=-1*q.top();
            q.pop();
        }
        else
        {
            if(x%2==1)c++;
            break;
        }
        int z=min(x-1,y-1);
        x-=z,y-=z;
        if(x==1)c++;
        if(y==1)c++;
        if(x>1)q.push(-x);
        if(y>1)q.push(-y);
    }
    cout<<c<<endl;

}
int main()
{
    FAST;
    //int tc=1;cin>>tc;while(tc--)solve();
    solve();
}



Measured memory_bytes: 8296
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test1 {

    


    class ClassMain {


        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                //if (line.Equals("0")) { break; }
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int h = ints[0], w = ints[1];
                if (h == 0) { break; }
                int[,] hidariMax = new int[h, w];
                int maxRect = 0;
                for (int i = 0; i < h; i++) {
                    line = Console.ReadLine();
                    char[] chrs = line.ToCharArray();
                    for (int j = 0; j < w; j++) {
                        if (chrs[j] == '*') {
                            hidariMax[i, j] = 0;
                        }
                        else {//chars[j] == '.'
                            if (j == 0) { hidariMax[i, j] = 1; }
                            else { hidariMax[i, j] = hidariMax[i, j - 1]+1; }
                            //Console.Write("HM" + hidariMax[i, j]);
                            int widthMax = hidariMax[i,j];
                            for (int k = i; k >= 0; k--) {
                                if (hidariMax[k, j] == 0) { break; }
                                widthMax = Math.Min(widthMax, hidariMax[k, j]);
                                int rectMenseki = widthMax * (i - k + 1);
                                if (rectMenseki > maxRect) { maxRect = rectMenseki; }
                            }
                        }//else chars[j]=='.'
                    }//for j  0-w
                }//for i 0-h
                Console.WriteLine(maxRect);
            }
        }

        
    }



    
}

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

int main(){
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> P(N),A(Q);
  for(int i=0;i<Q;i++){
    cin >> A.at(i);
    P.at(A.at(i)-1)++;
  }
  for(int i=0;i<N;i++){
    if(K-Q+P.at(i)>0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 1408
n= int(input())
ls={}
ma=0
for i in range(n):
  s=input()
  if s in ls:
    ls[s]+=1
  else:
    ls[s]=1
  if ma<ls[s]:
    ma=ls[s]
  
ans=[]
for i in ls.keys():
  if ls[i]==ma:
    ans.append(i)
    
ans.sort()
for j in ans:
  print(j)

  

Measured memory_bytes: 35276
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void){
	
	int N, A, B;
	int ca = 0, cb = 0;
	string S;

	cin >> N >> A >> B;
	cin >> S;

	for (int i = 0; i < N; i++) {
		if (S[i] == 'a') {
			if (ca+cb < A + B) {
				cout << "Yes" << endl;
				ca++;
			}
			else
				cout << "No" << endl;
		}

		else if(S[i] == 'b'){
			if (ca+cb < A + B && cb < B) {
				cout << "Yes" << endl;
				cb++;
			}
			else
				cout << "No" << endl;
		}
		else
			cout << "No" << endl;
	}
	
	return 0;
}



Measured memory_bytes: 896
#include <cstdio>
#include <algorithm>
typedef long long LL;
typedef unsigned long long ULL;
const int MAXN = 100005;
const int P = 1000000007;
const double eps = 1e-6;
using namespace std;
inline int getint() {
    int r = 0; bool b = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') b = false; c = getchar(); }
    while (c >= '0' && c <= '9') { r = (r<<1)+(r<<3) + c - '0'; c = getchar(); }
    return b ? r : -r;
}
int n;
int x[MAXN], y[MAXN];
int cnt;
LL mx[MAXN];
char dst[MAXN];
int main() {
    n = getint();
	for (int i = 0; i < n; ++i) {
		x[i] = getint();
		y[i] = getint();
	}
	int b = (abs(x[0] + y[0]) & 1);
	for (int i = 1; i < n; ++i)
		if ((abs(x[i] + y[i]) & 1) != b) {
			puts("-1");
			return 0;
		}
	printf("%d\n", 32 - b);
	dst[0] = 1;
	if (b == 0) printf("1 ");
	mx[0] = 1;
	for (int i = 1; i < 31; ++i)
		mx[i] = mx[i-1] << 1ll;
	for (int i = 0; i < 31; ++i)
		printf("%d ", (1<<i));
	putchar('\n');
	for (int i = 0; i < n; ++i) {
		LL X = x[i], Y = y[i];
		if (b == 0) {
			putchar('R');
			--X;
		}
		cnt = 0;
		for (int j = 30; j >= 0; --j) {
			if (abs(X + LL(1ll<<j)) + abs(Y) < mx[j]) {
				dst[++cnt] = 'L';
				X += LL(1ll<<j);
				continue;
			}
			if (abs(X - LL(1ll<<j)) + abs(Y) <= mx[j]) {
				dst[++cnt] = 'R';
				X -= LL(1ll<<j);
				continue;
			}
			if (abs(X) + abs(Y + LL(1ll<<j)) <= mx[j]) {
				dst[++cnt] = 'D';
				Y += LL(1ll<<j);
				continue;
			}
			if (abs(X) + abs(Y - LL(1ll<<j)) <= mx[j]) {
				dst[++cnt] = 'U';
				Y -= LL(1ll<<j);
				continue;
			}
		}
		for (int j = cnt; j >= 1; --j) putchar(dst[j]);
		putchar('\n');
	}
}


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

long long ans;

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        long long tmp=n/i;
        ans+=(1+tmp)*tmp/2*i;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
int main(){
    int n;cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    int ans =0;
    rep(i,n){
        if((i+1)%2&&a[i]%2)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define ll long long
using namespace std;

int main()
{
	string str;
	int k, ans;

	cin >> k >> str;
	ans = 0;


	for (int i = 0; i < k - 2; i++) {
		if (str[i] == 'A' && str[i + 1] == 'B' && str[i + 2] == 'C') {
			ans++;
		}
	}

	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
import math

a,b,x = map(int,input().split())

if a*a*b == x:
    print(0)
elif a*a*b < 2*x:
    print(90-math.degrees(math.atan(a**3/(2*(a*a*b-x)))))
else:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))



Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;

int main(){
    long long int a,b;
    cin >> a >> b;
    for(int i=1;i<=b;i++){
        if((a*i)%b==0){
                cout << a*i << endl;
                break;
        }
    }
}



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

using namespace std;
int main() {
    string S;
    cin >> S;
    if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) {
        cout << "Yes" << endl;
    } else if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) {
        cout << "Yes" << endl;
    } else if(S[0] == S[3] && S[1] == S[2] && S[0] != S[1]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

int main(int argc, char *argv[]){
  char str[1001];
  int pos = 0;
  int len;
  int state = 0;
  
  scanf("%[^\n]s",str);
  len = strlen(str);
  
  while(pos < len){
    if(str[pos] == 'a'){
      if((pos+4) < len){
        if(str[pos+1] == 'p' && str[pos+2] == 'p' && str[pos+3] == 'l' && str[pos+4] == 'e'){
          str[pos] = 'p';
          str[pos+1] = 'e';
          str[pos+2] = 'a';
          str[pos+3] = 'c';
          str[pos+4] = 'h';
          pos += 4;
        }
      }
    }else if(str[pos] == 'p'){
      if((pos+4) < len){
        if(str[pos+1] == 'e' && str[pos+2] == 'a' && str[pos+3] == 'c' && str[pos+4] == 'h'){
          str[pos] = 'a';
          str[pos+1] = 'p';
          str[pos+2] = 'p';
          str[pos+3] = 'l';
          str[pos+4] = 'e';
          pos += 4;
        }
      }
    }

    pos++;
  }

  printf("%s\n",str);
  
  return 0;    
}

Measured memory_bytes: 0
#include<stdio.h>
#include<math.h>
int main()
{
	int i,a;
	double k,d=100000;

	scanf("%d",&a);
	
	for(i=0;i<a;i++)
	{
		d=d*1.05;
		d=d/1000;
		d=ceil(d);
		d=d*1000;
	}
	
	printf("%d\n",(int)d);
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
//tourist写経
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  map<int,int> cnt;
  rep(i,n){
      cin >> a[i];
      ++cnt[a[i]];
  }
  if (cnt[0] == n) {
      cout << "Yes" << endl;
      return 0;
  }
  vector<int> all;
  for (auto& e : cnt) {
    rep(i,e.second / (n / 3)) {
        all.push_back(e.first);
    }      
  }
  if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
      cout << "Yes" << endl;
  } else {
      cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 4224
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

from collections import defaultdict 
import math 

n = int(input())
if n >=30:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 9456
n, m = gets.split(" ").map(&:to_i)

def factorial(n)
  num = 1
  (1..n).each do |i|
    num = (num * i) % (10**9 + 7)
  end
  num
end

if n == m
  puts (factorial(n) * factorial(m) * 2) % (10**9 + 7)
elsif (n - m).abs == 1
  puts (factorial(n) * factorial(m)) % (10**9 + 7)
else
  puts 0
end

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> mp;
    for (auto& x : a) {
        cin >> x;
        mp[x]++;
    }
    vector<int> errased;
    for (const auto& cur : mp) {
        if (cur.second < 2) {
            errased.push_back(cur.first);
        }
    }

    for (int x : errased)
        mp.erase(x);

    if (mp.size() < 2) {
        cout << 0 << endl;
        return 0;
    }

    auto it = mp.end();
    --it;

    int l2 = it->first;
    it->second -= 2;
    if (it->second < 2) {
        mp.erase(it->first);
    }

    if (mp.empty()) {
        cout << 0 << endl;
        return 0;
    }

    it = mp.end();
    --it;

    int l1 = it->first;

    cout << (long long)l1 * l2 << endl;
}

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

using namespace std;

#ifdef Lin1043
    #define DEBUG(msg, ...) printf("(%s #%d) " msg, __FUNCTION__, __LINE__, __VA_ARGS__)
    #define massert(...) assert(...)
#else
    #define DEBUG(...)
    #define massert(...)
#endif

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i )
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i )

struct iopener
{
    iopener()
    {
#ifdef Lin1043
        freopen("./in" , "r" , stdin);
#endif
    }
} iop;

typedef long long LL;

template<typename T>inline bool chkmin(T &x , const T &y) { return x > y ? (x = y , 1) : 0; }
template<typename T>inline bool chkmax(T &x , const T &y) { return x < y ? (x = y , 1) : 0; }

template<typename T>inline T read(T &f)
{
    f = 0; int x = 1 ; char c = getchar();
    while(!isdigit(c)) x = (c == '-' ? -1 : 1) , c = getchar();
    while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
    return f = x * f;
}

const int N = 100000 + 5;

int n , m , u , v , Ans , A[N] , dep[N];

struct Edge
{
    int to ; Edge *nxt;
} E[N << 1] , *pre[N];

void addedge(int u , int v)
{
    static int tot = 0;
    E[++tot] = (Edge){v , pre[u]} , pre[u] = &E[tot];
    E[++tot] = (Edge){u , pre[v]} , pre[v] = &E[tot];
}

void dfs(int u , int fa)
{
    dep[u] = 1;
    for(Edge *i = pre[u] ; i ; i = i->nxt)
    {
        int v = i->to;
        if(v == fa) continue ;
        dfs(v , u); //  , u);
        chkmax(dep[u] , dep[v] + 1);
    }
    if(dep[u] >= m && A[u] != 1)
    {
        Ans++ , dep[u] = 0;
    }
}

int main()
{
    read(n) , read(m);
    rep(i , 1 , n)
    {
        read(v) , u = i ;
        A[i] = v;
        if(i != 1) addedge(v , u);
    }
    if(A[1] != 1) Ans++ , A[1] = 1;
    dfs(1 , 0);
    cout << Ans << endl;
    return 0;
}



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

int main() {
	int N, Q = 0;
	cin >> N;

	vector<int> L(N);
	for (int i = 0; i < N; i++) cin >> L.at(i);

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

	for (int i = 0; i < N; i++) {
		if (i == N - 1) {
			break;
		}
		else Q += L.at(i);
	}

	int& back = L.back();
	if (Q > back) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

ll dp[210][100010];

int main(){
    int n, x; cin >> n >> x;
	vector<int> s(n);
	for( auto &k : s ) cin >> k;
	sort( s.begin(), s.end() );
	for( int k = 0; k <= x; ++k ){
		dp[0][k] = k; 
	}
	for( int i = 0; i < n; ++i ){
		for( int k = 0; k <= x; ++k ){
			dp[i+1][k] = dp[i][k]*i % mod + dp[i][k%s[i]];
			dp[i+1][k] %= mod;
		}
	}
	/* for( int i = 0; i <= n; ++i ){
		for( int k = 0; k <= x; ++k ){
			cout << dp[i][k] << ' ';
		} cout << endl;
	} */
	cout << dp[n][x] << endl;
}

Measured memory_bytes: 157952
x,y,a,b,c=[int(j) for j in input().split()]
p=[int(j) for j in input().split()]
q=[int(j) for j in input().split()]
r=[int(j) for j in input().split()]
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p=p[:x]
q=q[:y]
l=p+q
l.sort()
ans=sum(l)
for i in l:
    if i<r[0]:
        ans+=r[0]-i
        del r[0]
        if r==[]:
            break
print(ans)






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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<int> a(200001);
	rep(i,n){
		int x;
		cin >> x;
		a.at(x)++;
	}
	sort(a.begin(),a.end());
	int cnt=0;
	rep(i,200001){
		if(a.at(i)) cnt++;
	}
	int ans=0;
	rep(i,200001){
		if(cnt<=k) break;
		if(a.at(i)){
			ans+=a.at(i);
			cnt--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	int a=0,b=0;
	cin >> a >> b ;
	if(a>b)
		cout << "a > b" << endl;
	else if(a==b)
		cout << "a == b" << endl;
	else if(a<b)
		cout << "a < b" << endl;
	return 0;
}

Measured memory_bytes: 1160
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
using namespace std;

char s[110];

int main(void)
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    scanf("%s",s);
    int l=strlen(s),l1,l2,f,f1,f2;l1=(l-1)/2;l2=(l+3)/2;f=f1=f2=1;
    for(int i=0;i<l/2;i++)
        if(s[i]!=s[l-1-i])
        {
            f=0;break;
        }
    for(int i=0;i<l1/2;i++)
        if(s[i]!=s[l1-1-i])
        {
            f1=0;break;
        }
    for(int i=l2;i<l;i++)
        if(s[i]!=s[l-1-i])
        {
            f2=0;break;
        }
    if(f1&&f2&&f)printf("Yes\n");
    else printf("No\n");

    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,m;
	cin>>n>>m;
	cout<<(n*500>=m?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int X[] = new int[M];
    for(int a=0; a<M; a++) {
      X[a] = 0;
    }
    int K;
    int count =0;
    
    for(int i=0; i<N; i++) {
      K = sc.nextInt();
      int A;
      for(int j=0; j<K; j++) {
        A = sc.nextInt();
        X[A-1]++;
      }
    }
    for(int k=0; k<M; k++) {
      if(X[k] == N) {
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 22868
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] tx = RIntAr();
            decimal t = tx[0];
            decimal x = tx[1];
            Console.WriteLine(t/x);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


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

int arr[32] = {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
}, k;

int main() {
  cin>>k;
  cout<<arr[k-1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, y;
  cin >> x >> y;
  int n = 0;
  if(x == 1)n += 300000;
  if(y == 1)n += 300000;
  if(x == 2)n += 200000;
  if(y == 2)n += 200000;
  if(x == 3)n += 100000;
  if(y == 3)n += 100000;
  if(x == y){
    if(x == 1)n += 400000;
  }
  cout << n << endl;
}

Measured memory_bytes: 3620
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
op = ""
for i in range(y):
    op += "U"
for i in range(x):
    op += "R"
for i in range(y):
    op += "D"
for i in range(x):
    op += "L"
op += "L"
for i in range(y + 1):
    op += "U"
for i in range(x + 1):
    op += "R"
op += "DR"
for i in range(y + 1):
    op += "D"
for i in range(x + 1):
    op += "L"
op += "U"
print(op)


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

//typedef long long ll;

int main(){
    int N,H;
    cin>>N>>H;

    vector<int> A(N);
    vector<int> B(N);

    for(int i=0;i<N;i++){
        cin>>A.at(i)>>B.at(i);
    }
    //
    sort(B.begin(),B.end());
    reverse(B.begin(),B.end());
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    
    int cnt=0;

    for(int i=0;i<N;i++){
        if(B.at(i)>A.at(0) && H>0){
            cnt++;
            H-=B.at(i);
        }
        else{
            break;
        }
    }
    if(H<=0){
        cout<<cnt<<endl;
    }
    else if(H%A.at(0)==0){
        cout<<cnt+H/A.at(0)<<endl;
    }
    else{
        cout<<cnt+1+H/A.at(0)<<endl;
    }
}

Measured memory_bytes: 1152
while True:
  n = int(input())
  if n == 0:
    break
  lst = [0] * n
  ss = input()
  field = 0
  for i in range(100):
    ind = i % n
    if ss[i] == "M":
      lst[ind] += 1
      continue
    if ss[i] == "S":
      field += lst[ind] + 1
      lst[ind] = 0
      continue
    if ss[i] == "L":
      lst[ind] += field + 1
      field = 0
      continue
  lst.sort()
  lst += [field]
  print(*lst)


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

int main() {
    int a, b;
    
    cin >> a >> b;
    
    if (a == 1) {
        a = 14;
    }
    
    if (b == 1) {
        b = 14;
    }
    
    cout << ((a == b) ? "Draw" : ((a > b) ? "Alice" : "Bob")) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define line cout<<"----------------------------"<<endl
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
#define bug(x) cerr << "[" << #x << "] = ["<<x<<"]"<<'\n'
using namespace std;
int  main()
{
    ll n;
    cin>>n;
    ll sum=0;
    ll d=1;
    while(d<=n) sum+=d,d*=2;
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

using pll = pair<ll, ll>;
vector<pll> v;
queue<pll> que;

int main(){
	int n; ll d, a; scanf("%d%lld%lld", &n, &d, &a);
	REP(i, n){
		ll x, h; scanf("%lld%lld", &x, &h);
		v.EB(x, h);
	}
	sort(ALL(v));
	ll m = 0, ans = 0;
	for(auto &p : v){
		ll x = p.first, h = p.second;
		while(que.size() && que.front().first < x) {
			m -= que.front().second;
			que.pop();
		}
		h -= m;
		ll cnt = (max(h, 0LL) + a - 1) / a;
		ans += cnt;
		m += cnt * a;
		que.emplace(x + 2 * d, cnt * a);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 7148
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////


int main() {
	ll H, W;

	cin >> H >> W;

	char A[10][10];

	repn(i, H)repn(j, W) cin >> A[i][j];

	ll c=0;

	repn(i, H)repn(j, W) if (A[i][j] == '#') { c++; }

	if (c == H + W - 1) { cout << "Possible"; }
	else { cout << "Impossible"; }


	system("PAUSE");

}





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

using namespace std;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}

#define ANTHRO(args...) {__anthro_begin(__LINE__); __anthro(split(#args, ',').begin(), args);}

inline void __anthro_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __anthro_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __anthro_out_var(T* val) { cerr << arrStr(val,2); } //Change the values in case you want to debug something
template<typename T> inline void __anthro_out_var(T val) { cerr << val; }
inline void __anthro(vector<string>::iterator it) { cerr << endl; }

template<typename T, typename... Args>
inline void __anthro(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __anthro_out_var(a);
    cerr << "; ";
    __anthro(++it, args...);
}
//Simple Debugger

#define ll long long
#define MOD 1000000007
#define EPS 1e-9
int const INF = (int)1e9 + 1e3;
ll const INFL = (ll)1e18 + 1e6;
/*
    This is B-Frog2 from AtcoderJP
*/

int main(){
    ll n,k; cin>>n>>k;
    vector<ll> ar(n+1);
    for(ll i=1;i<=n;i++) cin>>ar[i];
    vector<ll> dp(n+1,INF);
    dp[1]=0;
    for(ll i=1;i<=n;i++){
        for(ll j=i+1;j<=i+k;j++){
            if(j<=n){
                dp[j]=min(dp[j],dp[i]+abs(ar[i]-ar[j]));
            }
        }
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
bool flag = false;

string dfs(int sum){
	if(sum >= n){
		if(sum == n) flag = true;
		else flag = (flag || false);

		return("");
	}

	for(int i = 0; i < 2; i++){
		if(i == 0)dfs(sum + 7);
		else dfs(sum + 4);
	}

	return(((flag)? "Yes" : "No"));
}

int main(){
	cin >> n;
	cout << dfs(0) << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define double long double
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    vector<pll>aa(n);
    rep(i,n){
        ll a;cin>>a;
        aa[i]=mp(a,i);
    }
    sort(all(aa));
    rep(i,n)cout<<aa[i].second+1<<' ';
}

Measured memory_bytes: 2432
#include <iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<utility>
#include<functional>
#include<iomanip>
#include<sstream>
#include<ctime>
#include<cassert>
#include<string>

using namespace std;

int main(int argc, char ** argv) {
	//string str;
	//int k = 0;

	//cin >> str;
	//cin >> k;

	//int strSize = str.size();

	//for (int i = 0; i < strSize; ++i) {
	//	char ch = str.at(i);
	//	int dist = 'z' - ch + 1;
	//	if (k >= dist) {
	//		str.at(i) = 'a';
	//		k -= dist;
	//	}	
	//}

	//k = k % 26;
	//int dist = 'z' - str.at(strSize - 1);
	//str.at(strSize - 1) = (k > dist) ? ('a' + k - dist - 1) : str.at(strSize - 1) + k;


	//cout << str << endl;


	int N = 0;
	vector <int> *ptrV = new vector<int>();
	cin >> N;
	while (N--) {
		int tmp = 0;
		cin >> tmp;
		ptrV->push_back(tmp);
	}

	int cnt = 0;
	int sizeV = ptrV->size();
	for (int i = 0; i < sizeV; ++i) {
		int num = ptrV->at(i);
		if (num == -1) continue;
		if (ptrV->at(num - 1) == i + 1) {
			ptrV->at(num - 1) = -1;
			cnt++;
		}
		ptrV->at(i) = -1;
	}

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 1020
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, c := readInt(), readInt(), readInt()
	x, y := readInt(), readInt()

	ans := 0
	if a+b > c*2 {
		if x > y {
			ans = y * 2 * c
			x -= y
			if x*a > x*2*c {
				ans += x * 2 * c
			} else {
				ans += x * a
			}
		} else {
			ans = x * 2 * c
			y -= x
			if y*b > y*2*c {
				ans += y * 2 * c
			} else {
				ans += y * b
			}
		}
	} else {
		ans = x*a + y*b
	}
	fmt.Println(ans)
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();         

            //create result string
            char result1;
            char result2;

            int cnt1 = 0;
            int cnt2 = 0;

            for(int i = 0; i < input.Length; i++)
            {
                result1 = i % 2 == 0 ? '0': '1';
                result2 = i % 2 == 0 ? '1': '0';

                if(input[i] != result1)
                {
                    cnt1++;
                }
                else
                {
                    cnt2++;
                }
            }

            Console.WriteLine(Math.Min(cnt1, cnt2));
        }      
    }
}


Measured memory_bytes: 13144
using System;

namespace CSsample
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            var x = input.Split(' ');
            int A = int.Parse(x[0]);
            int B = int.Parse(x[1]);
            int C = int.Parse(x[2]);

            if(A == B && B == C){
                Console.WriteLine("Yes");
            }else {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14

int main(){
    ll t1, t2, a1, a2, b1, b2; cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
    ll a = t1*a1+t2*a2;
    ll b = t1*b1+t2*b2;
    ll af = t1*a1;
    ll bf = t1*b1;
    if (a>b&&af>=bf){
        cout << 0 << endl;
    }
    else if (a>b&&af<bf){
        ll z = (bf-af)/(a-b);
        if ((bf-af)==(a-b)*z) cout << 2*z << endl;
        else cout << 2*z+1 << endl;

    }
    else if (a==b){
        cout << "infinity" << endl;
    }
    else if (a<b&&af<=bf){
        cout << 0 << endl;
    }
    else{
        ll z = (af-bf)/(b-a);
        if ((af-bf)==(b-a)*z) cout << 2*z << endl;
        else cout << 2*z+1 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;;
int main(){
	int s[33]={0,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};
	int n;
	cin>>n;
	cout<<s[n];
	return 0;	
} 

Measured memory_bytes: 256
#include <stdio.h>

struct chars {
	char ori ;
	char aft ;
} data[100000] ;

int n ;

int main ( )
{
	while ( scanf ( "%d" , &n ) == 1 && n ) {
		getchar ( ) ;
		for ( int i = 0 ; i < n ; i++ ) {
			scanf ( "%c%*c%c%*c" , &data[i].ori , &data[i].aft ) ;
		}
		int m ;
		char c ;
		scanf ( "%d" , &m ) ;
		getchar ( ) ;
		for ( int i = 0 ; i < m ; i++ ) {
			c = getchar ( ) ;
			getchar ( ) ;
			for ( int j = 0 ; j < n ; j++ ) {
				if ( data[j].ori == c ) {
					c = data[j].aft ;
					break ;
				}
			}
			putchar ( c ) ;
		}
		putchar ( '\n' ) ;
	}
	return 0 ;
}

Measured memory_bytes: 1000
# 操作回数（N）および数を求めたい順位（K）を入力する
N, K = map(int, input().split())
# 挿入する整数（a）とその個数（b）の組を格納するリスト（list_ab）を定義する
list_ab = []
# 各操作において、、
for _ in range(N):
    # aおよびbを入力する
    a, b = map(int, input().split())
    # list_abにaとb個の組を追加する
    list_ab.append((a, b))
# list_abをaが昇順に並ぶようにソートする
list_ab.sort()
# bの合計を計算する変数（sum_b）を定義する
sum_b = 0
# 各a、bの組について、、
for a, b in list_ab:
    # sum_bにbを足す
    sum_b += b
    # sum_bがK以上になった場合、、
    if sum_b >= K:
        # aを出力する
        print(a)
        break

Measured memory_bytes: 16944
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
using namespace std;

using P = pair<int, int>;
using dp1P = P;

const int MAX_M = 1000010;

bool prime_table[MAX_M];
map<P, int> cave;
P num2pos[MAX_M];
bool used[MAX_M];

int dp1[MAX_M],
    dp2[MAX_M];

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

void sieve() {
    for (int i = 2; i < MAX_M; i++) {
        prime_table[i] = true;
    }
    for (int m = 2; m * m <= MAX_M; m++) {
        if (prime_table[m]) {
            for (int i = 2; i * m < MAX_M; i++) {
                prime_table[i * m] = false;
            }
        }
    }
}

int main() {
    // テヲツエツ榲ァツェツ淌」ツ?ョテヲツァツ凝ァツッツ?
    int num = 1, x = 0, y = 0, dir = 3;
    cave[P(x, y)] = num;
    num2pos[num] = P(x, y);
    num++;

    for (int i = 0; i < MAX_M - 5; i++) {
        int ndir = (dir + 1) % 4,
            nx = x + dx[ndir],
            ny = y + dy[ndir];
        // テ・ツ?・テ」ツ?」テ」ツ?ヲテ」ツ??」ツつ凝」ツ?凝・ツ青ヲテ」ツ??
        if (cave.count(P(nx, ny)) == 0) {
            x = nx;
            y = ny;
            dir = ndir;
        } else {
            x = x + dx[dir],
            y = y + dy[dir];
        }
        cave[P(x, y)] = num;
        num2pos[num] = P(x, y);
        num++;
    }

    sieve();

    int m, n;
    while (cin >> m >> n, m | n) {
        memset(dp1, -1, sizeof(dp1));
        memset(dp2, 0, sizeof(dp2));
        memset(used, false, sizeof(used));

        queue<int> que;
        que.push(n);

        dp1[n] = prime_table[n];
        dp2[n] = prime_table[n] ? n : 0;

        used[n] = true;
        while (!que.empty()) {
            auto num = que.front(); que.pop();
            // if (dp1[qp.first] > qp.second) continue;

            P pos = num2pos[num];
            for (int ddx = -1; ddx <= 1; ddx++) {
                int nx = pos.first + ddx,
                    ny = pos.second - 1;
                if (cave.count(P(nx, ny)) == 0 || cave[P(nx, ny)] > m) continue;
                int nnum = cave[P(nx, ny)],
                    prime_num = dp1[num] + (prime_table[nnum]);

                if (dp1[nnum] < prime_num) {
                    dp1[nnum] = prime_num;
                    dp2[nnum] = dp1[num];

                    if (prime_table[nnum]) dp2[nnum] = nnum;

                    if (!used[nnum]) {
                        que.push(nnum);
                        used[nnum] = true;
                    }
                } else if (dp1[nnum] == prime_num && dp2[nnum] < dp2[num]) {
                    dp2[nnum] = dp2[num];

                    if (prime_table[nnum]) dp2[nnum] = nnum;
                }
            }
        }
        int prime_num = 0, last_prime = 0;
        for (int i = 1; i <= m; i++) {
            if (prime_num < dp1[i]) {
                prime_num = dp1[i];
                last_prime = dp2[i];
            } else if (prime_num == dp1[i] && last_prime < dp2[i]) {
                prime_num = dp1[i];
                last_prime = dp2[i];
            }
        }
        cout << prime_num << " " << last_prime << endl;
    }

    return 0;
}

Measured memory_bytes: 83176
#include<stdio.h>

int main(void)
{
	int a,b,d,r;
	double f,x,y;
	scanf("%d%d",&a,&b);
	d=a/b;
	r=a%b;
	x=a;
	y=b;
	f=x/b;
	printf("%d %d %f\n",d,r,f);
	return 0;
}


Measured memory_bytes: 636