akhauriyash/Code-Regression huggingface dataset:
import java.text.NumberFormat;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	class P {
		Double x;
		Double y;

		P() {
		}

		public P(double x, double y) {
			this.x = x;
			this.y = y;
		}

		double dot(P p1) {
			return p1.x * this.x + p1.y * this.y;
		}

		double vec(P p) {
			return this.x * p.y - this.y * p.x;
		}

		P add(P p) {
			P ret = new P();
			ret.x = this.x + p.x;
			ret.y = this.y + p.y;
			return ret;
		}

		P sub(P p) {
			P ret = new P();
			ret.x = this.x - p.x;
			ret.y = this.y - p.y;
			return ret;
		}

		P rot(double theta) {
			P ret = new P();
			ret.x = this.x * Math.cos(theta) - this.y * Math.sin(theta);
			ret.y = this.y * Math.cos(theta) + this.x * Math.sin(theta);
			return ret;
		}

		double abs(P p) {
			return Math.sqrt(p.x * p.x + p.y * p.y);
		}

		P neg() {
			P ret = new P();
			ret.x = -this.x;
			ret.y = -this.y;
			return ret;
		}

		P norm(P p) {
			P ret = new P();
			ret.x = p.x / abs(p);
			ret.y = p.y / abs(p);
			return ret;
		}

		double sin(P p) {
			return this.vec(p) / abs(this) / abs(p);
		}

		P mul(double a) {
			P ret = new P();
			ret.x = this.x * a;
			ret.y = this.y * a;
			return ret;
		}
	}

	void run() {
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			
			P[] p = new P[3];
			for (int a = 0; a < 3; a++) {
				p[a] = new P();
				p[a].x = sc.nextDouble();
				p[a].y = sc.nextDouble();
			}
			P g01 = (p[0].add(p[1])).mul(0.5);
			P m01 = p[0].sub(p[1]);
			P x = new P(0,0);  // xx + yx = zx
			P y = new P(1,1);  // xy + yy = zy
			P z = new P(0,0);
			if(Math.abs(m01.y) > 0.0000001){
				Double m1 = -m01.x/m01.y;
				x.x = -m1;
				y.x = 1.0;
				z.x = -g01.x * m1 + g01.y;
			}else{
				x.x = 1.0;
				y.x = 0.0;
				z.x = g01.x;
			}
			// y - y0 = -1/m(x - x0)
			P g02 = (p[0].add(p[2])).mul(0.5);
			P m02 = p[0].sub(p[2]);			
			if(Math.abs(m02.y) > 0.0000001){
				Double m2 = -m02.x/m02.y;
				x.y = -m2;
				y.y = 1.0;
				z.y = -g02.x * m2 + g02.y;
			}else{
				x.y = 1.0;
				y.y = 0.0;
				z.y = g02.x;
			}
			
			double det = x.vec(y);
			double xx = z.vec(y)/det; // Cramer 
			double yy = x.vec(z)/det; // Cramer 
			double rr = new P().abs(new P(xx,yy).sub(p[0]));
			NumberFormat format =NumberFormat.getInstance();
			format.setMaximumFractionDigits(3);
			format.setMinimumFractionDigits(3);
			String xxx = format.format(xx);
			String yyy = format.format(yy);
			String zzz = format.format(rr);
			System.out.println(xxx+" "+yyy+" "+zzz );
		}
	}

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;//这一句话必须有
char s1[101],s2[101];
int main(){
    gets(s1);
    gets(s2);
    int n=strlen(s1);
    int m=strlen(s2); //先记录下来两个串的长度，避免重复计算
    sort(s1,s1+n);
    sort(s2,s2+m);//对两个串进行排序
    for(int i=0;i<fmax(n,m);i++){//这里要循环到最大值，因为有空格，空格<小写字母
	if(s1[i]<s2[m-i-1]){printf("Yes\n");return 0;}//如算法区所示
    if(s1[i]>s2[m-i-1])break;}//一个不符，直接跳出
    printf("No\n");//不是yes就是no
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String line = sc.nextLine();
		String num = "0";
		if (line.equals("SUN")) {
			num = "7";
		} else if (line.equals("MON")) {
			num = "6";
		} else if (line.equals("TUE")) {
			num = "5";
		} else if (line.equals("WED")) {
			num = "4";
		} else if (line.equals("THU")) {
			num = "3";
		} else if (line.equals("FRI")) {
			num = "2";
		} else {
			num = "1";
		}

		// 出力
		System.out.println(num);
	}
}

Measured memory_bytes: 23764
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int d=sc.nextInt();
    System.out.println(Math.max(a*b,c*d));
    
  }
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            long ans = 0;
            for (long i = 0; i < N; i++)
            {
                ans += n2(long.Parse(s[i]));
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static long n2(long a)
        {
            long aa = a;
            long i;
            for (i = 0; i < 9999; i++)
            {
                if (aa % 2 == 1 )
                {
                    return i;
                }
                aa = aa / 2;
            }
            return i; 
        }
    }
}


