akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

#define R 6378.1
#define SQ(X) \
  ( (X) * (X) )

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    double a, b, c, d;
    double x1, y1, z1
         , x2, y2, z2;
    double l, r;

    scanf ( "%lf%lf%lf%lf", &a, &b, &c, &d );
    if ( a == -1. && b == -1.
      && c == -1. && d == -1. ) break ;

    z1 = R * cos ( a * M_PI / 180. );
    x1 = z1 * cos ( b * M_PI / 180. );
    y1 = z1 * sin ( b * M_PI / 180. );
    z1 = R * sin ( a * M_PI / 180. );

    z2 = R * cos ( c * M_PI / 180. );
    x2 = z2 * cos ( d * M_PI / 180. );
    y2 = z2 * sin ( d * M_PI / 180. );
    z2 = R * sin ( c * M_PI / 180. );

    l = SQ( x2 - x1 ) + SQ( y2 - y1 ) + SQ( z2 - z1 );
    r = R * acos ( 1. - l / R / R / 2. );

    printf ( "%d\n", (int)( r + 0.5 ) );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
bool a[2001][2001];
int res[2001][2001],v2[2001][2001],v1[2001][2001];
int main(){
	IOS
	int n,m,q;
	cin>>n>>m>>q;
	for(int i=1;i<=n;i++){
		int cnt=0;
		string s;
		cin>>s;
		for(int j=0;j<m;j++){
			a[i][j+1]=s[j]-'0';
			if(a[i][j+1]==1){
				cnt++;
			}
			res[i][j+1]=cnt;
		}
	}
	for(int i=1;i<=n;i++){
		int cnt=0;
		for(int j=1;j<=m;j++){
			if(a[i][j]==1&&a[i][j-1]==1){
				cnt++;
			}
			v1[i][j]=cnt;
		}
	}
	for(int i=1;i<=m;i++){
		int cnt=0;
		for(int j=1;j<=n;j++){
			if(a[j][i]==1&&a[j-1][i]==1){
				cnt++;
			}
			v2[j][i]=cnt;
		}
	}
	for(int i=1;i<=q;i++){
		int x1,y1,x2,y2,r=0,v=0;
		cin>>x1>>y1>>x2>>y2;
		for(int j=y1;j<=y2;j++){
			r+=v2[x2][j]-v2[x1][j];
		}
		for(int j=x1;j<=x2;j++){
			r+=v1[j][y2]-v1[j][y1];
		}
		for(int j=x1;j<=x2;j++){
			v+=res[j][y2]-res[j][y1-1];
		}
		cout<<v-r<<endl;
	}
	return 0;
}
/*
 
*/

Measured memory_bytes: 52608
//~#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//~#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define all(a) begin(a),end(a)
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=998244353;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

void add(int &a,int b){
  a+=b;
  if(a>=mod)a-=mod;
}

int sub(int a,int b){
  a-=b;
  if(a<0){
    a+=mod;
  }
  return a;
}

int powz(int a,int b){
  int res=1;
  while(b){
    if(b&1){
      res=mul(res,a);
    }
    b/=2;
    a=mul(a,a);
  }
  return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
  input>>x.F>>x.S;
  return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

template<typename T>
vector<pair<T,int>> getvec(int n){
  vector<pair<T,int>>a(n);
  for(int i=0;i<a.size();i++){
    cin>>a[i].F;
    a[i].S=i;
  }
  return a;
}

void clr(auto &a,int n){
  a.clear();
  a.resize(n);
}

void unq(auto &a){
  sort(all(a));
  a.resize(unique(all(a))-a.begin());
}

const int N=300005;	

void solve(){
	int X,Y,A,B,C;
	cin>>X>>Y>>A>>B>>C;
	vi a(A);
	cin>>a;
	vi b(B);
	cin>>b;
	vi c(C);
	cin>>c;
	sort(all(a));sort(all(b));sort(all(c));
	vector<pair<int,int>>zz;
	for(auto &i:a){
		zz.pb({i,0});
	}
	for(auto &i:b){
		zz.pb({i,1});
	}
	for(auto &i:c){
		zz.pb({i,2});
	}
	sort(all(zz));
	int cnta=0,cntb=0,cntc=0;
	ll ans=0;
	priority_queue<int,vector<int>,greater<int>>pqa,pqb;
	for(int i=zz.size()-1;i>=0;i--){
		if(zz[i].S==0&&cnta<X){
			pqa.push(zz[i].F);
			ans+=zz[i].F;
			cnta++;
		}
		else if(zz[i].S==1&&cntb<Y){
			pqb.push(zz[i].S);
			ans+=zz[i].F;
			cntb++;
		}
		else if(zz[i].S==2){
			ans+=zz[i].F;
			cntc++;
		}
		if(cnta+cntb+cntc>=X+Y&&cnta+cntc>=X&&cntb+cntc>=Y){
			cout<<ans;
			return;
		}
	}
}


signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  //~cin>>tc;
  for(int _=0;_<tc;_++){
    // cout<<"Case #"<<_+1<<": ";
    solve();
    if(_!=tc-1){
      cout<<'\n';
    }
  }
}
 


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

