akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  string S;
  cin >> S;
  if(S == "ABC") {
    fin("ARC");
  } else {
    fin("ABC");
  }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll>v;
int main(){
    ll n,x,a,ans=0;
    scanf("%lld %lld",&n,&x);
    for(int i=0;i<n;i++){
        scanf("%lld",&a);
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n-1;i++){
        if(x-v[i]>=0){
            x-=v[i];
            ans++;
        }
        else
            break;
    }
    if(x==v[n-1])
        ans++;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin>>x>>y;
        if(x==0 && y==0)break;
        if(x>y){
            cout<<y<<" "<<x<<endl;
        }else{
            cout<<x<<" "<<y<<endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3092
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
a, b = LI()
print(min(str(a)*b, str(b) * a))

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

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

    std::vector<int> l(m);
    std::vector<int> r(m);
//    std::vector<std::vector<int>> flg(m, std::vector<int>(n));
//    std::vector<int> flg(n);

    for ( int i = 0; i < m; i++ ) {
        cin >> l[i] >> r[i];
    }

//    for ( int i = 0; i < n; i++ ) {
//        flg[i] = 0;
//    }

    int maxl = 1;
    int minr = n;

    for ( int i = 0; i < m; i++ ) {
        maxl = max(maxl, l[i]);
        minr = min(minr, r[i]);
    }

    int cnt = 0;
    for ( int i = maxl; i <= minr; i++ ) {
        cnt++;
    }

    cout << max(cnt, 0) << endl;


//    for ( int i = 0; i < m; i++ ) {
//        for ( int j = 0; j < n; j++ ) {
//            if ( ( flg[j] == 1 | i == 0 ) & j >= l[i] - 1 & j <= r[i] - 1 ) {
//                if ( i == m - 1 ) {
//                    cnt++;
//                }
//                else {
//                    flg[j] = 1;
//                }
//            }
//            else {
//                flg[j] = 0;
//            }
//        }
//    }

//    for ( int i = 0; i < n; i++ ) {
//        if ( flg[i] == 1 ) {
//            cnt++;
//        }
//    }

//    bool ng_flg = false;
//    int cnt = 0;
//    for ( int i = 0; i < n; i++ ) {
//        ng_flg = false;
//        for ( int j = 0; j < m; j++ ) {
//            if ( flg[j][i] == 0 ) {
//                ng_flg = true;
//                break;
//            }
//        }
//        if ( ng_flg == false) {
//            cnt++;
//        }
//    }

//    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
    vector<int> a(3),b(3);
    for(int i=0; i<3; i++)cin >> a[i] >> b[i];
    vector<int> count(5,0);
    int ans=1;
    for(int i=0; i<3; i++){
        count[a[i]]++;
        count[b[i]]++;
    }
    for(int i=1; i<=4; i++){
        ans*=count[i];
    }
    cout << (ans==4?"YES":"NO") << endl;
    return 0;
}


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

int main() {
  string s;
  int res=0;
  while(getline(cin,s)) {
    int cnt=0;
    int n=s.size();
    for(int i=0; i<n/2; i++) {
      if(s[i]==s[n-i-1]) cnt++;
    }
    if(cnt==n/2) res++;
  }
  cout<<res<<endl;

  return 0;
}

Measured memory_bytes: 1180
#include<stdio.h>
int main(void){
  char s,t;
  scanf("%c %c",&s,&t);
  if(s=='H'){
    if(t=='H') printf("H\n");
    else printf("D\n");
  }else{
    if(t=='H') printf("D\n");
    else printf("H\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
string S;
int main() {
	cin >> S;
	if (S.size() % 2 == 1) { cout << "No" << endl; }
	else {
		bool flag = true;
		for (int i = 0; i < S.size(); i++) {
			int to = S.size() - 1 - i;
			if (S[i] == 'b' && S[to] != 'd')flag = false;
			if (S[i] == 'd' && S[to] != 'b')flag = false;
			if (S[i] == 'p' && S[to] != 'q')flag = false;
			if (S[i] == 'q' && S[to] != 'p')flag = false;
		}
		if (flag == true)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n, a, b; cin >> n >> a >> b;
  cout << n / (a + b) * a + min(a, n % (a+b)) << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}

	return B;
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << ((((abs(a - b) <= d) && (abs(b - c) <= d)) || abs(a - c) <= d) ? "Yes" : "No") << endl;

ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}




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

int main(){
    int k, a, b;
    cin >> k >> a >> b;
    if(a%k == 0 || a-a%k + k <= b){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
  ll n;
  cin >> n;
  ll A[n];
  ll sum = 0;
  ll i,j,k;
  ll ans[n];

  for(i=0;i<n;i++){cin >> A[i]; sum += A[i];}
  sum -= A[n-1] * 2;
  for(i=1;i<n-2;i+=2){
    sum -= A[i] * 2;
  }
  ans[n-2] = sum;
  ans[n-1] = A[n-2] * 2 - ans[n-2];

  for(i=n-3;i>=0;i--){
    ans[i] = A[i] * 2 - ans[i+1];
  }

  for(i=0;i<n;i++){
    cout << ans[i];
    if(i<n-1){cout << " ";}
  }
  
  return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#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__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	string w;
	vector<string> v;
	ll count = 0;
	bool flag = false;

	cin >> w;

	v.push_back(w);

	sort(v[0].begin(), v[0].end());

	v[0].push_back('0');

	REP(i, w.size()) {
		if (v[0][i] != v[0][i + 1]) {
			count++;

			if (count % 2 == 1) {
				flag = true;
				break;
			}
			else {
				count = 0;
			}
		}
		else {
			count++;
		}
	}

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

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

int a[] = {1, 3, 5, 7, 8, 10, 12};
int b[] = {4, 6, 9, 11};
int c[] = {2};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x, y; cin >> x >> y;
    bool f1 = false, f2 = false;
    for (int i : a) {
      if (x == i) f1 = true;
      if (y == i) f2 = true;
    }
    if (f1 && f2) {cout << "Yes" << endl; return 0;}
    f1 = false, f2 = false;
    for (int i : b) {
      if (x == i) f1 = true;
      if (y == i) f2 = true;
    }
    if (f1 && f2) {cout << "Yes" << endl; return 0;}
    f1 = false, f2 = false;
    for (int i : b) {
      if (x == i) f1 = true;
      if (y == i) f2 = true;
    }
    if (f1 && f2) {cout << "Yes" << endl; return 0;}
    cout << "No" << endl;
    return 0;
}

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

int main(){
    string s; cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<cstdio>  
#include<cstring>  
#include<algorithm>  
#include<iostream>  
#include<string>  
#include<vector>  
#include<stack>  
#include<bitset>  
#include<cstdlib>  
#include<cmath>  
#include<set>  
#include<list>  
#include<deque>  
#include<map>  
#include<queue>
using namespace std;
typedef long long ll;
const ll inf=1<<29;
const ll Maxn=1e6;

char s[Maxn];

int main(){
	ll a,b;
	double c;
	cin>>a>>b;
	sprintf(s,"%lld",b);
	ll len=strlen(s);
	c=a*pow(10,len)+b;
	c=(ll)c;
	if(sqrt(c)!=(ll)sqrt(c)) printf("No\n");
	else printf("Yes\n");
}

Measured memory_bytes: 512
A, B, C = list(map(int, input().split()))

s = 1
if A < B:
    s = B//A + 1
syo = A*s % B   # 2とか
if s != 1:
    syo2 = A*(s - 1) % B - B
    syo += syo2
if syo == 0 and C == 0:
    print("YES")
elif syo == 0:
    print("NO")
else:
    flag = 0
    for i in range(1,97*93):
        if syo*i % B == C:
            print("YES")
            flag = 1
            break
    if flag == 0:
        print("NO")


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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

const double PI=3.14159265358979323846;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(a) memset(a, 0, sizeof(a))

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

template<class T> void dump(const vector<T> &v)
{
	REP(i, SZ(v)-1){ cout << v[i] << " "; }
	cout << v[SZ(v)-1] << endl;
}

template<class T> void dump(int w, int h, const vector<T> &v)
{
	REP(j, h){
		REP(i, w-1){ cout << v[j * w + i] << " "; }
		cout << v[j * w + w-1] << endl;
	}
}

template<class T> struct Matrix
{
	T w, h;
	vector<T> A;
	Matrix(T w_, T h_) : w(w_), h(h_), A(w * h) {}
	T get(T x, T y) const { return A[y * w + x]; }
};

template<class T> void input(Matrix<T> &m)
{
	REP(j, m.h){
		REP(i, m.w){
			cin >> m.A[j * m.w + i];
		}
	}
}

template<class T> Matrix<T> prod(const Matrix<T> &a, const Matrix<T> &b)
{
	Matrix<T> m(b.w, a.h);

	REP(j, m.h){
		REP(i, m.w){
			ll c = 0;
			REP(k, a.w){
				c += a.A[j * a.w + k] * b.A[k * b.w + i];
			}
			m.A[j * m.w + i] = c;
		}
	}

	return m;
}

void dump(const Matrix<ll> &m)
{
	REP(j, m.h){
		REP(i, m.w-1){ printf("%lld ", m.A[j * m.w + i]); }
		printf("%lld\n", m.A[j * m.w + m.w-1]);
	}
}

void dump(const Matrix<double> &m)
{
	REP(j, m.h){
		REP(i, m.w-1){ printf("%f ", m.A[j * m.w + i]); }
		printf("%f\n", m.A[j * m.w + m.w-1]);
	}
}

int main()
{
	string s, p;
	cin >> s >> p;

	s = s + s;

	if(s.find(p) == string::npos){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}

	return 0;
}



Measured memory_bytes: 3216
a=[2,3,5,10,12,15]
b=[380,550,850,1520,1870,2244]
while 1:
    n=int(input())
    if n==0:break
    n//=100
    dp=[0]+[1<<29]*n
    for i in range(5,-1,-1):
        for j in range(n+1):
            if j+a[i]<=n and dp[j]!=1<<29:dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i])
    print(dp[n])

Measured memory_bytes: 7660
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
void buble(int empir[],int array){
    for(int i=0;i<array;i++){
        for(int j=0;j<array;j++){
            if(empir[i]>empir[j]){
                swap(empir[i],empir[j]);
            }
        }
    }
}
int main(){
    int N,M,x,y,min_element=100000,max_element=-10000;
    cin >> N >> M >> x >> y;
    int x_empir[N],y_empir[M];
    for(int i=0;i<N;i++){
        cin >> x_empir[i];
        if(x_empir[i]>=y){
            cout << "War" << endl;
            return 0;
        }
    }
    for(int i=0;i<M;i++){
        cin >> y_empir[i];
        min_element=min(min_element,y_empir[i]); 
        
    }
    int flag=0;
    if(x<min_element){
    for(int i=0;i<N;i++){
        if(min_element>x_empir[i]){
            flag++;
            if(flag==N){
                cout << "No War" << endl;
                return 0;
            }
        }else{
            cout << "War" << endl;
            return 0;
            }
    }
    }else{
            cout << "War" << endl;
            return 0;
            }


}

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

long long sqrt_(long long x){
  long long ok = 0, ng = 1e9;
  while(ng-ok > 1){
    long long m = (ok+ng)/2;
    if(m*m <= x) ok = m;
    else ng = m;
  }
  return ok;
}

bool solve(long long a, long long b, long long c){
  if(c <= a + b) return false;
  long long r = 2*sqrt_(a*b);
  if(r < c-a-b-1) return true;
  return 4*a*b < (c-a-b)*(c-a-b);
}

int main(){
  long long a, b, c;
  cin >> a >> b >> c;
  cout << (solve(a,b,c) ? "Yes\n" : "No\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, m;
	cin >> n >> m;
	
	int p;
	int ac = 0;
	int wa = 0;
	string s;
	vector<bool> AC(n, false);
	vector<int> WA(n, 0);
	
	for(int i = 0; i < m; ++i) {
		cin >> p >> s;
		p--;
		
		if( AC[p] ) continue;
		
		else if( AC[p] == false ) {
			if( s == "AC" ) { 
				AC[p] = true;
				ac++;
				wa += WA[p];
				
			}
			
			else if( s == "WA" ) WA[p]++;
		} 
	}
	
	cout << ac << " " << wa << endl;
	
	return 0;
}


Measured memory_bytes: 640
# https://atcoder.jp/contests/code-festival-2016-qualc/tasks/codefestival_2016_qualC_b

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
rr = range


def read_ints():
    return list(map(int, read().split()))


K, T = read_ints()
A = read_ints()
if T == 1:
    # コーナーケース
    print(K - 1)
    exit()

# 差が最も少なくなるように二分割すれば良い
# 二分探索でもいいが線形探索で愚直に合計値を計算しても十分間に合う
A.sort()
ans = 2**31
for i in rr(1, T):
    r = sum(A[:i])
    l = sum(A[i:])
    ans = min(ans, abs(r - l))
print(max(ans - 1, 0))


Measured memory_bytes: 38512
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 998244353;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int f[3][100001];
int main() {
	ll n, a, b, M, m;
	cin >> n >> a >> b;
	M = b * n + a - b;
	m = a * n + b - a;
	if (M - m + 1 > 0)printf("%lld\n", M - m + 1);
	else puts("0");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
class Main{
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		int a=s.nextInt();
		int b=s.nextInt();
		int c=s.nextInt();
		if(a*b>c){
			System.out.println(0);
			System.exit(0);
		}
		c-=a*b;
		int d=c+a-1;
		BigInteger bi=new BigInteger("1");
		for(int i=0;i<c;i++){
			bi=bi.multiply(new BigInteger(""+(d-i)));
			bi=bi.divide(new BigInteger(""+(i+1)));
		}
		System.out.println(bi.toString());
	}
}

Measured memory_bytes: 56656
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int p = sc.nextInt();
		sc.close();
		int b = a * 3;
		double c = b + p;

		double d = c / 2;
		double e=Math.floor(d);
		int f=(int)e;
		System.out.println(f);
	}
}


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

int main()
{
	std::string S = "";
	std::cin >> S;

	if (S.at(2) != S.at(3) || S.at(4) != S.at(5))
	{
		std::cout << "No\n";
	}
	else
	{
		std::cout << "Yes\n";
	}

	return 0;
}

Measured memory_bytes: 256
#ABC082 C - Good Sequence
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from collections import defaultdict
N = ni()
A = nl()
D = defaultdict(int)
for a in A:
    D[a] += 1

ans = 0

for d in D:
    if D[d]>=d:
        ans += min(abs(D[d]-d),D[d])
    else:
        ans += D[d]
print(ans)

Measured memory_bytes: 18676
h,w = map(int,input().split())
a = [input() for _ in range(h)]
alpha = [0]*26
for i in range(h):
    for j in range(w):
        alpha[ord(a[i][j])-ord("a")] += 1

ans = "Yes"
odd = 0
cnt = 0

for i in range(26):
    if alpha[i]%2 != 0:
        odd += 1
        alpha[i] -= 1
    if alpha[i]%4 != 0: cnt += 1

if odd > 1: ans = "No"
elif h%2 == 1 and w%2 == 1:
    if cnt > h//2+w//2: ans = "No"
elif h%2 == 1:
    if cnt > w//2: ans = "No"
elif w%2 == 1:
    if cnt > h/2: ans = "No"
else:
    if cnt > 0: ans = "No"
print(ans)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
const long long INF = 1LL << 60;
// map<int,int> mp;

int main() {
  string s;
  cin >> s;
  cout << s.substr(0, 3) << endl;
  // for (int i = 0; i < s.size() - 2; i++) {
  //   cout << s.substr(i, 3) << endl;

  //   string tmp = s.substr(i, 3);
  // }
}

Measured memory_bytes: 3620
a,b,c = gets.split.map{|v|
  v.to_i
}

if a > b
  tmp = b
  b = a
  a = tmp
end

if b > c
  tmp = c
  c = b
  b = tmp
end

if a > b
  tmp = b
  b = a
  a = tmp
end

print a," ",b," ",c,"\n"


Measured memory_bytes: 6860
#include <bits/stdc++.h>
using namespace std;
#define INF 1005
#define MOD 1000000007

int r,c;
vector<string>a;
int mem[INF][INF];

int rec(int ii,int jj)
{
    if(ii==r-1 && jj==c-1) return 1;
    if(mem[ii][jj]!=-1) return mem[ii][jj];
    if(ii>=r || jj>=c) return 0;
    if(a[ii][jj]=='#') return 0;
    return mem[ii][jj]=((rec(ii+1,jj)%MOD)+(rec(ii,jj+1)%MOD))%MOD;
}

int main()
{
    scanf("%d%d",&r,&c);
    for(int i=0;i<r;i++)
    {
        string aa;
        cin >> aa;
        a.push_back(aa);
    }
    memset(mem,-1,sizeof(mem));
    int ans=rec(0,0);
    printf("%d\n",ans);
}


Measured memory_bytes: 5376
function main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var values = input[1].split(" ").map(function(v) { return parseInt(v); });
  insertionSort(values);
}

function insertionSort(a) {
  for (var i = 0; i < a.length; i++) {
    for (var j = i-1; j >= 0; j--) {
      if (a[j+1] < a[j]) {
        var v  = a[j];
        a[j]   = a[j+1];
        a[j+1] = v;
      }
    }
    console.log(a.join(' '));
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7900
p = [True] * 100020
for x in xrange(2, int(100020 ** 0.5) + 1):
    if p[x]:
        for y in xrange(2, 100020):
            if y * x >= 100020:
                break
            p[x * y] = False
p[0], p[1] = False, False
e, s = [], 0
for i in xrange(100020):
    e.append(s)
    if p[i] and p[(i + 1) / 2]:
        s += 1
for _ in xrange(input()):
    (l, r), c = map(int, raw_input().split()), 0
    print e[r + 1] - e[l]


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

namespace ALDS1_5_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(v => int.Parse(v));
            var q = int.Parse(Console.ReadLine());
            var M = Console.ReadLine().Split(' ').Select(v => int.Parse(v));

            foreach(var m in M)
            {
                Console.WriteLine(solve(0, A.ToArray(), 0, m) ? "yes" : "no");
            }

        }

        public static bool solve(int i,int[] A,int sum,int m)
        {
            if (i == A.Length)
                return sum == m;
            return solve(i + 1, A, sum, m) || solve(i + 1, A, sum + A[i], m);
        }
    }
}



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

int main()
{
    int a,s,m,mm,h;
    cin>>a;
    s=a%60;
    mm=a/60;
    m=mm%60;
    h=mm/60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
bool isprime(int v) {
    if (v == 1) return false;
    for (int i = 2; 1LL * i*i <= v; i++) if (v%i == 0) return false;
    return true;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    vector<int> v[5];
    rep(i, 2, 55556) if (isprime(i)) v[i % 5].push_back(i);

    rep(i, 0, N) {
        if (i) printf(" ");
        printf("%d", v[1][i]);
    }
    printf("\n");
}

Measured memory_bytes: 256
n = int(input())

A = []
B = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()

if n%2:
  c=(n+1)//2-1
  print(B[c]-A[c]+1)
else:
  c=n//2
  print(B[c]+B[c-1]-A[c]-A[c-1]+1)


Measured memory_bytes: 25404
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;

int main(){
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n);
  vector<int> b((k?(int)log2(k):0)+1);
  rep(i,n){
    cin >> a[i];
    for(int j=0; k>>j; j++){
      if(!(a[i]>>j&1))
        b[j]++;
      else
        b[j]--;
    }
  }
  ll x=0;
  rep(i,b.size()){
    if(b[i]>0)
      x |= 1LL<<i;
  }
  vector<ll> tmp(1,k);
  rep(i,k?(int)log2(k):0){
    if(k&1LL<<i)
      tmp.push_back((k&~((1LL<<i+1)-1)) + (x&(1LL<<i)-1));
  }
  if(x<=k)
    tmp.push_back(x);
  ll ans=0;
  rep(i,tmp.size()){
    ll t=0;
    rep(j,n)
      t += a[j]^tmp[i];
    ans = max(ans, t);
  }
  cout << ans << endl;  
  return 0;
}

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

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

int N,M;
int A[100000];

int num_two(int n) {
  int i = 0;
  while(n%2==0) {
    i++;
    n/=2;
  }
  return i;
}

signed main() {
  cin >> N >> M;
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) A[i] /= 2;

  int t = num_two(A[0]);
  for(int i=0; i<N; i++) {
    if(t!=num_two(A[i])) {
      puts("0");
      return 0;
    }
    A[i] >>= t;
  }

  M >>= t;

  int d = A[0];
  for(int i=1; i<N; i++) {
    d = lcm(d, A[i]);
    if (d > M) {
      puts("0");
      return 0;
    }
  }
  int ans = ((M/d) +1) /2;
  cout << ans << endl;
}

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


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  bool ans = false;

  rep(i,n){
    if(a[i] % 2 == 0){
      if(a[i] % 3 != 0 && a[i] % 5 != 0) ans = true;
    }
  }

  if(ans) cout << "DENIED" << endl;
  else cout << "APPROVED" << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;