Measured memory_bytes: 11744
a, b, c, d = map(int, input().split(" "))

alice = [1 if a <= i < b else 0 for i in range(100)]
bob = [1 if c <= i < d else 0 for i in range(100)]
res = [0 for _ in range(100)]

for i in range(len(res)):
    res[i] = alice[i] * bob[i]

print(sum(res))

Measured memory_bytes: 3060
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
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);
}
struct edge {
    int to, cost;
};
int n, b, c;
vector<int> a;
const ll M = pow(10, 9) + 7;

vector<ll> fac(10000001);  //n!(mod M)
vector<ll> ifac(10000001); //k!^{M-2} (mod M)
ll mpow(ll x, ll n)
{ //x^n(mod M)
    ll ans = 1;
    while (n != 0)
    {
        if (n & 1)
            ans = ans * x % M;
        x = x * x % M;
        n = n >> 1;
    }
    return ans;
}
//conbination
ll comb(ll a, ll b)
{ //aCb(mod M)
    if (a == 0 && b == 0)
        return 1;
    if (a < b || a < 0)
        return 0;
    ll tmp = ifac[a - b] * ifac[b] % M;
    return tmp * fac[a] % M;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    fac[0] = 1;
    ifac[0] = 1;
    for (ll i = 0; i < 1000000; i++)
    {
        fac[i + 1] = fac[i] * (i + 1) % M;              // n!(mod M)
        ifac[i + 1] = ifac[i] * mpow(i + 1, M - 2) % M; // k!^{M-2} (mod M)
    }
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
    }
    sort(ALL(a));
    ll maxa=a[n-1];
    ll mina;
    ll maxd=0;
    for(int i=0;i<n;i++){
        if(maxd<min(a[i],a[n-1]-a[i])){
            maxd=min(a[i],a[n-1]-a[i]);
            mina=a[i];
        }
    }
    cout << maxa<<" "<<mina << "\n";
}



Measured memory_bytes: 157180
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();

        if (B == 1) {
            System.out.println(0);
            return;
        }

        int count = 0;
        while ((A * count - (count - 1)) < B) {
            count++;
        }
        System.out.println(count);
    }
}

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

using namespace std;

int main() {
	int n, t[1000];
	string s[1000], x;

	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> s[i] >> t[i];
	}
	cin >> x;

	int i = 0;
	for(; i < n; i++) {
		if (s[i] == x)
			break;
	}
	int tot = 0;
	for(i += 1; i < n; i++) {
		tot += t[i];
	}
	cout << tot << endl;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
if(m>0):
  l = list(map(int,input().split()))
  i=n
  j=n
  while(i in l):
    i-=1
  while(j in l):
    j+=1
  if(abs(n-i)<abs(n-j)): print(i)
  elif(abs(n-i)>abs(n-j)): print(j)
  else: print(min(i,j))
else: print(n)

Measured memory_bytes: 9196
// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define dd double
#define ld long double
#define sl(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define sd(n) scanf("%lf", &n)
#define pll pair <ll, ll>
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define inf (1LL << 62)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define for1(i, stop) for(ll i = 1; i <= stop; ++i)
#define for0(i, stop) for(ll i = 0; i < stop; ++i)
#define rep1(i, start) for(ll i = start; i >= 1; --i)
#define rep0(i, start) for(ll i = (start-1); i >= 0; --i)
#define ms(n, i) memset(n, i, sizeof(n))
#define casep(n) printf("Case %lld:", ++n)
#define pn printf("\n")
#define pf printf
#define EL '\n'
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    string s;
    cin >> s;
    if(s == "RRR") cout << 3 << endl;
    else if(s == "RRS" || s == "SRR") cout << 2 << endl;
    else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 3620
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
const bool true = 1;
const bool false = 0;

#define MAX_N (2000010)
#define MAX_K (10010)

int n, k;
int A[MAX_N];
int B[MAX_N];
int C[MAX_K];

void csort(void) {
	int i;
	for (i = 0; i < n; i++) {
		C[A[i]] = C[A[i]] + 1;
	}
	for (i = 1; i <= k; i++) {
		C[i] = C[i] + C[i - 1];
	}
	for (i = n-1; i >= 0; i--) {
		B[C[A[i]]] = A[i];
		C[A[i]] = C[A[i]] - 1;
	}
}

int main(int argc, char **argv)
{
	int i;
	scanf("%d", &n);
	k = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
		if (A[i] > k) k = A[i];
	}

	csort();
	const char *sp = "";
	for (i = 1; i <= n; i++) {
		printf("%s%d", sp, B[i]);
		sp = " ";
	}
	putchar('\n');
	return 0;
}

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

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    if((b-a)%2==0){
        cout << "Alice" << endl;
    }
    else{
        cout << "Borys" << endl;
    }
}

Measured memory_bytes: 3600
s = input()
now = ["C","F"]
now_k = 0
flag = 0
for i in range(len(s)):
    if s[i] == now[now_k]:
        now_k += 1
        if now_k == 2:
            print("Yes")
            flag = 1
            break
