akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int N;
int main() {
	cin >> N;
	
	int ma = -1, m = 0;
	REP(i, N) {
		int a, b;
		scanf("%d %d", &a, &b);
		if (chmax(ma, a)) m = b;
	}
	
	
	cout << ma + m << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
 int a , b , c;
  cin >> a >> b >> c;
  cout << max({a , b , c}) - min({a , b , c}) << endl;
}


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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;


struct SegTreeMax {
    ll N, dat[5 * 500000];

    SegTreeMax(ll n) {
        N = 1;
        while (N < n) N *= 2;
        for (ll i = 0; i < 2 * N - 1; i++)
            dat[i] = -INF;
    }

    // update k th element
    void update(ll k, ll a) {
        k += N - 1; // leaf
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }

    // max [a, b)
    ll query(ll a, ll b) { return query(a, b, 0, 0, N); }

    ll query(ll a, ll b, ll k, ll l, ll r) {
        if (r <= a or b <= l) return -INF;
        if (a <= l and r <= b) return dat[k];
        ll m = (l + r) / 2;
        return max(query(a, b, k * 2 + 1, l, m), query(a, b, k * 2 + 2, m, r));
    }
};

int main() {

    int n, q;
    string s;
    cin >> n >> s >> q;

    vector<SegTreeMax> segs(26, SegTreeMax(n));

    rep(i, 26) {
        rep(j, n) {
            segs[i].update(j, 0);
        }
    }

    rep(i, s.size()) {
        char c = s[i];
        segs[c - 'a'].update(i, 1);
    }

    rep(i, q) {
        int method;
        cin >> method;
        if (method == 1) {
            int j;
            char c;
            cin >> j >> c;
            j--;

            rep(k, 26) {
                segs[k].update(j, 0);
            }
            segs[c - 'a'].update(j, 1);

        } else {
            int l, r;
            cin >> l >> r;
            l--;
            int ans = 0;
            rep(k, 26) {
                int now = segs[k].query(l, r);
                assert(now == 1 || now == 0);
                ans += now;
            }
            cout << ans << endl;
        }
    }
}


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

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS)

class Point {
public:
	int id;
	double x, y;

	Point (int id = -1, double x = 0, double y = 0):id(id),x(x),y(y){}

	Point operator+(Point p) { return Point(id, x + p.x, y + p.y); }
	Point operator-(Point p) { return Point(id, x - p.x, y - p.y); }
	Point operator*(double a) { return Point(id, x * a, y*a); }
	Point operator/(double a) { return Point(id, x/a, y/a); }

	double abs() { return sqrt(norm()); }
	double norm() { return x * x + y * y; }

	bool operator<(const Point &p)const {
		return x != p.x ? x<p.x : y<p.y;
	}

	bool operator==(const Point &p)const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }

int ccw(Point p0, Point p1, Point p2) {
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if (cross(a, b) > EPS)return COUNTER_CLOCKWISE;
	if (cross(a, b) < -EPS)return CLOCKWISE;
	if (dot(a, b) < -EPS)return ONLINE_BACK;
	if (a.norm() < b.norm())return ONLINE_FRONT;

	return ON_SEGMENT;
}

#define PI 3.1415926535

double angle(Vector a, Vector b) {
	double lenA = a.abs();
	double lenB = b.abs();

	double cos_sita = dot(a, b) / (lenA * lenB);
	cos_sita = max(-1., min(1., cos_sita));
	double sita = acos(cos_sita);

	sita = sita * 180 / PI;

	return sita;
}