ll gcd(ll a,ll b) {
    while (b>0) {
        ll tmp=b;
        b=a%b;
        a=tmp;
    }
    return a;
}

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<ll> t(n);
    rep(i,n) cin >> t[i];
    ll ans=t[0];
    repr(i,1,n) {
        ll g=gcd(ans,t[i]);
        ans=ans/g*t[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    
    int n,x;
    cin >> n;
    for (int i = 1; i<=n ; i++) {
        x=i;
        if (x%3 == 0) {
            cout << " " << i;
        }
        else{
            do  {
                if  (x%10 == 3) {
                    cout << " " << i;
                    break;
                }else{
                x /=10;
                }
            
            }while (x);
            }
    }
            cout << endl;
  
    return 0;
}

Measured memory_bytes: 1160
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
long long GCD(long long a,long long b){
    if(b==0)return a;
    return GCD(b,a%b);
}
long long LCM(long long a,long long b){
    return a*b/GCD(a,b);
}
const int N = pow(10,6)+10;

VV isp(N+1);

void sieve() {
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i].size()==0) for(int j=2; i*j<=N; j++) {
        isp[i*j].push_back(j);
    }
  }
}//N以下の整数をふるってくれます
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    sieve();
    ll n;
    cin>>n;
    V vec(n);
    rep(i,n)cin>>vec[i];
    map<ll,ll> mp;
    bool h1=false;
    ll tempGCD=vec[0];
    rep(i,n){
        tempGCD=GCD(tempGCD,vec[i]);
    }
    if(tempGCD!=1){
        cout<<"not coprime"<<endl;
        return 0;
    }
    //V isp(1e6+10);
   // map<ll,ll> mp;
    rep(i,n){
        ll temp=vec[i];
        for(auto j:isp[vec[i]]){
            while(temp%j==0){
                temp/=j;
                if(mp[j]!=0){
                    h1=true;
                }
            }
        }
        if(mp[temp]!=0&&temp!=1){
            h1=true;
        }
        for(auto j:isp[vec[i]]){
            mp[j]++;
        }
        mp[temp]++;
    }
    if(h1){
        cout<<"setwise coprime"<<endl;
    }else{
        cout<<"pairwise coprime"<<endl;
    }
}