if flag == 0:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdlib>

using namespace std;
#define N 10
#define C 10
#define CHANGE_RATE 0.1

int main()
{
    int d = 0;
    int c[26];
    int s[365][26];
    int t_c[C][365];
    int last[26] = {0};
    int score_c[C] = {0};
    int score = 0;
    int max_c = 0;

    cin >> d;

    for(int i = 0; i < 26; i++)
    {
        cin >> c[i];
    }

    for(int i = 0; i < d; i++)
    {
        for(int j = 0; j < 26; j++)
        {
            cin >> s[i][j];
        }
    }

    for(int i = 0; i < C; i++)
    {
        for(int j = 0; j < 365; j++)
        {
            t_c[i][j] = rand() % 26;
        }
    }

    for(int n = 0; n < N; n++)
    {
        score = 0;
        max_c = 0;
        for(int ca = 0; ca < C; ca++)
        {
            score_c[ca] = 0;
            for(int i = 0; i < 26; i++)
                last[i] = 0;

            for(int i = 0; i < d; i++)
            {
                for(int j = 0; j < 26; j++)
                {
                    if(t_c[ca][i] == j)
                    {
                        last[j] = 0;
                        score_c[ca] += s[i][j];
                    }
                    else
                    {
                        last[j]++;
                        score_c[ca] -= c[j] * last[j];
                    }
                }
            }
        }

        for(int ca = 0; ca < C; ca++)
        {
            if(score < score_c[ca])
            {
                score = score_c[ca];
                max_c = ca;
            }
        }
        //cout << score << endl;

        for(int ca = 0; ca < C; ca++)
        {
            if(ca == max_c) continue;
            for(int i = 0; i < d; i++)
            {
                if((rand() / (double)RAND_MAX) < CHANGE_RATE)
                {
                    t_c[ca][i] = rand() % 26;
                }
            }
        }
    }

    for(int i = 0; i < d; i++)
    {
        cout << (t_c[max_c][i] + 1) << endl;
    }

    return 0;
}

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

int main(){
        int n;
        scanf("%d", &n);
        std::map<int,int> mp;
        for(int i=0; i<n; i++){
                int t;
                scanf("%d", &t);
                mp[t]++;
        }

        int h=0, w=0;
        for(auto p: mp){
                while(p.second>1){
                        h = w;
                        w = p.first;
                        p.second -= 2;
                }
        }

        printf("%ld\n", (long)h*w);
        return 0;
}

Measured memory_bytes: 4992
using System.Linq;
using System.Collections.Generic;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	const long MOD = 1000000007;
	static int[] G => ReadLine().Split().Select(int.Parse).ToArray();
	int N;
	long ans, D;
	long[] ds, cs, ct;
	bool[] done;
	List<E>[] g;
	public K()
	{
		var I = G;
		N = I[0];
		var M = I[1];
		I = G;
		var s = I[0] - 1;
		var t = I[1] - 1;
		g = new List<E>[N];
		for (var i = 0; i < N; i++) g[i] = new List<E>();
		for (var i = 0; i < M; i++)
		{
			I = G;
			int a = I[0] - 1, b = I[1] - 1, c = I[2];
			g[a].Add(new E(b, c));
			g[b].Add(new E(a, c));
		}
		ds = DijkstraFrom(s);
		cs = Count(s, ds);
		ct = Count(t, DijkstraFrom(t));
		done = new bool[N];
		ans = cs[t] * cs[t] % MOD;
		D = ds[t];
		DFS(t);
		WriteLine((ans %= MOD) < 0 ? ans + MOD : ans);
	}
	long S(long x) => x * x % MOD;
	void DFS(int u)
	{
		if (done[u]) return;
		done[u] = true;
		if (2 * ds[u] == D) ans -= S(cs[u] * ct[u] % MOD);
		foreach (var e in g[u]) if (ds[e.V] + e.D == ds[u])
			{
				if (2 * ds[u] > D && 2 * ds[e.V] < D) ans -= S(ct[u] * cs[e.V] % MOD);
				DFS(e.V);
			}
	}
	long[] Count(int u, long[] d)
	{
		var t = new PriorityQueue();
		for (var i = 0; i < N; i++) t.Enqueue(new E(i, d[i]));
		t.Dequeue();
		var c = new long[N];
		c[u] = 1;
		while (t.Count > 0)
		{
			var v = t.Dequeue().V;
			foreach (var e in g[v]) if (d[e.V] + e.D == d[v]) c[v] = (c[v] + c[e.V]) % MOD;
		}
		return c;
	}
	long[] DijkstraFrom(int u)
	{
		var d = new long[N];
		for (var v = 0; v < N; v++) d[v] = 4011686018427387913L;
		var queue = new PriorityQueue();
		d[u] = 0;
		queue.Enqueue(new E(u, 0));
		while (queue.Count > 0)
		{
			var p = queue.Dequeue();
			var v = p.V;
			if (d[v] < p.D) continue;
			foreach (var e in g[v])
			{
				var t = d[v] + e.D;
				if (d[e.V] > t) queue.Enqueue(new E(e.V, d[e.V] = t));
			}
		}
		return d;
	}
}
struct E
{
	public readonly int V;
	public readonly long D;
	public E(int v, long d) { V = v; D = d; }
	public int CompareTo(E e) => D.CompareTo(e.D);
}
class PriorityQueue
{
	readonly List<E> a = new List<E>();
	public int Count { get; private set; } = 0;
	public void Enqueue(E x)
	{
		var i = Count++;
		a.Add(x);
		while (i > 0)
		{
			var p = (i - 1) / 2;
			if (a[p].CompareTo(x) <= 0) break;
			a[i] = a[p];
			i = p;
		}
		a[i] = x;
	}
	public E Dequeue()
	{
		var v = a[0];
		var x = a[--Count];
		a.RemoveAt(Count);
		if (Count == 0) return v;
		var i = 0;
		while (i * 2 + 1 < Count)
		{
			var l = 2 * i + 1;
			var r = 2 * i + 2;
			if (r < Count && a[r].CompareTo(a[l]) < 0) l = r;
			if (a[l].CompareTo(x) >= 0) break;
			a[i] = a[l];
			i = l;
		}
		a[i] = x;
		return v;
	}
	public E Peek() => a[0];
}