Polygon andrewScan(Polygon s) {
	Polygon u, l;
	if (s.size() < 3)return s;
	sort(s.begin(), s.end());
	u.push_back(s[0]);
	u.push_back(s[1]);
	l.push_back(s[s.size() - 1]);
	l.push_back(s[s.size() - 2]);

	for (int i = 2; i < s.size(); i++) {
		for (int n = u.size(); n >= 2 && ccw(u[n - 2], u[n - 1], s[i]) != CLOCKWISE; n--) {
			u.pop_back();
		}
		u.push_back(s[i]);
	}

	for (int i = s.size() - 3; i >= 0; i--) {
		for (int n = l.size(); n >= 2 && ccw(l[n - 2], l[n - 1], s[i]) != CLOCKWISE; n--) {
			l.pop_back();
		}
		l.push_back(s[i]);
	}

	reverse(l.begin(), l.end());
	for (int i = u.size() - 2; i >= 1; i--)l.push_back(u[i]);

	return l;
}

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

	Polygon Ps(N);
	for (int i = 0; i < N; i++) {
		cin >> Ps[i].x >> Ps[i].y;
		Ps[i].id = i;
	}

	Polygon andrew = andrewScan(Ps);

	vector<double>ans(N);

	int size = andrew.size();
	for (int i = 0; i < andrew.size(); i++) {
		Vector a, b;
		a.x = andrew[(i + 1) % size].x - andrew[i].x;
		a.y = andrew[(i + 1) % size].y - andrew[i].y;

		b.x = andrew[(i - 1 + size) % size].x - andrew[i].x;
		b.y = andrew[(i - 1 + size) % size].y - andrew[i].y;

		double ang = angle(a, b);
		ans[andrew[i].id] = (180 - ang) / 360.;
	}

	for (int i = 0; i < N; i++)cout <<fixed<<setprecision(8)<< ans[i] << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] nonuse = new int[10];
    for(int i = 0; i < k; i++) {
      nonuse[sc.nextInt()] = 1; 
    }
    int ans = n;
    while(true) {
      int p = 0;
      String s = String.valueOf(ans);
      for(int i = 0; i < s.length(); i++) {
        int d = Integer.parseInt(String.valueOf(s.charAt(i)));
        if(nonuse[d] == 1) p++;
      }
      if(p == 0) {
        break;
      } else {
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 37892
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

const int MOD = 1e9 + 7;

class Modint {
public:
	long long val;

	Modint (long long _val = 0)
		: val((_val + MOD) % MOD) {}

	Modint operator+ (Modint other) {
		return Modint(val + other.val);
	}

	void operator+= (Modint other) {
		val += other.val;
		val %= MOD;
	}

	Modint operator- () {
		return Modint(MOD - val);
	}

	Modint operator- (Modint other) {
		return Modint(val + MOD - other.val);
	}

	void operator-= (Modint other) {
		val += MOD - other.val;
		val %= MOD;
	}

	Modint operator* (Modint other) {
		return Modint(val * other.val);
	}

	void operator*= (Modint other) {
		val *= other.val;
		val %= MOD;
	}

	bool operator== (Modint other) {
		return val == other.val;
	}

	bool operator!= (Modint other) {
		return val != other.val;
	}
};

Modint exp (Modint a, int k) {
	if (k == 0) {
		return Modint(1);
	} else if (k % 2 == 0) {
		Modint half = exp(a, k / 2);
		return half * half;
	} else {
		return a * exp(a, k - 1);
	}
}

Modint inv (Modint a) {
	return exp(a, MOD - 2);
}

ostream& operator<< (ostream& out, Modint p) {
	out << p.val;
	return out;
}


int n;
string L;
vector<vector<Modint>> dp;

Modint func(int i, bool flg) {
	if (i == n) return 1;

	if (dp[i][flg] != 0) return dp[i][flg];

	Modint res = 0;

	if (flg == true) {
		if (L[i] == '0') res += func(i + 1, true);
		else res += (Modint(2) * func(i + 1, true) + func(i + 1, false));
	}
	else res += Modint(3) * func(i + 1, false);

	return dp[i][flg] = res;
}

int main() {

	cin >> L;
	n = L.length();
	dp.resize(n + 1, vector<Modint>(2, 0));

	cout << func(0, true);

	return 0;
}


Measured memory_bytes: 14432
#include <climits>
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
#include <deque>
using namespace std;

int main(int, char**)
{
	long N, Q;
	cin >> N >> Q;
	vector<vector<long>> neighbors(N);
	for (long i = 0; i < N - 1; ++i)
	{
		long a, b;
		cin >> a >> b;
		--a;
		--b;
		neighbors[a].push_back(b);
		neighbors[b].push_back(a);
	}
	vector<long> counter(N, 0);
	for (long i = 0; i < Q; ++i)
	{
		long p, x;
		cin >> p >> x;
		--p;
		counter[p] += x;
	}
	vector<bool> checked(N, false);
	deque<long> que;
	que.push_back(0);
	while (!que.empty())
	{
		long p = que.front();
		que.pop_front();
		checked[p] = true;
		for (const auto q : neighbors[p])
		{
			if (!checked[q])
			{
				que.push_back(q);
				counter[q] += counter[p];
			}
		}
	}
	for (long i = 0; i < N; ++i)
	{
		cout << counter[i];
		if (i == N - 1)
		{
			cout << endl;
		}
		else
		{
			cout << " ";
		}
	}

	return 0;
}


Measured memory_bytes: 17904
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


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


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll a,b,k;
  	cin>>a>>b>>k;
  ll m=max(0LL,a-k);
  k=max(0LL,k-a);
  cout<<m<<" "<<max(0LL,b-k)<<"\n";
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    x = LI()

    print(x.index(0)+1)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 9072
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <numeric>
#include <math.h>

using namespace std;

typedef long long ll;

int main(void){
    ll w,h,x,y;
    cin >> w >> h >> x >>y;
    printf("%lf %d\n",(double)w * (double)h / 2, x*2 == w && y*2 == h);
}


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

const int MAX = 200000;
int main() {
	int N, A, B;
	cin >> N;
	static pair<int, pair<bool, int> > edge[MAX];
	for (int i = 0;i < N;++ i) {
		cin >> A >> B;
		edge[i << 1] = make_pair(A, make_pair(true, i));
		edge[(i << 1) + 1] = make_pair(B, make_pair(false, i));
	}
	sort(edge, edge+(N << 1));
	
	static bool use[MAX];
	int64_t ans = 0;
	for (int i = 0;i < N;++ i) use[i] = false;
	for (int i = 0;i < N;++ i) ans += edge[i].first;
	
	for (int i = 0;i < N;++ i) {
		if (use[edge[i].second.second]) {
			cout << ans;
			return 0;
		}
		use[edge[i].second.second] = true;
	}
	for (int i = 0;i < N - 1;++ i) {
		if (edge[i].second.first != edge[i + 1].second.first) {
			if (edge[N - 1].second.second != edge[N].second.second) ans += edge[N].first - edge[N - 1].first;
			else ans += min(edge[N].first - edge[N - 2].first, edge[N + 1].first - edge[N - 1].first);
			break;
		}
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

解説ACしたので見なくて良いよ

3
[1] 5
[4] [2]
6 3

4
[1] 5
[2] 6
[3] 7
[4] 8

6
[19] 92
[64] 64
78 [48]
[57] [33]
73 [6]
95 73

まず、最も小さい値のみを選ぶことができないか考える
これができない時とは？相手側に自分より小さい値が存在しない時
そこで、Aから選ぶ個数を決め打ってしまう
その時、Bの方にちゃんと対応関係を作れればok

さて、これが可能か考える

6
[19] 92
[57] [33]
[64] 64
73 [6]
78 [48]
95 73
の場合で考えると、次のようになる
[19] - 92, 73, 64, 48, 33, 6 - 可能, この時はBsum-92+19だけのコスト
[19][57] - 92, 73, 64, 48, 33, 6 - 可能、この時はBsum-92-33+19+57だけのコスト
[19][57][64] - 92, 73, 64, 48, 33, 6 - 可能(19-33,57-64,64-73)
[19][57][64][73] - 92, 73, 64, 48, 33, 6 - 可能(19-33,57-64,64-73,73-92)、同文
[19][57][64][73][78] - 不可能(19-33,57-64,64-73,73-92,78-×)

さて、これA決め打ちなのでコストO(N)
で、見てみると分かるがマッチングは前の計算を使えるので全体O(N)
で、もしマッチング成立した場合は任意により大きい数に繋ぎなおせる(ただし1個の場合を除く)ので
この時のコスト計算はマッチングしたのをBSumから外すのでO(1)
全体O(NlogN)

……とかやってたが解けなかったので解説ACです
*/

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;

int main(){
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  rep(i, N-2){
    string T = S.substr(i, 3);
    if (T == "ABC") ans++;
  }
  cout << ans << endl;
}


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

public class Main{

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		out.println(sc.nextInt()*1.0/sc.nextInt());
		out.close();

	}
	
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}


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

int H,W;
char S[22][22];

bool used[22][22];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int dfs(int x,int y){
  used[x][y]=true;
  int res=1;
  for(int i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];
    if(nx<0||ny<0||nx>=H||ny>=W) continue;
    if(used[nx][ny]) continue;
    if(S[nx][ny]!='.') continue;
    res+=dfs(nx,ny);
  }
  return res;
}

void solve(){
  for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>S[i][j];
  for(int i=0;i<H;i++) for(int j=0;j<W;j++) used[i][j]=false;

  int stx,sty;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S[i][j]=='@'){
        stx=i;
        sty=j;
      }
    }
  }

  cout<<dfs(stx,sty)<<endl;

}