const ll INF = 1e9 + 1;
const ll MAX_N = 100;
const ll MAX_V = 1e3;

ll dp[MAX_N * MAX_V + 1];

int main(){
    long long N;
    scanf("%lld",&N);
    long long W;
    scanf("%lld",&W);
    std::vector<long long> w(N);
    std::vector<long long> v(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&w[i]);
        scanf("%lld",&v[i]);
    }

    fill(dp, dp+MAX_N*MAX_V+1, INF);

    dp[0] = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = MAX_N * MAX_V; j >=0 ; j--)
        {
            if (j - v[i] >= 0) {
                dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
            }
        }
    }
    
    int res = 0;
    for (int i = 0; i <= MAX_N * MAX_V; i++)
    {
        if (dp[i] <= W) res = i;
    }

    cout << res << endl;
    
    return 0;
}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    ll x, y;
    cin >> x >> y;
    ll ans = 1;
    while (x * 2 <= y)
    {
        ans++;
        x *= 2;
    }
    c(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int h,w;
#define ll long long
int dp[10001][10001];
int  M = 1e9+7;
long long helper(vector<vector<char>> &a,int i,int j)
{
  if(i>=h || j>= w || a[i][j] == '#') return 0;
  if(i==h-1 && j == w-1) return 1;
  if(dp[i][j] != -1) return dp[i][j];
  dp[i][j] =  ( helper(a,i+1,j) + helper(a,i,j+1) )%M;
  return dp[i][j];
}

int main() {
  cin>>h>>w;
  vector<vector<char>> a;
  for(int i=0;i<10001;i++)
  {
    for(int j=0;j<10001;j++)
    {
      dp[i][j] = -1;
    }
  }
  char x;
  for(int i=0;i<h;i++)
  {
    vector<char> temp;
    temp.reserve(w);
    for(int j=0;j<w;j++)
    {
      cin>>x;
      temp.push_back(x);
    }
    a.push_back(temp);
  }
  cout<<helper(a,0,0)<<endl;
  return 0;
}

Measured memory_bytes: 392064
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const double pi = acos(-1.0);

int main() {
	int d; cin >> d;
	int x, y;
	VI p1, p2;
	cin >> x;
	rep(i, x) {
		string A; int P;
		cin >> A >> P;
		if (A == "D")p1.pb(P);
	}
	cin >> y;
	rep(i, y) {
		string A; int P;
		cin >> A >> P;
		if (A == "DD")p2.pb(P);
	}

	sort(all(p1), greater<int>());
	sort(all(p2), greater<int>());

	int ans = 0;
	for (int bit = 0; bit < (1 << sz(p2)); bit++) {
		int cnt = 0, sum = 0;

		rep(i, sz(p2)) {
			if (bit & (1 << i)) {
				cnt += 2;
				sum += p2[i];
			}
		}

		if (cnt > d)continue;
		rep(i, min(sz(p1), d - cnt))sum += p1[i];
		ans = max(ans, sum);
	}
	Cout(ans);
}


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

#define INF 1E18



int main(){
    int n;
    cin>>n;
    int h[n];
    rep(i,n) cin>>h[i];

    int ans = 0;
    int max_height = -1;
    rep(i,n){
        if(h[i] >= max_height){
            ans++;
            max_height = h[i];
        }
    }

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

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

struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
     
    while(x!=NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        }else{
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if(z->key < y->key) {
            y->left = z;
        }else{
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

Node * treeMinimum(Node *x) {
    while(x->left != NIL) x = x->left;
    return x;
}

Node * find(Node *u, int k) {
    while(u!=NIL && k != u->key) {
        if (k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

Node * treeSuccessor(Node *x) {
    if (x->right != NIL) return treeMinimum(x->right);
    Node *y = x->parent;
    while(y!=NIL && x==y->right) {
        x = y;
        y = y->parent;
    }
    return y;
}

void treeDelete(Node *z) {
    Node *y;
    Node *x;
    
    if (z->left == NIL || z->right) y = z;
    else y = treeSuccessor(z);
    
    if (y->left != NIL) { 
        x = y->left;
    } else {
        x = y->right;
    }
    
    if (x != NIL) {
        x->parent = y->parent;
    }
    
    if (y->parent == NIL) {
        root = x;
    } else {
        if (y == y->parent->left) {
            y->parent->left = x;
        } else {
            y->parent->right = x;
        }
    }
    
    if (y != z) {
        z->key = y->key;
    }
    
    free(y);
}

int main() {
    int n, i, x;
    string com;
    
    scanf("%d", &n);
    
    for (i=0; i<n; i++) {
        cin >> com;
        if(com == "insert") {
            scanf("%d", &x);
            insert(x);
        }else if(com == "delete") {
            scanf("%d", &x);
            treeDelete(find(root, x));
        }else if(com == "find") {
            scanf("%d", &x);
            Node *t = find(root, x);
            if(t!=NIL) printf("yes\n");
            else printf("no\n");
        }else if(com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    
    return 0;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    int num[4];
    for(int i=0; i<4; i++){
        num[i] = s[i] - '0';
    }

    for(int i=0; i<8; i++){
        int sum = num[0];
        for(int j=0; j<3; j++){
            if((i>>j)&1) sum += num[j+1];
            else sum -= num[j+1];
        }
        if(sum==7){
            cout << num[0];
            for(int j=0; j<3; j++){
                if((i>>j)&1) cout << '+';
                else cout << '-';
                cout << num[j+1];
            }
            cout << "=7"  << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h" // {{{
using namespace std; typedef long long ll; typedef pair<int,int> pii;
#define val         const auto
#define eb          emplace_back
#define emp         emplace
#define fi          first
#define se          second
#define outl(x)     cout << (x) << '\n'
#define rep(i,n)    for(int i=0; i < (int)(n); ++i)
#define repr(i,h,l) for(int i=(h); i >= (int)(l); --i)
#define reps(i,s,t) for(int i=(s); i <= (int)(t); ++i)
#define ALL(x)      begin(x), end(x)
#define UNQ(x)      (x).erase(std::unique(ALL(x)), end(x))
#define TMPLT(T,U)  template<class T, class U>
#define ten(p)      ((long long)(1e##p))
#define FILL(a,v)   memset((a), (v), sizeof(a))
#define YDK(f,a,b)  ((f)? (a):(b))
#ifdef  DEBUG
#define debug(...)  fprintf(stderr, __VA_ARGS__)
#define show(x)     clog << #x << " \t\t= " << (x) << '\n'
#define show2(x,y)  clog << '(' << #x << ',' << #y << ")\t\t= " << '(' << (x) << "\t, " << (y) << ")\n"
#define LN()        fputs("\n--------------------------------\n", stderr)
struct NullPointer{};
#else
#define debug(...)
#define show(x)
#define show2(x,y)
#define LN()
struct NullPointer{ NullPointer(){cin.tie(0);ios::sync_with_stdio(false);} };
#endif
#define def(op) inline bool operator op (const T &that) const { return comp(that) op 0; }
template<class T> struct Ordered
{ virtual int comp(const T &that) const = 0; def(==); def(!=); def(<); def(<=); def(>); def(>=); };
#undef def
namespace {
  constexpr int INF = 0x3f3f3f3f; constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL; ostringstream _oss;
  TMPLT(T,U) inline constexpr common_type_t<T,U> gcd(T x, U y)
  { return (x<y)? gcd(y,x) : (y <= 0)? x : gcd(y, x % y); }
  TMPLT(T,U) inline bool chmax(T &a, const U &b){return b>a ? a=b,1 : 0;}
  TMPLT(T,U) inline bool chmin(T &a, const U &b){return b<a ? a=b,1 : 0;}
  TMPLT(T,U) inline constexpr ll lcm(T x, U y) { return (ll)x/gcd(x,y) * y; }
  template<class T>   string toString(const T &x){ _oss.str(""); _oss << x; return _oss.str(); }
  template<class Itr> string mkString(Itr begin, Itr end, const char *sp = " ") {
    _oss.str(""); for(Itr i=begin; i != end; ++i) { if(i != begin)_oss << sp; _oss << *i; }
    return _oss.str();
  }
  // }}}

constexpr int MX = ten(5) + 10;

string mk(const string &s, const string &t, int idx)
{
  string ret = s;
  for (val &c : t) ret[idx++] = c;
  for (char &c: ret) if (c == '?') c = 'a';
  return ret;
}

bool isOK(const string &s, const string &org)
{
  rep(i, s.length()) {
    if (org[i] != '?' && s[i] != org[i]) return false;
  }
  return true;
}

void Xx_main_xX(const vector<char*> &args)
{
  string s, t;
  cin >> s >> t;
  val slen = s.length();
  val tlen = t.length();

  set<string> U;

  for (int i = 0; i+tlen-1 < slen; ++i) {
    val &tmp = mk(s, t, i);
    if (isOK(tmp, s)) { U.emp(tmp); show(tmp); }
  }


  if (U.empty()) {
    outl("UNRESTORABLE");
  } else {
    outl( *U.begin() );
  }
}

} // {{{
signed main(signed argc, char *argv[]) {
  NullPointer Exception;
  cout << fixed << setprecision(9); Xx_main_xX(vector<char*>(argv, argv+argc)); return 0;
} // }}}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s;
  cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

class UnionFind {
public:
	vector<int> par;//親の番号
    vector<int> rank;//木の深さ
 
	UnionFind(int n){//全ての要素に対して自身が根となるように初期化, 木の深さは0になる
		rep(i,n){
            par.push_back(i);
            rank.push_back(0);
        }
	}
 
	int find(int x) {//木の根を求める
		if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
	}
 
	void unite(int x,int y){//xとyの属する集合を併合
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]){//木の深さが小さい方を大きい方へ繋げる
            par[x]=y;
        }else{
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(int x,int y){//xとyが同じ集合に属するか否か
        return find(x)==find(y);
    }
};
//x以下の要素への最小index, ソートしてから使ってね
template <class T> 
int former(const vector<T> &v, T x){
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素への最小index
template <class T> 
int latter(const vector<T> &v, T x){
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}
//nCk
template <class T>
T comb(T n,T k){
    T ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}
//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}
//素因数分解
template <class T>
map<T,T> prime_factor(T x){
    map<T,T> ans;
    for(T i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            ans[i]++;
        }
    }
    if (x!=1){
        ans[x]=1;
    }
    return ans;
}
//約数列挙
template <class T>
vector<T> divisor(T x){
    vector<T> res;
    for(T i=1;i*i<=x;i++){
        if(x%i==0){
            res.push_back(i);
            if(i!=x/i){
                res.push_back(x/i);
            }
        }
    }
    return res;
}
//素数判定
template <class T>
bool is_prime(T x){
    for(T i=2;i*i<=x;i++){
        if(x%i==0){
            return false;
        }
    }
    return x!=1;
}

const ll inf=1e9+7;

ll mult(ll n,ll m){//n^m%infを求める
    if(m==1){
        return n%inf;
    }else if(m%2==0){//オーバーフロー防止のためにn^(m/2)*n^(m/2)を考える
        ll t=mult(n,m/2);
        return (t*t)%inf;
    }else{//奇数の時はn^(m-1)*nを考える
        ll t=mult(n,m-1);
        return (t*n)%inf;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    cout<<n/3<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		long n = stdin.nextLong();
		long x = Long.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			long l = stdin.nextLong();
			if (l < x) {
				x = l;
			}
		}
		if ((double) n / x <= 1) {
			System.out.println(5);
		} else {
			if (n % x == 0) {
				System.out.println(4 + n / x);
			} else {
				System.out.println(5 + n / x);
			}
			;
		}
	}

}


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

int main() {
string S;
cin>>S;
int G=0,P=0;
int n=S.size();
for(int i=0;i<n;i++){
  if(S[i]=='g') G++;
  else P++;
}
int w=0,l=0;
for(int i=0;i<n;i++){
  if(i%2==0){
    if(S[i]=='g') w+=0;
    else l++;
  }
  else{
    if(S[i]=='g') w+=1;
    else l+=0;
  }
}
cout<<w-l<<endl;
}


Measured memory_bytes: 3720
using System;
using System.Linq;

namespace hoge
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (x[0] * x[1] % 2 == 0) Console.WriteLine("Even");
            else Console.WriteLine("Odd");
        }
    }
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
int d[4];
bool f=0;
const char *op="+-*";

int cal(int a,int o,int b){
    if(o==0) return a+b;
    if(o==1) return a-b;
    return a*b;
}

bool sol(int a,int b,int c) {
    f++;
    if (cal(cal(cal(d[0],a,d[1]),b,d[2]),c,d[3])==10) {
        return printf("(((%d %c %d) %c %d) %c %d)\n",d[0],op[a],d[1],op[b],d[2],op[c],d[3]);
        //return true;
    }
    if (cal(cal(d[0],a,d[1]),b, cal(d[2],c,d[3]))==10) {
        return printf("((%d %c %d) %c (%d %c %d))\n",d[0],op[a],d[1],op[b],d[2],op[c],d[3]);
        //reeturn true;
    }
    if (cal(cal(d[0],a, cal(d[1],b,d[2])),c,d[3])==10) {
        return printf("((%d %c (%d %c %d)) %c %d)\n",d[0],op[a],d[1],op[b],d[2],op[c],d[3]);
       // return true;
    }
    return f=0;
}

bool jg() {
    for (int i=0;i<3;++i) {
        for (int j=0;j<3;++j) {
            for (int k=0;k<3;++k) {
                if (sol(i,j,k)) return true;
            }
        }
    }
}


int main(){
    int mod=1000000007;
    for (;;) {
        scanf("%d %d %d %d",&d[0],&d[1],&d[2],&d[3]);
        if (d[0]==d[1] && d[1]==d[2] && d[2]==d[3] && d[0]==0) break;
        sort(d,d+4);
        do {
            if (jg()) break;
        } while (next_permutation(d,d+4));
        if (f==0) printf("0\n");
    }
    return 0;
}

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

int main() {
    int n, m, k, a;
    cin >> n >> m;

    vector<int> count(m,0);
    for (int i = 0; i < n; i++) {
        cin >> k;
        for (int i = 0; i < k; i++) {
            cin >> a;
            count[a-1] ++;
        }
    }

    int ans = 0;
    for (int i = 0; i < m; i++) {
        if (count[i] == n)
            ans ++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3564
#include <stdio.h>

int main (void)
{
    int cnt=0,h,w,i,j;
    scanf("%d %d",&h,&w);
    char s[10][10];
    for(i=0;i<h;i++)
    {
        scanf("%s",s[i]);
    }
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            if(s[i][j]=='#')
            {
                cnt++;
            }
        }
    }
    if(cnt==h+w-1)
    {
        puts("Possible");
    }else{
        puts("Impossible");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;++i)
    {
        cin >> a[i];
    }
    for(int i=0;i<n;++i)
    {
        int v = a[i];
        int j = i-1;
        while(j >= 0 and a[j] > v)
        {
            a[j+1] = a[j];
            --j;
        }
        a[j+1] = v;
        for(int k=0;k<n;++k)
        {
            cout << a[k];
            if(k==n-1)
                cout << endl;
            else
                cout << " ";
        }
    }

}



Measured memory_bytes: 3092
import math

def isPrime(num):
    if num == 1:
        return False
    elif num == 2:
        return True
    
    for i in range(2, int(math.sqrt(num)) + 1):
        if num % i == 0:
            return False
    return True

if __name__ == '__main__':
    n = int(input())
    nump = 0
    for i in range(n):
        num = int(input())
        if isPrime(num):
            nump += 1
    
    print(nump)



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

using i64 = int64_t;

int main(){
    i64 a, b, m;
    cin >> a >> b >> m;
    vector<i64> refrigerators, microwaves;
    i64 min_r = INT_MAX, min_m = INT_MAX;
    for(int i=0;i<a;++i){
        i64 tmp;
        cin >> tmp;
        refrigerators.push_back(tmp);
        min_r = min(min_r, tmp);
    }
    for(int i=0;i<b;++i){
        i64 tmp;
        cin >> tmp;
        microwaves.push_back(tmp);
        min_m = min(min_m, tmp);
    }
    i64 ans = min_r + min_m;
    for(int i=0;i<m;++i){
        i64 x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        i64 price = refrigerators[x] + microwaves[y] - c;
        ans = min(ans, price);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2548
import math

def prime(x):
    for i in range(2, int(math.sqrt(x))+1): 
        if x % i == 0:
            return False
    return True

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

num = 0
for i in range(n):
    if prime(a[i]):
        num += 1
print num

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

#define ll long long

int main(void){

    int n,m;
    cin>>n>>m;
    char a[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    char b[m][m];
    for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
            cin>>b[i][j];
        }
    }
    bool flag=true;
    for(int i=0;i<n-m+1;i++){
        for(int j=0;j<n-m+1;j++){
            flag=true;
            for(int k=0;k<m;k++){
                for(int l=0;l<m;l++){
                    if(b[k][l]!=a[i+k][j+l]){
                        flag=false;
                        break;
                    }
                }
                if(!flag)break;
            }
            if(flag){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;


    return 0;
}

Measured memory_bytes: 256
a,b,h,m = [int(x) for x in input().split()]

m1 = 360*m/60
h1 = 360*(h+m/60)/12
bun = abs(m1-h1)
if bun>180:
    bun = abs(bun-360)
import math
if bun==180:
    print(a+b)
elif bun==0:
    print(abs(a-b))
else:
    ans = math.sqrt(a*a+b*b-2*a*b*math.cos(math.radians(bun)))
    print(ans)

Measured memory_bytes: 62480
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<int> w(N),s(N);
	for(int i=0; i<N; i++){
		cin >> w[i];
	}
	int T=1;
	for(int i=0; i<N-1; i++,T++){
		int S1=0, S2=0;
		for(int j=0; j<T; j++){
			S1+=w[j];
		}
		for(int j=T; j<N; j++){
			S2+=w[j];
		}
		s[i]=abs(S1-S2);
	}
	int min=s[0];
	for(int i=0; i<N-2; i++){
		if(min > s[i+1]){
			min=s[i+1];
		}
	}
	cout << min << endl;
	return 0;
}

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

ll f(ll Y, ll M, ll D) {
    ll res = 0;
    rep(y, Y) {
        if (y % 3 == 0) res += 10 * 20;
        else res += 39 * 5;
    }
    rep(m, 1, M) {
        if (Y % 3 == 0 || m % 2 == 1) {
            res += 20;
        }
        else {
            res += 19;
        }
    }
    res += D-1;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll T; cin >> T;
    rep(t, T) {
        ll y, m, d; cin >> y >> m >> d;
        cout << f(1000, 1, 1) - f(y, m, d) << endl;
    }
}

Measured memory_bytes: 3104
import sys
input = sys.stdin.readline

class SegmentTree():
    def __init__(self, n, init):
        self.n = 2 ** (n - 1).bit_length()
        self.init = init
        self.data = [init] * (2 * self.n)

    def inc(self, k):
        self.data[k + self.n - 1] += 1

    def build(self):
        for k in reversed(range(self.n - 1)):
            self.data[k] = max(self.data[k * 2 + 1], self.data[k * 2 + 2])

    def update(self, k, a):
        k += self.n - 1
        self.data[k] += a

        while k > 0:
            k = (k - 1) // 2
            self.data[k] = max(self.data[k * 2 + 1], self.data[k * 2 + 2])

    def query(self, l, r):
        L = l + self.n
        R = r + self.n
        ret = self.init
        while L < R:
            if R & 1:
                R -= 1
                ret = max(ret, self.data[R - 1])
            if L & 1:
                ret = max(ret, self.data[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return ret



if __name__ == "__main__":
    H, W, M = map(int, input().split())

    Seg = SegmentTree(W + 5, 0)

    Yaxis = dict()

    for _ in range(M):
        h, w = map(int, input().split())
        if h in Yaxis: Yaxis[h].append(w)
        else: Yaxis[h] = [w]
        Seg.inc(w)

    Seg.build()


    ans = 0
    for y in Yaxis:
        for x in Yaxis[y]: Seg.update(x, -1)
        ans = max(ans, len(Yaxis[y]) + Seg.query(0, W + 1))
        for x in Yaxis[y]: Seg.update(x, 1)

    print(ans)

Measured memory_bytes: 169232
#include<bits/stdc++.h>
using namespace std;
using UL=unsigned int;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

struct RSQ{
 int N;
 vector<int> V;
 void init(int n){
  N=1; while(N<n) N<<=1;
  V.resize(N*2);
 }
 void upd(int p,int v){
  p+=N;
  V[p]=v;
  while(p!=1){
   p>>=1;
   V[p]=V[p<<1]+V[(p<<1)+1];
  }
 }
 int query(int l,int r,int a=-1,int b=-1,int i=-1){
  if(i==-1){ a=0; b=N; i=1; }
  if(r<=a || b<=l) return 0;
  if(l<=a && b<=r) return V[i];
  int q1=query(l,r,a,(a+b)>>1,i<<1);
  int q2=query(l,r,(a+b)>>1,b,(i<<1)+1);
  return q1+q2;
 }
};

int N,Q;
int C[500000];
vector<pair<int,int>> Query[500000];
vector<pair<int,int>> UpdQry[500001];
int ans[500000];
RSQ G;

int main(){
 scanf("%d%d",&N,&Q);
 rep(i,N){ scanf("%d",&C[i]); C[i]--; }
 rep(i,Q){
  int l,r; scanf("%d%d",&l,&r); l--;
  Query[l].push_back({r,i});
 }

 G.init(N);
 {
  int I[500000]; rep(i,N) I[i]=-1;
  rep(i,N){
   UpdQry[I[C[i]]+1].push_back({i,1});
   UpdQry[i+1].push_back({i,0});
   I[C[i]] = i;
  }
 }
 rep(i,N){
  for(auto p:UpdQry[i]) G.upd(p.first,p.second);
  for(auto q:Query[i]){
   ans[q.second] = G.query(0,q.first);
  }
 }

 rep(i,Q) printf("%d\n",ans[i]);

 return 0;
}


Measured memory_bytes: 66624
#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template<typename F>
inline void write(F x, char ed = '\n') {
    static short st[30];short tp=0;
    if(x<0) putchar('-'),x=-x;
    do st[++tp]=x%10,x/=10; while(x);
    while(tp) putchar('0'|st[tp--]);
    putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

const int N = 400005;
struct edges {
    int x, y, val;
    bool operator < (const edges &i) const {
        return val < i.val;
    }
}ed[N];

int d[N], f[N], cnt, m, n; ll ans;
int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
int main() {
    read(n), read(m);
    memset(d, 0x3f, sizeof(d));
    for (int i = 1, x, y, z;i <= m; i++) {
        read(x), read(y), read(z);
        ed[++cnt] = (edges){x, y, z};
        Mn(d[x], z + 1), Mn(d[y], z + 2);
    }
    for (int i = 1;i <= n; i++)
        Mn(d[i], d[i-1] + 2);
    Mn(d[0], d[n]);
    for (int i = 1;i <= n; i++)
        Mn(d[i], d[i-1] + 2);
    Mn(d[0], d[n]);
    for (int i = 0;i < n; i++)
        ed[++cnt] = (edges){i, (i + 1) % n, d[i]};
    sort(ed + 1, ed + cnt + 1);
    for (int i = 1;i <= n; i++) f[i] = i;
    for (int i = 1;i <= cnt; i++) {
        int x = ed[i].x, y = ed[i].y, z = ed[i].val;
        x = find(ed[i].x), y = find(ed[i].y);
        x != y && (ans += z, f[x] = y);
    }
    write(ans);
    return 0;
}

Measured memory_bytes: 13192
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 998244353;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
    vector<int> R(A);
    vector<int> G(B);
    vector<int> App(C);
    priority_queue<int, vector<int>, greater<int>> red_q;
    priority_queue<int, vector<int>, greater<int>> green_q;
    priority_queue<int, vector<int>> apple_q;

    for (int i = 0; i < A; i++) {
        cin >> R[i];
        red_q.push(R[i]);
    }
    for (int i = 0; i < B; i++) {
        cin >> G[i];
        green_q.push(G[i]);
    }
    for (int i = 0; i < C; i++) {
        cin >> App[i];
        apple_q.push(App[i]);
    }

    while (red_q.size() > X) {
        red_q.pop();
    }
    while (green_q.size() > Y) {
        green_q.pop();
    }

    while (!apple_q.empty()) {
        int x = apple_q.top();
        apple_q.pop();
        if (green_q.top() < red_q.top()) {
            if (green_q.top() > x) continue;
            green_q.pop();
            green_q.push(x);
        } else {
            if (red_q.top() > x) continue;
            red_q.pop();
            red_q.push(x);
        }
    }

    Int ans = 0;
    while (!red_q.empty()) {
        ans += red_q.top();
        red_q.pop();
    }
    while (!green_q.empty()) {
        ans += green_q.top();
        green_q.pop();
    }
    cout << ans << endl;
}


Measured memory_bytes: 2936
#include<iostream>
using namespace std;
signed main(){
    int64_t n;
    cin>>n;
    int64_t sum = 0ll;
    sum -= n*(n+1)/2;
    while(n--){
        int64_t ai;
        cin>>ai;
        sum += ai;
    }
    cout<< sum <<endl;
}


Measured memory_bytes: 3108
n = int(input())
l = list(map(int, input().split()))

count = 0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if not ((l[i] == l[j]) or (l[j] == l[k]) or (l[k] == l[i])):
                temp = []
                temp.append(l[i])
                temp.append(l[j])
                temp.append(l[k])
                temp.sort()

                x = temp.pop()
                y = temp.pop()
                z = temp.pop()

                if x < y + z:
                    count += 1

print(count)


Measured memory_bytes: 9232
N,L=map(int,input().split())
A=list(map(int,input().split()))
if N==2:
  if sum(A)>=L:
    print('Possible')
    print(1)
  else:
    print('Impossible')
  exit(0)
lasti=-1
for i in range(N-1):
  if A[i]+A[i+1]>=L:
    lasti=i+1
    break
if lasti==-1:
  print('Impossible')
else:
  print('Possible')
  for i in range(1,lasti):
    print(i)
  for i in range(N-1,lasti-1,-1):
    print(i)

Measured memory_bytes: 14060
MAX = 101010
Prime = [1] * MAX
Prime[0] = 0
Prime[1] = 0
for i in range(2, MAX):
    if not Prime[i]:
        continue
    for j in range(i*2, MAX, i):
        Prime[j] = 0

Like = [0] * MAX
for i in range(MAX):
    if Prime[i] and Prime[(i+1)//2]:
        Like[i] = 1

Sum = [0] * (MAX + 1)
for i in range(MAX):
    Sum[i+1] = Sum[i] + Like[i]

q = int(input())
Ans = []
for i in range(q):
    l,r = map(int, input().split())
    Ans.append(Sum[r+1] - Sum[l])
for i in range(len(Ans)):
    print(Ans[i])

Measured memory_bytes: 12360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
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; }
inline ll powint(ll x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

void pr(ll n){
    cout << n << endl;
    exit(0);
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, m;
    cin >> n >> m;
    if(n == 1 && m == 1){
        pr(1);
    }else if(n == 1){
        pr(m-2);
    }else if(m == 1){
        pr(n-2);
    }else{
        pr((n-2)*(m-2));
    }
    return 0;
}

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

#define ll long long
ll mod = 1000000007;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, k;
    cin >> n >> k;
    if(n+1==k) cout << 1 << "\n";
    else {
        ll sum=0;
        for(ll i=k; i<=n+1; i++){
            ll mn = (i-1)*i/2;
            ll mx = n*(n+1)/2 - (n-i)*(n-i+1)/2;
            sum+=(mx-mn+1)%mod;
            sum%=mod;
        }
        cout << sum << "\n";
    }

    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int a, b, ans=1, us=0;

	cin>> a >> b;

	while(1){
		if(b<=ans) break;
		ans--;
		ans+=a;
		us++;
	}

	cout<< us << endl;

}

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

class Main {
	public static void main(String[] args) {
		try (BufferedReader stdReader = new BufferedReader(
				new InputStreamReader(System.in))) {
			String line = null;
			while ((line = stdReader.readLine()) != null) {
				if (!line.equals("")) {
					int i = Integer.parseInt(line);
					System.out.print(i * i * i);
				}
				break;
			}
			stdReader.close();
			System.out.println();
		} catch (Exception e) {

		}
	}
}

Measured memory_bytes: 24360
n = int(input())
hs = list(map(int, input().split()))
stack = []
ans = 0
 
for i, h in enumerate(hs):
    j = -1
    while stack and stack[-1][1] > h:
        j, h2 = stack.pop()
        ans = max(ans, (i - j) * h2)
    if not stack or stack[-1][1] < h:
        stack.append((i if j == -1 else j, h))
ans = max(ans, max((n - j) * h2 for j, h2 in stack))
 
print(ans)

Measured memory_bytes: 22324
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <set>

using namespace std;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	int arr[100000];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (arr[arr[i] - 1] - 1 == i)
			cnt++;
	}
	cout << cnt / 2;
	return 0;
}

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


class Program {

	//static long mod = 1000000007;
	static long mod =998244353; 
	static void Main(string[] args) {

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

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";


		string res = "No";


		int n = int.Parse(Console.ReadLine());
		string str = Console.ReadLine();

		if ( n % 2 == 1 ) { Console.WriteLine("No"); return; }
		string a = str.Substring(0, n / 2);
		if ( "" + a + a == str ) { res = "Yes"; }


			Console.WriteLine(res);

		return;

	}

	//	int配列をスペース区切りの文字列に変換
	static string stringBuilderArrayInt(int[] a) {
		StringBuilder sb = new StringBuilder();

		for ( int i = 0; i < a.Length; i++ ) {
			sb.Append(a[i] + " "); 
		}
		if ( sb.Length > 1 ) {
			sb = sb.Remove(sb.Length - 1, 1);
		}
		return sb.ToString(); ;
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b >= c ? "Yes" : "No");
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3636
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)

inf = 10 ** 15
mod = 10 ** 9 + 7
n = int(input())
judge = []
w = input()
pre = w[-1]
judge.append(w)
for i in range(n-1):
    w = input()
    if w[0] == pre and (not w in judge):
        pre = w[-1]
        judge.append(w)
    else:
        print('No')
        sys.exit()
print('Yes')

Measured memory_bytes: 38256
//Name: ALDS1_7_A: Rooted Trees
//Level: 2
//Category: Tree
//Note: left-child, right-sibling representation

#include <iostream>
#define MAX 100001
#define NIL -1

using namespace std;

struct Node { int par, left, right; };

Node T[MAX];
int n, depth[MAX];

void print(int u) {
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].par << ", ";
    cout << "depth = " << depth[u] << ", ";

    if (T[u].par == NIL) {
        cout << "root, ";
    }
    else if (T[u].left == NIL) {
        cout << "leaf, ";
    }
    else { cout << "internal node, "; }

    cout << "[";
    for (int i = 0, c = T[u].left; c != NIL; i++, c = T[c].right ) {
        if (i) { cout << ", "; }
        cout << c;
    }
    cout << "]" << endl;
}

void set_depth(int u, int p) {
    depth[u] = p;
    if (T[u].right != NIL) {
        set_depth(T[u].right, p);
    }
    if (T[u].left != NIL) {
        set_depth(T[u].left, p + 1);
    }
}

int main() {
    int d, v, c, l, r;

    cin >> n;

    for (int i = 0; i < n; i++) {
        T[i].par = T[i].left = T[i].right = NIL;
    }

    for (int i = 0; i < n; i++) {
        cin >> v >> d;
        for (int j = 0; j < d; j++) {
            cin >> c;
            if (j == 0) { T[v].left = c; }
            else { T[l].right = c; }
            l = c;
            T[c].par = v;
        }
    }

    for (int i = 0; i < n; i++) {
        if (T[i].par == NIL) {
            r = i;
        }
    }

    set_depth(r, 0);

    for (int i = 0; i < n; i++) { print(i); }

    return 0;
}


Measured memory_bytes: 7672
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

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

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, M;
ll x[1010], y[1010], z[1010];

int main() {
  std::cin >> N >> M;

  rep( i, N )
    std::cin >> x[i] >> y[i] >> z[i];

  ll ans = 0;

  rep( s1, 2 ) rep( s2, 2 ) rep( s3, 2 ) {
    std::vector<ll> xs;

    rep( i, N )
      xs.emplace_back( (s1?-1:1)*x[i]+(s2?-1:1)*y[i]+(s3?-1:1)*z[i] );

    std::sort( rall(xs) );

    ll sum = 0;

    rep( i, M )
      sum += xs[i];

    chmax( ans, sum );
  }

  std::cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3664
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from sys import stdin

n = int(stdin.readline())
while n:
    result = long(stdin.readline()) + long(stdin.readline())
    if len(str(result)) >= 81:
        print('overflow')
    else:
        print(result)
    n -= 1

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<ll, ll> ll_ll;
struct edge { int v, w; };
const int INF = INT_MAX / 2;
const int MOD = 1e9 + 7;
const ll e18 = 1e18;

void f(int u, int v, int w) {
	if (w == -1)
		cout << u + 1 << ' ' << v + 1 << ' ' << 'X' << endl;
	else if (w == -2)
		cout << u + 1 << ' ' << v + 1 << ' ' << 'Y' << endl;
	else
		cout << u + 1 << ' ' << v + 1 << ' ' << w << endl;
}

int main() {
	int X, Y; cin >> X >> Y;
	vector<vector<int>> a(X + 1, vector<int>(Y + 1));
	for (int x = 1; x <= X; x++)
		for (int y = 1; y <= Y; y++)
			cin >> a[x][y];
	vector<vector<int>> l(101, vector<int>(101));
	rep(i, 101) rep(j, 101) {
		int ma = 0;
		for (int x = 1; x <= X; x++)
			for (int y = 1; y <= Y; y++)
				ma = max(ma, a[x][y] - i * x - j * y);
		l[i][j] = min(ma, 100);
	}
	for (int x = 1; x <= X; x++)
		for (int y = 1; y <= Y; y++) {
			int mi = INF;
			rep(i, 101) rep(j, 101)
				mi = min(mi, i * x + j * y + l[i][j]);
			if (mi != a[x][y]) {
				cout << "Impossible" << endl;
				return 0;
			}
		}
	cout << "Possible" << endl;
	cout << 202 << ' ' << 10401 << endl;
	rep(i, 100) f(i, i + 1, -1);
	rep(j, 100) f(101 + j, 101 + j + 1, -2);
	rep(i, 101) rep(j, 101) f(i, 201 - j, l[i][j]);
	cout << 1 << ' ' << 202 << endl;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	cout << min(B / A, C) << endl;
}


Measured memory_bytes: 256