Measured memory_bytes: 59012
import math
n, d = [int(i) for i in input().split()]
dot = []
for _ in range(n):
  zahyo = list(map(int, input().split()))
  dot.append(zahyo)
cnt = 0
for i in range(n-1):
  for j in range(i+1, n):
    test = 0
    for k in range(d):
      test += pow(dot[i][k] - dot[j][k], 2)
    test_a = float(math.sqrt(test))
    test_b = int(math.sqrt(test))
    if(test_a == test_b):
      cnt += 1
print(cnt)

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

#define INF 1001001001
#define MAX 1e18
const int BIG = 1000000020;

int main() {
  int n, k;
  cin >> n >> k;
  mcf_graph<int,ll> g(n*2+2);
  g.add_edge(n*2,n*2+1,n*k,BIG);
  rep(i,n) {
    g.add_edge(n*2,i,k,0);
    g.add_edge(n+i,n*2+1,k,0);
  }
  rep(i,n)rep(j,n) {
    int a; cin >> a;
    g.add_edge(i,n+j,1,BIG-a);
  }
  ll c = (ll)n*k*BIG - g.flow(n*2,n*2+1,n*k).second;
  vector<string> grid(n, string(n,'.'));
  for (auto e : g.edges()) {
    if (e.from==n*2||e.to==n*2+1||e.flow==0) continue;
    grid[e.from][e.to-n] = 'X';
  }
  cout << c << endl;
  rep(i,n) cout << grid[i] << endl;

  return 0;
}


Measured memory_bytes: 3948
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=1004;
vector<string>s4=
{
 "aabc",
 "ddbc",
 "bcaa",
 "bcdd"
};
vector<string>s5=
{
  "..abc",
  "..abc",
  "ddeef",
  "ggh.f",
  "iihjj"
};
vector<string>s6=
{
    "...abc",
    "...abc",
    "ddee.f",
    "..gghf",
    "iij.h.",
    "kkj.ll"
};
vector<string>s7=
{
    "....abc",
    "....abc",
    "....def",
    "....def",
    "gghh..i",
    "jjkk..i",
    "llmmnn."
};
vector<vector<string > >ok={s4,s4,s4,s4,s4,s5,s6,s7};
 main()