Measured memory_bytes: 107852
n = gets.chomp
input = gets.split(" ").map{|ele| ele.to_i}
def insertSort(array)
	array.each_with_index do |ele1,i|
		array[0..i].each_with_index do |ele2,j|
			if ele1 < ele2 then
				array.delete_at( i )
				array.insert( j , ele1 )
				break
			end
		end
	p array
	end
end

def p(array)
	output=""
	array.each do |ele|
		output = output + ele.to_s + " "
	end
	output[-1] = ""
	puts output
end
insertSort(input)

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

using namespace std;

const int mod = 1e9 + 7;

long long inverse(long long a) {
  long long m = mod, u = 0, v = 1;
  while (a != 0) {
    long long t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  return u;
}

long long power(long long p, long long e){
  long long ret = 1;
  
  while(e){
    if(e & 1){
      ret *= p;
      ret %= mod;
    }
    p *= p;
    p %= mod;
    e >>= 1;
  }
  
  return ret;
}

int main(){
  int N;
  cin >> N;
  
  map<int, int> lcm;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    int a = A[i];
    for(int p = 2; p * p <= a; p++){
      if(a % p) continue;
      int e = 0;
      while(!(a % p)){
        e++;
        a /= p;
      }
      lcm[p] = max(e, lcm[p]);
    }
    if(a) lcm[a] = max(1, lcm[a]);
  }
  
  long long sum = 0;
  long long l = 1;
  for(auto p : lcm){
    l *= power(p.first, p.second);
    l %= mod;
  }
  
  for(int i = 0; i < N; i++){
    sum += l * inverse(A[i]) % mod;
    sum %= mod;
  }
  
  if(sum < 0) sum += mod;
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 768
using System;

public class B
{
	public static void Main()
	{
		string[] list = new string[]
		{
			"erase",
			"dream",
			"eraser",
			"dreamer"
		};
		string s = Console.ReadLine();
		Array.Reverse(s.ToCharArray());
		int length = s.Length;
		while(0 < length)
		{
			bool flag = false;
			for (int i = 0; i < list.Length; i++)
			{
				if (s.Substring(length - list[i].Length, list[i].Length) == list[i])
				{
					flag = true;
					length -= list[i].Length;
					break;
				}
			}
			if (flag) continue;
			Console.WriteLine("NO");
			return;
		}
		Console.WriteLine("YES");
	}
}

Measured memory_bytes: 13536
class node:
    def __init__(self, s):
        self.id = int(s.split()[0])
        self.dim = int(s.split()[1])
        self.child_ids = None
        if self.dim>0:
            self.child_ids = list(map(int, s.split()[2:]))
        
        self.pearent = None
        self.child = None
    
    def set_pearent(self, p):
        self.pearent = p
    
    def set_depth(self, d):
        self.depth = d
    
    def set_kind(self, k):
        self.kind = k
    
    def __repr__(self):
        str_node = 'node ' + str(self.id) + ': '
        str_pearent = 'parent = ' + str(self.pearent if self.pearent is not None else -1)
        str_depth = 'depth = ' + str(self.depth)
        str_kind = self.kind
        str_child = '[' + ', '.join([str(i) for i in self.child_ids] if self.child_ids is not None else '') + ']'
        return str_node + ', '.join([str_pearent, str_depth, str_kind, str_child])
        

n = int(input())
inputs = [input() for i in range(n)]
nodes = [0]*n

for i in inputs:
    nd = node(i)
    nodes[nd.id] = nd
    
for nd in nodes:
    if nd.child_ids:
        for i in nd.child_ids:
            nodes[i].set_pearent(nd.id)
            
def get_depth(idx):
    nd = nodes[idx]
    d = 0
    while nd.pearent is not None:
        nd = nodes[nd.pearent]
        d += 1
     
    nodes[idx].depth = d

def get_kind(idx):
    nd = nodes[idx]
    if nd.pearent is None:
        nd.kind = 'root'
    elif nd.child_ids:
        nd.kind = 'internal node'
    else:
        nd.kind = 'leaf'

for i in range(n):
    get_depth(i)
    get_kind(i)

for nd in nodes:
    print(nd)


Measured memory_bytes: 70720
# ？？？？？？？？？？？？？？？？？？？？？？？？？？
# ケース12と13、完全にバグとしか思えないのですが?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

# もしかして：頂点1は必ず0？

n = int(input())
a = list(map(int, input().split()))
if a[0] != 0:
    print(0)
    exit()
a = sorted(a)
d = {}
for av in a:
    if av not in d:
        d[av] = 1
    else:
        d[av] += 1

if d[0] != 1:
    print(0)
    exit()
MOD = 998244353

ans = 1
for i in range(1, a[-1] + 1):
    if i not in d:
        ans = 0
        break
    ans *= pow(d[i - 1], d[i], MOD)
print(ans % MOD)

Measured memory_bytes: 23880
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int a,b,c;
    cin>>a>>b>>c;
    if( ( a==b&&b!=c ) || (a==c&&b!=a) || (b==c&&c!=a) ){
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
Imports System
Public Class C300
    Public Shared Sub Main()
        Dim N As Integer
        N = Console.ReadLine()
        Dim a, b, c, d As Integer
        d = N Mod 10
        c = ((N - d) / 10) Mod 10
        b = ((N - d - 10 * c) / 100) Mod 10
        a = (N - d - 10 * c - 100 * b) / 1000
        Dim op(2) As Boolean
        For i As Integer = 0 To 1
            For j As Integer = 0 To 1
                For k As Integer = 0 To 1
                    If a + (-1) ^ i * b + (-1) ^ j * c + (-1) ^ k * d = 7 Then
                        op(0) = Bool(i)
                        op(1) = Bool(j)
                        op(2) = Bool(k)
                    End If
                Next
            Next
        Next
        Dim output As String
        output = a & Operate(op(0)) & b & Operate(op(1)) & c & Operate(op(2)) & d & "=7"
        Console.WriteLine(output)
    End Sub
    Public Shared Function Operate(input As Boolean) As String
        If input Then
            Return "-"
        Else
            Return "+"
        End If
    End Function
    Public Shared Function Bool(input As Integer) As Boolean
        Select Case input
            Case 0
                Return False
            Case 1
                Return True
            Case Else
                Return -1
        End Select
    End Function
End Class


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

int main(){
	int n,array[100][100],a,b,c;
	for(int i = 0;i < 100;++i){
		for(int j = 0;j < 100;++j){
			array[i][j] = 0;
		}
	}
	cin >> n;
	for(int i = 0;i < n;++i){
		cin >> a >> b;
		for(int j = 0;j < b;++j){
			cin >> c;
			array[a - 1][c - 1] = 1;
		}
	}
	for(int i = 0;i < n;++i){
		for(int j = 0;j < n;++j){
			if(j != 0) cout << " ";
			cout << array[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>
#define INF 1 << 30
#define MOD 1000000007;
#define pi 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
static const int dx[] = {0, 0, 1, -1};
static const int dy[] = {-1, 1, 0, 0};

int main() { 
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  if (a[0] + a[1] == a[2]) {
    D("Yes");
  } else {
    D("No");
  }
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define mp1(a,b,c) P1(a,P(b,c))
#define pque(a) priority_queue<a>
#define rpque(a) priority_queue<a,vector<a>,greater<a>>

const ll INF=1000000000000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const int kaijou[10]={1,1,2,6,24,120,720,5040,40320,362880};

ll dist(P x,P y){
	return (x.fr-y.fr)*(x.fr-y.fr) + (x.sc-y.sc)*(x.sc-y.sc);
}

int main(){
	ll n,f[102],a[102],t[102],x[102],y[102];
	cin >> n;
	rep(i,n){
		cin >> f[i] >> a[i] >> t[i] >> x[i] >> y[i];
	}
	
	ll rd_a = -1,rt_a = -1;
	ll rd_b = -1,rt_b = -1;
	rep1(i,n-1){
		if(a[i] != a[i-1] && t[i] == t[i-1]){
			ll d = dist(P(x[i],y[i]),P(x[i-1],y[i-1]));
			if(t[i] == 0){
				if(rd_a < d){
					rd_a = d;
					rt_a = f[i]-f[i-1];
				}
				else if(rd_a == d){
					rt_a = min ( rt_a , f[i]-f[i-1] );
				}
			}
			else {
				if(rd_b < d){
					rd_b = d;
					rt_b = f[i]-f[i-1];
				}
				else if(rd_b == d){
					rt_b = min ( rt_b , f[i]-f[i-1] );
				}
			}
		}
	}
	
	cout.precision(10);
	
	if(rd_a == -1)puts("-1 -1");
	else cout << sqrt((ld)rd_a) << " " << rt_a/60.0 << endl;
	if(rd_b == -1)puts("-1 -1");
	else cout << sqrt((ld)rd_b) << " " << rt_b/60.0 << endl;
}

Measured memory_bytes: 1248