int main(){
  while(1){
    cin>>W>>H;
    if(W==0) break;
    solve();
  }

  return 0;
}



Measured memory_bytes: 3052
class _Node {
  constructor(key, parent = null, left = null, right = null) {
    this.key = key;
    this.parent = parent;
    this.left = left;
    this.right = right;
  }
}

class BinaryTree {
  constructor() {
    this.root = null;
  }

  static get Node() { return _Node; }

  insert(key) {
    this.root = new BinaryTree.Node(key, null, null, null);
    this.insert = (key) => {
      let x = this.root, y;
      let newNode = new BinaryTree.Node(key, null, null, null);
      while (x != null) [y, x] = [x, x[key < x.key ? 'left' : 'right']];
      newNode.parent = y;
      y[key < y.key ? 'left' : 'right'] = newNode;
    }
  }

  printByIneorder() {
    let str = '';
    let innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root)
    console.log(str);
  }

  printByPreorder(n = this.root) {
    let str = '';
    let innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root)
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.map((line) => line.split(' ')).forEach(function(cmd) {
    switch(cmd[0].charAt(0)) {
    case 'i': tree.insert(Number(cmd[1])); break;
    default: tree.print();
    }
  });

})();



Measured memory_bytes: 301632
n = int(input())
d = {}
for i in range(n):
    t = input()
    if t not in d:
        d[t] = 1
    else:
        d[t] += 1