{
    fast
    int n;
    cin>>n;
    if(n<=2)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    if(n==3)
    {
        cout<<"aa."<<endl;
        cout<<"..a"<<endl;
        cout<<"..a"<<endl;
        return 0;
    }
    vector<string>ses(n,string(n,'.'));
    int x=n;
    int z=0;
    while(x>7)
    {
        f(i,0,3)
        {
            f(j,0,3)
            {
                ses[z+i][z+j]=s4[i][j];
            }
        }
        z+=4;
        x-=4;
    }
    f(i,0,x-1)
    {
        f(j,0,x-1)
        {
            ses[z+i][z+j]=ok[x][i][j];
        }
    }
    f(i,0,n-1)
    {
        cout<<ses[i]<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 4260
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int d, g;
	cin >> d >> g;
	vi p(d), c(d);
	rep(i, d) cin >> p[i] >> c[i];
	//we can do a bitmask on d
	//do we fill up this guy to get the bonus or not
	//then, we keep adding the most expensive problems
	int ans = 1e9;
	rep(i, (1 << d)){
		ll tot = 0;
		int cnt = 0;
		rep(j, d) if(i & (1 << j)){
			tot += (c[j] + (p[j] * ((j + 1) * 100)));
			cnt += p[j];
		}
		if(tot >= g) ans = min(ans, cnt);
		for(int j = d - 1; j >= 0; j--) if(!(i & (1 << j))){
			if(tot > g) break;
			int pos = p[j];
			while(tot < g && pos){
				tot += (j + 1) * 100;
				cnt++;
				pos--;
			}
		}
		if(tot >= g) ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int A,B,i;
  scanf("%d\n%d\n",&A,&B);
  char text[A+B+1];
  scanf("%s",text);
  for(i=0;i<A;i++){
    if(text[i]=='-'){
      printf("No");
      exit(0);
    }
  }
  if(text[A]!='-'){
    printf("No");
    exit(0);
  }
  for(i=A+1;i<A+B+1;i++){
    if(text[i]=='-'){
      printf("No");
      exit(0);
    }
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

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

	int N, K;
	cin >> N >> K;

	cout << N - K + 1 << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
 
 
int main () {
    string S,ans;

    cin >> S;

    for(int i = 0; i<S.length(); i += 2){
        ans += S[i];
    }

    cout << ans << endl;

}


Measured memory_bytes: 512
import java.util.*

fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()

    var ret = 0
    var idx = 0
    while (true) {
        idx = s.indexOf("ABC", idx, false)
        if (idx >= 0) {
            ret++
        } else {
            break
        }
        idx++
    }
    print(ret)
}

Measured memory_bytes: 31520
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m = map(int, input().split())
A = [0] * m
B = [0] * m
for i in range(m):
    A[i], B[i] = map(lambda x: int(x) - 1, input().split())
A = A[::-1]
B = B[::-1]

#print(A)
#print(B)

uf = UnionFind(n)
counter = n * (n-1) // 2
ans = []
for a, b in zip(A, B):
    ans.append(counter)
    if uf.find(a) != uf.find(b):
        counter -= uf.size(a) * uf.size(b)
        uf.union(a, b)
print(*ans[::-1], sep="\n")


Measured memory_bytes: 89968
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int r = stdIn.nextInt(); String r1 = String.valueOf(r);
		int g = stdIn.nextInt(); r1+= String.valueOf(g);
		int b = stdIn.nextInt(); r1 += String.valueOf(b);
		int c = Integer.parseInt(r1);
		if(c%4==0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		
		
		
		
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;

int main(void) {
	unsigned int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	priority_queue<
		unsigned int,                // 要素の型はunsigned int
		std::vector<unsigned int>,   // 内部コンテナはstd::vector (デフォルトのまま)
		std::greater<unsigned int>   // 昇順 (デフォルトはstd::less<T>)
	> red, green;
	priority_queue<unsigned int> r;
	unsigned long ans=0;

	for (unsigned int i = 0; i < a; i++) {
		unsigned int tmp;
		cin >> tmp;
		if (red.size() < x) {
			red.push(tmp);
		}
		else {
			if (red.top() < tmp) {
				red.pop();
				red.push(tmp);
			}
		}
	}
	for (unsigned int i = 0; i < b; i++) {
		unsigned int tmp;
		cin >> tmp;
		if (green.size() < y) {
			green.push(tmp);
		}
		else {
			if (green.top() < tmp) {
				green.pop();
				green.push(tmp);
			}
		}
	}
	for (unsigned int i = 0; i < c; i++) {
		unsigned int tmp;
		cin >> tmp;
		r.push(tmp);
	}


	for (unsigned int i = 0; i < c; i++) {
		if (green.top() < red.top()) { //緑かえる
			if (green.top() < r.top()) {//緑最小
				green.pop();
				green.push(r.top());
				r.pop();
			}
			else {	//無色最小
				break;
			}
		}
		else {//赤変える
			if (red.top() < r.top()) {//赤最小
				red.pop();
				red.push(r.top());
				r.pop();
			}
		}
	}

	for (unsigned int i = 0; i < x; i++) {
		ans += red.top();
		red.pop();
	}
	for (unsigned int i = 0; i < y; i++) {
		ans += green.top();
		green.pop();
	}
	
	cout << ans;

	return 0;
}

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

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)

int main(){
  int n, m;
  cin >> n >> m;
  if(n-m&1){
    cout << "IMPOSSIBLE" << endl;
  }else{
    cout << abs((n + m) / 2) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    
    int H,W,i,j;
    scanf("%d %d",&H,&W);
    char sharp[100][100]={};
    
    for(i=0;i<H;i++)scanf("%s",sharp[i]);
    for(i=0;i<W+2;i++)printf("#");
    printf("\n");
    for(i=0;i<H;i++){
        printf("#");
        for(j=0;j<W;j++)printf("%c",sharp[i][j]);
        printf("#\n");
    }
    
    for(i=0;i<W+2;i++)printf("#");
    printf("\n");
    return 0;
}

Measured memory_bytes: 128
n,a,b=map(int,input().split())
h=[int(input())for _ in range(n)]
ng=0
ok=10**9
a-=b
while ng+1<ok:
  if sum(0--max(0,i-(ng+ok)//2*b)//a for i in h)<=(ng+ok)//2:ok=(ng+ok)//2
  else:ng=(ng+ok)//2
print(ok)

Measured memory_bytes: 7196
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define input(x) x; cin >> x;
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

using pii = pair<int, int>;

int main(){
  string input(s);
  cout << s.replace(0, 4, "2018") << endl;
}


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

bool ok[100005];
int ng[100005];

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n,m;cin>>n>>m;

  int ac=0,wa=0;
  for(int i=0;i<m;i++){
    int p;string s;cin>>p>>s;
    if(ok[p])continue;
    if(s=="AC"){
      ok[p]=1;
      ac++;
      wa += ng[p];
    }else{
      ng[p]++;
    }
  }
  cout<<ac<<' '<<wa<<endl;
  
  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>

typedef char String[1024];
 
int main(void)
{
  String instring;
  scanf("%s", instring);
  int num = atoi(instring);
  int ans = num + (num * num) + (num * num * num);
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 1684
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			int x = sc.nextInt();
			int n = sc.nextInt();

			boolean[] exist = new boolean[101];

			for (int i = 0; i < n; i++) {
				exist[sc.nextInt()] = true;
			}

			if (exist[x] == false) {
				System.out.println(x);
				return;
			}

			int diff = 1;
			while (true) {
				if (x - diff == 0) {
					System.out.println(x - diff);
					return;
				}

				if (exist[x - diff] == false) {
					System.out.println(x - diff);
					return;
				}

				if (100 < x + diff) {
					System.out.println(101);
					return;
				}
				if (exist[x + diff] == false) {
					System.out.println(x + diff);
					return;
				}

				diff++;

			}

		} catch (Exception e) {
			e.printStackTrace();

		}

	}
}


Measured memory_bytes: 35848
#include <iostream>
#include <limits>
#include <iomanip>
#include <math.h>
using namespace std;

int main() {
    double a,b,d,h,S,L,deg;
    cin>>a>>b>>deg;
    
    double rad;
    double PI = acos(-1);
    
    rad = deg * PI / 180;
    
    h = b*sin(rad);
    S = a*h/2;
    d = sqrt(a*a + b*b - 2*a*b*cos(rad));
    L = a+b+d;
    
    cout<<setprecision(10)<<S<<" "<<L<<" "<<h<<endl;
	
	return 0;
}


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

int main(){
   int n;
   std::string s;
   int k;
   std::cin >> n >> s >> k;
   
   const auto a = s[k-1];
   for(auto& c : s){
      if(c != a){
         c = '*';
      }
   }
   std::cout << s;
}

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

int main() {
	int N;
	cin >> N;
	vector<vector<ll>> a(N + 1, vector<ll>(3));
	for (int i = 1; i <= N; ++i) {
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	
	vector<vector<ll>> dp(N + 1, vector<ll>(3, 0));
	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j < 3; ++j) {
			for (int k = 0; k < 3; ++k) {
				if (j == k) { continue; }

				dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][j]);
			}
		}
	}

	ll res = 0;
	for (int i = 0; i < 3; ++i) { res = max(res, dp[N][i]); }

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 11136
n = int(input())
b = list(map(int, input().split()))
res = [0]*n
res[0] = b[0]
for i in range(1, n):
    if res[i-1] > b[i-1]:
        res[i-1] = b[i-1]
    res[i] = b[i-1]
print(sum(res))

Measured memory_bytes: 3060
s=str(input())
t=str(input())
ans=0
for j in range(len(s)-len(t)+1):
    e=s[j:j+len(t)]
    #print(s[j:j+len(t)])
    for i in range(len(t)):
        if t[i]!=e[i] and e[i]!='?':
            break
    else:
        ans=s[:j]+t+s[j+len(t):]
if ans:
    for i in range(len(ans)):
        if ans[i]=='?':
            ans=ans[:i]+'a'+ans[i+1:]
    print(ans)
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

P unit(const P &p){
    return p/abs(p);
}
double commonareaCC(C a, C b){
    if(a.r < b.r) swap(a,b);
    double d = abs(b.p-a.p);
    if(d +EPS > a.r+b.r){
        return 0;
    }
    if(d < a.r-b.r +EPS){
        return PI *b.r *b.r;
    }
    double arg_a = 2 *acos((a.r*a.r +d*d -b.r*b.r)/(2*a.r*d));
    double arg_b = 2 *acos((b.r*b.r +d*d -a.r*a.r)/(2*b.r*d));
    double poly = a.r*a.r*sin(arg_a)/2 +b.r*b.r*sin(arg_b)/2;
    double sector = a.r*a.r*arg_a/2 +b.r*b.r*arg_b/2;
    return sector -poly;
}

int main(){
    while(1){
        double w,h,itssize;
        double size[2];
        cin >> w >> h >> size[0] >> size[1] >> itssize;
        if(w == 0) break;

        C c[2];
        bool ng = false;
        for(int d=0; d<2; d++){
            c[d].r = sqrt(size[d] /PI);
            if(2*c[d].r > min(w, h) +EPS){
                ng = true;
            }
        }
        if(c[0].r < c[1].r){
            c[1].p = P(c[1].r, c[1].r);
            c[0].p = P(w-c[0].r, h-c[0].r);
        }else{
            c[0].p = P(c[0].r, c[0].r);
            c[1].p = P(w-c[1].r, h-c[1].r);
        }
        if(commonareaCC(c[0], c[1]) > itssize +EPS){
            ng = true;
        }

        if(ng){
            cout << "impossible" << endl;
            continue;
        }

        double lb=0, ub=abs(c[0].p -c[1].p);
        for(int rep=0; rep<50; rep++){
            double mid = (lb + ub)/2.0;
            C tmpc[2] = {C(P(0, 0), c[0].r), C(P(mid, 0), c[1].r)};
            if(commonareaCC(tmpc[0], tmpc[1]) >= itssize){
                lb = mid;
            }else{
                ub = mid;
            }
        }
        if(c[0].r < c[1].r){
            c[0].p = c[1].p +unit(c[0].p -c[1].p) *lb;
        }else{
            c[1].p = c[0].p +unit(c[1].p -c[0].p) *lb;
        }

        cout << fixed << setprecision(9);
        cout << c[0].p.X << " " << c[0].p.Y << " " << c[0].r << " ";
        cout << c[1].p.X << " " << c[1].p.Y << " " << c[1].r << endl;
    }
    return 0;
}


Measured memory_bytes: 3544
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int t = sc.nextInt();
        int[] ar = new int[t];
        for (int i = 0; i < t; i++) {
            ar[i] = sc.nextInt();
        }
        Arrays.sort(ar);
        int total = ar[ar.length - 1] - 1;
        int curr = ar[ar.length - 1];
        for(int i = ar.length - 2; i >= 0; i--){
            if(total >= ar[i])
                total -= ar[i];
            else
                total = 0;
            curr += ar[i];
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
signed main(){
	long long s;
	cin >> s;
	long long p = 1e9;
	long long m = s/p;
	if(s%p==0){
		cout << "0 0 1000000000 0 0 " << m;
	}
	else{
		m++;
		cout << "0 1 1000000000 0 " << s%p << " " << m;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define SP fixed << setprecision(10)
#define ER(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef double DB;

const int N = 100100;
pii a[N];

int main(){

	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	
	int n , t(0);
	cin >> n;

	for(int i = 0 ; i < n ; i++){
		cin >> a[i].F;
		a[i].S = i;
	}
	
	sort(a , a+n);

	for(int i = 0 ; i < n ; i++){
		if(a[i].S%2 != i%2){
			t++;
		}
	}

	cout << t/2 << endl;

	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            if (str[1] == 100) { str[1]++; }
            var ans = 1 * Math.Pow(100, str[0]) * str[1];
            Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
using boost::algorithm::split;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using boost::multiprecision::cpp_dec_float_50;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;

vector<int> to[200005];
vector<int> ans;

void dfs(int v, int p = -1) {
    //vからいける各頂点next_vについて
    for (int next_v : to[v]) {
        if (next_v == p) continue; //探索済みだったらスルー
        ans[next_v] += ans[v]; //更新
        dfs(next_v, v);
    }
}

int main () {
    int n, q; cin >> n >> q;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        --a; --b; //0-index
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ans.resize(n);
    rep(i, q) {
        int p, x;
        cin >> p >> x;
        --p; //0-index
        ans[p] += x; //累積和をとる
    }
    dfs(0);
    rep(i, n) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 23424
package main

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

var S string
var current []byte

func dfs(p int) bool {
	isReverse := true
	switch {
	case current[p] == 'S' && S[p] == 'x':
		isReverse = true
	case current[p] == 'W' && S[p] == 'x':
		isReverse = false
	case current[p] == 'S' && S[p] == 'o':
		isReverse = false
	case current[p] == 'W' && S[p] == 'o':
		isReverse = true
	}

	next := current[p-1]
	if isReverse {
		if next == 'S' {
			next = 'W'
		} else {
			next = 'S'
		}
	}

	if p == len(current)-1 {
		flag := current[0] == next
		if flag {
			firstSame := current[p] == current[1]
			if current[0] == 'S' && S[0] == 'o' || current[0] == 'W' && S[0] == 'x' {
			} else {
				firstSame = !firstSame
			}
			return firstSame
		}
		return false
	}

	current[p+1] = next

	if dfs(p + 1) {
		return true
	}
	return false
}
func output() string {
	return string(current)
}

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	S = sc.NextLine()

	current = make([]byte, N)
	for _, v := range []byte{'S', 'W'} {
		for _, v1 := range []byte{'S', 'W'} {
			current[0] = v
			current[1] = v1
			if dfs(1) {
				fmt.Println(output())
				return
			}
		}
	}
	fmt.Println(-1)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 10496
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i=0;i<(n);i++)
using namespace std;
     
int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  int k;
  rep(i, n) {
    cin >> x[i] >> y[i] >> h[i];
    if (h[i] > 0) k = i;
  }

  ll Cx, Cy, H;

  rep(cx, 101) {
    rep(cy, 101) {
      ll z = h[k] + abs(cx - x[k]) + abs(cy - y[k]);
      bool ok = true;
      rep(i, n) {
        ll tmp = abs(cx - x[i]) + abs(cy - y[i]);
        if (h[i] > 0 && tmp + h[i] != z) ok = false;
        if (h[i] == 0 && z - tmp > 0) ok = false;
      }
      if (ok) Cx = cx, Cy = cy, H = z;
    }
  }
  printf("%lld %lld %lld\n", Cx, Cy, H);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int a[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin>>a[i][j];
    }
  }
  if(a[1][1]-a[1][0]-a[0][1]+a[0][0]==0&a[1][2]-a[1][0]-a[0][2]+a[0][0]==0&&a[2][1]-a[2][0]-a[0][1]+a[0][0]==0&&a[2][2]-a[2][0]-a[0][2]+a[0][0]==0){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
  return 0;
}




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

#define MAX 2000000


int H,A[MAX+1];




void maxH(int i){
  int l,r,largest,s;
  l=2*i;
  r=2*i+1;


  if(l <= H && A[l] > A[i]) largest=l;
  else largest=i;
   if(r <= H && A[r] > A[largest]) largest=r;


   if(largest!=i){
     s=A[i];
     A[i]=A[largest];
     A[largest]=s;
     
     maxH(largest);
   }

}



int main(){
  int i;
  
  scanf("%d",&H);

  for(i =1;i <= H; i++)  scanf("%d",&A[i]);

  for(i =H/2;i >= 1; i--) maxH(i);

  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }

  printf("\n");

  return 0;
}




Measured memory_bytes: 3756
import sys
Ga={}
Gb={}
A=list(input())
B=list(input())
for i in range(len(A)):
  if A[i] in Ga and Ga[A[i]] != B[i]:
    print("No")
    sys.exit()
  else:
    Ga[A[i]] = B[i]
for i in range(len(B)):
  if B[i] in Gb and Gb[B[i]] != A[i]:
    print("No")
    sys.exit()
  else:
    Gb[B[i]] = A[i]
print("Yes")

Measured memory_bytes: 6704
import java.util.*;

public class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		long n=s.nextLong();
		if(n%2==1) {
			System.out.println(0);
			return;
		}
		long r=n/=10;
		for(long i=n/5;i>0;i/=5)
			r+=i;
		System.out.println(r);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n, l;
  cin >> n >> l;
  vector<string> data(n);
  for (int i = 0; i < n; i++) cin >> data.at(i);
  sort(data.begin(), data.end());
  for (int i = 0; i < n; i++) cout << data.at(i);
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
// Problem : C - Connect Cities
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
 
//krishrawat 
 
 
//----------------------------MACROS-------------------------------------------------
#define pb insert//                                                                 |
#define eb emplace_back//                                                           |
#define ff first//                                                                  |
#define ss second//                                                                 |
typedef long long int ll;//                                                         |
typedef long double ld;//                                                           |
#define all(a) a.begin(), a.end()//                                                 |
#define show(x) cerr << #x << " is " << x << "\n"//                                 |
#define show2(x, y) cerr << #x << " " << #y << " " << x << " " << y << "\n"//       |
typedef vector<ll> vl;//                                                            |
typedef vector<vl> vvl;//                                                           |
typedef pair<ll, ll> pp;//                                                          |
typedef vector<pp> vp;//                                                            |
typedef map<pp, ll> ipi;//                                                          |
typedef map<pp, char> ipc;//                                                        |
typedef map<ll, ll> ii;//                                                           |
typedef set<ll> sl;//                                                               |
typedef multiset<ll> msl;//                                                         |
typedef map<char, ll> ci;//                                                         |
typedef set<pair<ll, ll>> sp;//                                                     |
const ll mod = 1e9 + 7;//                                                           |
const ll N = 1e5 + 1;//                                                             |
//----------------------------------------------------------------------------------

vl grp[N]; 
int vis[N]={0};
void dfs(ll x){
	for(auto i:grp[x]){
		if(!vis[i]){
			vis[i]=1;
			dfs(i);
		}
	}
} 
void solve(){
    ll n,m;cin>>n>>m;
    ll ans=0;
    for(int i=0;i<m;i++){
    	ll x,y;cin>>x>>y;
    	
    	grp[x].eb(y);
    	grp[y].eb(x);
    	
    	}
    for(int i=1;i<=n;i++){	
    	if(!vis[i]){vis[i]=1;ans++; dfs(i);}
    }
    cout<<ans-1<<"\n";
    
}
 
int main()
{	
	
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    
     
 
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    
	return 0;
}

Measured memory_bytes: 10708
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] res = S.toCharArray();
        Arrays.sort(res);
        String ans = "No";
        if(res[0]=='a'&&res[1]=='b'&&res[2]=='c') ans = "Yes";
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844