if "AC" in d:
    print("AC x",d["AC"])
else:
    print("AC x",0)
if "WA" in d:
    print("WA x",d["WA"])
else:
    print("WA x",0)
if "TLE" in d:
    print("TLE x",d["TLE"])
else:
    print("TLE x",0)
if "RE" in d:
    print("RE x",d["RE"])
else:
    print("RE x",0)
    

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

namespace ABC148
{
    class E
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            if (N % 2 != 0) { Console.WriteLine(0); return; }

            long res = 0;
            N /= 2;
            while (5 <= N)
            {
                res += N / 5;
                N /= 5;
            }
            Console.WriteLine(res);

        }
    }
}


Measured memory_bytes: 13140
package main

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

var sc = bufio.NewScanner(os.Stdin)

func swap(a int64, b int64) (int64, int64) {
	return b, a
}

func gcd(a int64, b int64) int64 {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return gcd(a%b, b)
	}
}

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

func min(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func nextLong() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func nextByte() byte {
	sc.Scan()
	s := sc.Bytes()
	return s[0]
}

func main() {
	sc.Split(bufio.ScanWords)
	//ans := 1
	N := nextInt()
	M := nextInt()
	MOD := 1000000007
	var DP [100005]int
	DP[0] = 1
	var broken [100005]bool
	for i := 0; i < M; i++ {
		a := nextInt()
		broken[a] = true
	}
	for i := 0; i < N; i++ {
		if !broken[i+1] {
			DP[i+1] = (DP[i+1] + DP[i]) % MOD
		}
		if !broken[i+2] {
			DP[i+2] += (DP[i+2] + DP[i]) % MOD
		}
	}
	fmt.Printf("%d\n", DP[N])
}


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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef map<ll, ll> mii;
const int MOD = 1e9 + 7;

#define fastIO() \
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mp make_pair 

int main() {
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5] && s.length() == 6) {
        cout << "Yes" << endl;
    } else  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 REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll n,a;
    cin >> n;
    vpll p(n);
    rep(i,n){
        cin >> a;
        p[i]=m_p(a,i+1);
    }
    sort(all(p));
    rep(i,n) cout << p[i].second << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 2432
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        int a[] = new int[n];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            sum += a[i];
        }

        long onetime = n;
        onetime *= n + 1;
        onetime /= 2;
        if (sum % onetime != 0) {
            end();
        }

        int times = (int) (sum / onetime);
        for (int i = 0; i < n; i++) {
            int d = a[(i + 1) % n] - a[i] - times;
            if (d > 0 || d % n != 0) {
                end();
            }
        }

        System.out.println("YES");
    }

    private void end() {
        System.out.println("NO");
        System.exit(0);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 50360
/* ===========================================
=========================================== */
//==========================================c#
using System; //Console, IComparable
using System.IO; //StreamWriter 
using System.Linq; //Select(), Where(), OrderBy(), Count()
using System.Collections.Generic; //List<T>

public static class Run{
    private static class gv{
        public static int A, B, M = 0;
        public static List<int> renzi;
        public static List<int> reizo;
    }
    
    public static void build(){
        IOC io = new IOC(); string[] input;
        input = io._stringa;
        gv.A = int.Parse(input[0]);
        gv.B = int.Parse(input[1]);
        gv.M = int.Parse(input[2]);
        
        gv.renzi = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        gv.reizo = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
    }
    
    public static void solve(){
        StreamWriter so = new StreamWriter(Console.OpenStandardOutput());
        
        var ans = gv.renzi.Min() + gv.reizo.Min();
        
        for (int i = 0; i < gv.M; i++) {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var rx = input[0];
            var ry = input[1];
            var rc = input[2];
            
            var ans_buf = gv.renzi[rx -1] + gv.reizo[ry -1] - rc;
            ans = Math.Min(ans, ans_buf);
            
        }
        
        Console.WriteLine(ans);
    }
}

class Program { 
    static void Main() { 
        Run.build();
        Run.solve();
    } 
}

public class IOC{
    public int _int{get{return int.Parse(Console.ReadLine());}}
    public int[] _inta{get{return Array.ConvertAll(Console.ReadLine().Split(), int.Parse);}}
    public long _long{get{return long.Parse(Console.ReadLine());}}
    public long[] _longa{get{return Array.ConvertAll(Console.ReadLine().Split(), long.Parse);}}
    public string _string{get{return Console.ReadLine();}}
    public string[] _stringa{get{return (Console.ReadLine().Split());}}
    public double _double{get{return double.Parse(Console.ReadLine());}}
    public double[] _doublea{get{return Array.ConvertAll(Console.ReadLine().Split(), double.Parse);}}
}


/* ===========================================
            int n = int.Parse(Console.ReadLine());

for(int i = 0; i < n; i++){
                int sum = Console.ReadLine().Split().Select(int.Parse).Sum();
                so.WriteLine(sum.ToString());
            }
            so.Close();
=========================================== */


Measured memory_bytes: 39388
#include <cstdio>



long gcd(long a, long b){//a>bをやくそく
	if(a < b){
		printf("error1\n");
	}
	if(a % b == 0){
		return b;
	}else{
		return gcd(b, a % b);
	}
}

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

int main(){
	long n;
	scanf("%ld", &n);
	long ans = 1;
	for(long i = 0; i < n; i++){
		long t;
		scanf("%ld", &t);
		if(t > ans){
			ans = ans / gcd(t, ans) * t;
		}else{
			ans = t / gcd(ans, t) * ans;
		}
	}
	printf("%ld\n", ans);
	return 0;
}

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

void trace(int a[], int n)
{
  int i;
  for (i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

void insertionSort(int a[], int n)
{
  int j, i, v;
  for (i = 1; i < n; i++) {
    trace(a, n);
    v = a[i];
    j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = v;
  }
}
int main(void)
{
  int n, a[100];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];

  insertionSort(a, n);
  trace(a, n);

  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n,m;
  cin>>m>>n;
  int ans=0;
  rep(i,m){
    int num=0;
    int a;
    rep(j,n){
      cin>>a;
      num+=a;
    }
    ans=max(ans,num);
  }
  cout<<ans<<endl;
}

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

int main(){
	int n;
	cin >> n;
	for( ; n-- ; ){
		set<string> ans;
		string s;
		
		cin >> s;
		for(int i=0 ; i <= s.size()-2 ; i++ ){
			// s1 := s[0..i]
			// s2 := s[i+1..s.size()-1]
			string s1, s2; 
			for(int j=0 ; j <= i ; j++ ){
				s1.push_back( s[j] );
			}
			for(int j=i+1 ; j < s.size() ; j++ ){
				s2.push_back( s[j] );
			}
			ans.insert( s1 + s2 );
			ans.insert( s2 + s1 );
			reverse( s1.begin() , s1.end() );
			ans.insert( s1 + s2 );
			ans.insert( s2 + s1 );
			reverse( s2.begin() , s2.end() );
			ans.insert( s1 + s2 );
			ans.insert( s2 + s1 );
			reverse( s1.begin() , s1.end() );
			ans.insert( s1 + s2 );
			ans.insert( s2 + s1 );
		}
		cout << ans.size() << endl;
	}
}

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

int main(){
    int n,m;
    cin >> n >> m;
    VI x(n);
    rep(i,n) cin >> x[i];

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

    VVI y(m,VI());
    rep(i,n){
        int r = x[i] % m;
        y[r].push_back(x[i]);
    }

    int ans=0;
    ans += y[0].size() / 2;
    if(m%2 == 0) ans += y[m/2].size() / 2;

    rep2(i,1,(m+1)/2){
        VI s = y[i];
        VI t = y[m-i];
        if(s.size() < t.size()) swap(s,t);
        sort(s.begin(), s.end());
        bool flag = true;

        while(s.size() > t.size()+1 && flag){
            flag = false;
            rep(i,s.size()-1){
                if(s[i] == s[i+1]){
                    s.erase(s.begin()+i);
                    s.erase(s.begin()+i);
                    flag = true;
                    ans++;
                    break;
                }
            }
        }
        ans += t.size();
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6144
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    bool path[n][n] = {};
    for(int i = 0;i < m;i++)
    {
        int a,b;
        cin >> a >> b;
        path[a - 1][b - 1] = true;
        path[b - 1][a - 1] = true;
    }
    int perm[n];
    for(int i = 0;i < n;i++)
    {
        perm[i] = i + 1;
    }
    int ans = 0;
    do
    {
        if(perm[0] != 1)
        {
            break;
        }
        bool flag = true;
        for(int i = 1;i < n;i++)
        {
            if(!path[perm[i - 1] - 1][perm[i] - 1])
            {
                flag = false;
                break;
            }
        }
        if(flag)
        {
            ans++;
        }
    } while (next_permutation(perm,perm + n));
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long d,a,b,c,ans=0;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    for(int i=0;i<=a;i++)
    for(int j=0;j<=b;j++)
    for(int k=0;k<=c;k++)
	{
        int o=i*500+j*100+k*50;
        if(o==d)ans++;
        else if(o>d)break;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <iostream>
using namespace std;
typedef long long ll;

const int N=55;
ll ans[N];
void solve(){
    ll k;
    scanf("%lld",&k);
    int n=50;
    for(int i=1;i<=n;i++) ans[i]=n-1;
    for(int i=1;i<=n;i++){
        ll cnt=k/n;
        if(i<=k%n) cnt++;
        ans[i]+=cnt*n-(k-cnt);
    }
    printf("50\n");
    for(int i=1;i<=n;i++) printf("%lld%c",ans[i],i==n?'\n':' ');
}

int fuck(){
    int id=1;
    for(int i=2;i<=50;i++){
        if(ans[i]>ans[id]) id=i;
    }
    return id;
}

int main(){
    solve();
    /*
    ll cnt=0;
    multiset<ll>st;
    int n=50;
    while(ans[fuck()]>=n){
        int id=fuck();
        for(int i=1;i<=n;i++){
            if(i!=id) ans[i]++;
        }
        ans[id]-=n;
        cnt++;
    }
    cout<<cnt<<endl;
    */
}


Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 105 A - AtCoder Crackers
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/16
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int n, k;

void solve() {
    
    int rem = n % k;
    if (rem == 0)
        printf("0\n");
    else
        printf("1\n");

}

int main() {

    scanf("%d", &n);
    scanf("%d", &k);

    solve();

}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(void) {
    ll a,b;
    cin>>a>>b;
    if(a>8||b>8){
        cout << ":(" << endl;
    }
    else{
        cout << "Yay!" << endl;
    }
    return 0;
}

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

using namespace std;


int main(){
    int answer=0;
    string S;
    cin >> S;
    for(int i=0;i<S.length()/2;i++){
        if(S[i]!=S[S.length()-i-1])answer++;
    }
    cout <<answer<< endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;

int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
char c[3][3];
string s;
bool f;

void calc(int x, int y, int n){
	if(n == s.size() || f) {
		f = true;
		return ;
	}
	for(int i = 0; i < 4; i++){
		int nx = x + dx[i], ny = y + dy[i];
		if(nx >= 0 && nx < 3 && ny >= 0 && ny < 3){
			if(c[nx][ny] == s[n]){
				//cout<<s[n]<<endl;
				calc(nx, ny, n + 1);
			}
		}
	}
}

int main(){
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			c[i][j] = 'A' + i * 3 + j;
		}
	}
	// for(int i = 0; i < 3; i++){
	// 	for(int j = 0; j < 3; j++){
	// 		cout<<c[i][j];
	// 	}
	// 	cout<<endl;
	// }
	while(cin>>s){
		f = false;
		calc((s[0]-'A')/3, (s[0]-'A')%3, 1);
		if(f) cout<<s<<endl;
	}
}

Measured memory_bytes: 1172
#include <iostream>
#include <iomanip>
#include <vector>
#include <complex>

using namespace std;

typedef complex<int> Point;

int Signum(int n)
{
	return n>0?1:n<0?-1:0;
}
int Dot(Point a,Point b)
{
	return real(conj(a)*b);
}
int Cross(Point a,Point b)
{
	return imag(conj(a)*b);
}
int CCW(Point a,Point b,Point c)
{
	Point d1=b-a,d2=c-a;
	int sign=Signum(Cross(d1,d2));
	if(sign)
		return sign;
	if(Dot(d1,d2)<0)
		return -2;
	if(norm(d1)<norm(d2))
		return 2;
	return 0;
}

int main()
{
	for(int n;cin>>n,n;){
		vector<Point> ps(n);
		for(int i=0;i<n;i++)
			cin>>real(ps[i])>>imag(ps[i]);
		
		vector<int> uses(n);
		Point cur(0,0);
		double res=0;
		for(int i=0;i<n;i++){
			int j=-1;
			for(int k=0;k<n;k++){
				if(uses[k])
					continue;
				int ccw=CCW(cur,ps[j],ps[k]);
				if(j==-1 || ccw==0 || ccw==1)
					j=k;
			}
			res+=sqrt(norm(ps[j]-cur));
			uses[j]=1;
			cur=ps[j];
		}
		cout<<fixed<<setprecision(1)<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
using namespace std;

char s[3005],t[3005];
int dp[3005][3005],pre[3005][3005],n,m;

void print(int x, int y)
{
	if(x==0||y==0)
		return ;
	if(pre[x][y]==2)
	{
		print(x-1,y-1);
		putchar(s[x]);
	}
	else if(pre[x][y])
		print(x,y-1);
	else
		print(x-1,y);
}

int main()
{
	scanf("%s%s",s+1,t+1);
	n=strlen(s+1);
	m=strlen(t+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(dp[i][j-1]>dp[i][j])
				dp[i][j]=dp[i][j-1],pre[i][j]=1;
			if(dp[i-1][j-1]+(s[i]==t[j])>dp[i][j])
				dp[i][j]=dp[i-1][j-1]+(s[i]==t[j]),pre[i][j]=2;
		}
	print(n,m);
	return 0;
}

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

const int INF = 1e9 + 10;

int main() {
  int N, K; cin >> N >> K;
  vector<int> h(N + K); rep(i, N) cin >> h[i];
  vector<int> dp(N + K, INF);

  dp[0] = 0;
  rep(i, N) {
    for (int k = 1; k <= K; k++) {
      int cost = abs(h[i + k] - h[i]);
      dp[i + k] = min(dp[i + k], dp[i] + cost);
    }
  }

  cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1024
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
class ProgramC
    {
        static void Main(string[] args)
        {
            
            //入力
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int sum = 0;
            int ans = 100000000;
            

            //すべての和を求める
            for(int i = 0;i < 100;i++)
            {
                for(int j = 0;j < n ;j++)
                {
                    int temp  = int.Parse(input[j]);
                    sum += (temp - i)*(temp -i);
                }

                if(sum < ans)
                    ans = sum;
                sum = 0;
            }

            
            Console.WriteLine(ans);
        } 
    }  

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

using namespace std;

int main()
{
    int num;
    int tscore = 0;
    int hscore = 0;
    string tStr;
    string hStr;
    
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        cin >> tStr >> hStr;
        if (tStr > hStr)
        {
            tscore += 3;
        }
        else if (tStr == hStr)
        {
            tscore++;
            hscore++;
        }
        else
        {
            hscore += 3;
        }
    }
    
    cout << tscore << " " << hscore << endl;
    
    return 0;
}



Measured memory_bytes: 3164
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())

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

  int n;
  ll y;
  cin >> n;
  cin >> y;

  int fuku = -1;
  int higu = -1;
  int nogu = -1;

  bool foundAns = false;
  int maxFuku = y/10000;
  REP(i, maxFuku+1) {
    REP(j, n-i+1) {
      if((y - (i * 10000 + j * 5000)) / 1000 == n-i-j) {
        foundAns = true;
        fuku = i;
        higu = j;
        nogu = (y - (i * 10000 + j * 5000)) / 1000;
        break;
      }
    }
    if(foundAns) {
      break;
    }
  }

  cout << fuku << " " << higu << " " << nogu << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dd double

using namespace std;


int main(){
    int N;
    cin >> N;
    vector<int> A(N + 1);
    vector<int> B(N + 1);
    for(int i = 1; i < N + 1; i++){
        cin >> A[i];
        B[A[i]] = i;
    }
    for(int i  = 1; i < N + 1; i++){
        cout << B[i] << " ";
    } 
    cout << endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MAX_N = 1e5 + 5;

string typeOf[MAX_N];

string GetTypeOf(int ind) {
	if(typeOf[ind] == "") {
		cout << ind << endl << flush;
		
		string s;
		cin >> s;
		typeOf[ind] = s;
	}

	return typeOf[ind];
}

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

	int n;
	cin >> n;
	
	if(GetTypeOf(0) != "Vacant") {
		typeOf[n] = GetTypeOf(0);

		int low = 1, high = n - 1;
		while(low < high) {
			int mid = (low + high) / 2;
				
			if(GetTypeOf(mid) == "Vacant") {
				return 0;
			}
			
			if((mid % 2 == 0 && GetTypeOf(0) == GetTypeOf(mid)) || (mid % 2 != 0 && GetTypeOf(0) != GetTypeOf(mid))) {
				low = mid + 1;
			}
			else {
				high = mid - 1;
			}
		}

		GetTypeOf(low);
	}
	
	return 0;
}


Measured memory_bytes: 1996
#include<stdio.h>
#define LARGE 2000
#define INF 1000000000
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int V,e;

typedef struct edge{
	int from;
	int to;
	int cost;
}edge;

int BellmanFord(edge E[],int C[],int start){
	int i,j;
	int cnt=0;
	for(j=0;j<V-1;j++){
	
		for(i=0;i<e;i++){
			if(C[E[i].from]!=INF && C[E[i].to] > C[E[i].from]+E[i].cost){
				C[E[i].to]=C[E[i].from]+E[i].cost;
				cnt++;
				if(C[start]<0){
					printf("NEGATIVE CYCLE\n");
					return 0;
				}
			}
		}
		
	}
	
	if(cnt>e){
		printf("NEGATIVE CYCLE\n");
		return 0;
	}
	
	return 1;
}
	
	

int main(){
	int start;
	int s,t,d;
	int i,flg;
	int C[LARGE];
	edge E[LARGE];
	
	scanf("%d %d %d",&V,&e,&start);
	
	for(i=0;i<e;i++){
		scanf("%d %d %d",&s,&t,&d);
		E[i].from=s;
		E[i].to=t;
		E[i].cost=d;
	}
	
	for(i=0;i<V;i++){
		C[i]=INF;
	}
	
	C[start]=0;
	
	flg=BellmanFord(E,C,start);
	
	if(flg==0)return 0;
	
	for(i=0;i<V;i++){
		if(C[i]==INF)printf("INF\n");
		else printf("%d\n",C[i]);
	}
	
	return 0;
	
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int c[3][3];
    rep(i, 3){
        rep(j, 3){
            cin >> c[i][j];
        }
    }

    int a[3];
    int b[3];
    rep(i, 3){
        a[i] = c[i][0] - c[0][0];
        b[i] = c[0][i];
    }

    bool ok = true;
    rep(i, 3){
        rep(j, 3){
            if(a[i] + b[j] != c[i][j]){
                ok = false;
                break;
            }
        }
    }

    Judge(ok);



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int b, r, g, c, s, t;
	while (cin >> b >> r >> g >> c >> s >> t) {
		if (b + r + g + c + s + t == 0) break;
		int sum = 100, t2 = t;
		sum += (b * 15 + r * 15 + g * 7 + c * 2);
		t2 -= (s + b * 5 + r * 3);
		sum -= (t2 * 3);
		sum += (b * 5 * 13 + r * 3 * 13);
		cout << sum << endl;
	}
}

Measured memory_bytes: 3108
/*
vectorを使わなくても配列でもできる

*/

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int n;
	while(cin >> n, n){
		int a, sum[100], min, max;
		for(int i = 0; i < n; i++){
			sum[i] = 0;
			for(int j = 0; j < 5; j++){
				cin >> a;
				sum[i] += a;
			}
		}
		max = *max_element(sum, sum + n);
		min = *min_element(sum, sum + n);
		cout << max << ' ' << min << endl;
	}
	return 0;
}

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

#define FOR(i, n) for (int i = 0; i < n; i++)
#define EACH(i, n) for (auto &i: n)

int main() {
  int n, r;

  cin >> n >> r;
  if (n >= 10) {
    cout << r << endl;
  } else {
    cout << (r + 100  * (10 - n)) << endl;
  }

  return 0;
}

Measured memory_bytes: 256