akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(200010)
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = list(map(int,input().split()))
    G = [set([]) for k in range(N)]
    for i in range(M):
        A, B = set(map(int,input().split()))
        G[A-1].add(B-1)
        G[B-1].add(A-1)
    for e in G[0]:
        if e in G[N-1]:
            print("POSSIBLE")
            exit(0)
    print("IMPOSSIBLE")
if __name__ == '__main__':
    main()


Measured memory_bytes: 154712
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N,K = imn()

ans = 0
while N > 0:
    N //= K
    ans += 1
print(ans)

Measured memory_bytes: 5812
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

bool[] sieve(long n)
{
	auto f = new bool[](n/2); f[] = true; f[0] = false;
	long sq = cast(long)sqrt(cast(double)n);
	long sq_i = sq / 2;
	for (long i = 1; i < sq_i; ++i)
	{
		if (!f[i]) continue;
		long p = 2 * i + 1;
		for (long mul = 2 * i * (i+1); mul < f.length; mul += p)
			f[mul] = false;
	}
	return f;
}

void main()
{
	auto Q = RD;
	auto p = sieve(10^^5);
	auto a = new long[](10^^5+1);
	foreach (i; 1..10^^5+1)
	{
		if ((i != 2 && i % 2 == 0) || ((i+1)/2 != 2) && (i+1)/2 % 2 == 0) continue;
		auto f = p[i/2] && p[(i+1)/4];
		a[i] = f ? 1 : 0;
	}
	auto b = new long[](10^^5+1);
	foreach (i; 0..10^^5)
	{
		b[i+1] = b[i] + a[i];
	}

	auto ans = new long[](Q);
	foreach (i; 0..Q)
	{
		auto l = RD;
		auto r = RD;
		ans[i] = b[r+1] - b[l-1];
	}

	debug writeln(b[0..100]);
	foreach (i; 0..Q)
		writeln(ans[i]);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 5500
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n;
    double a[101];
    double out=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++){
        scanf("%lf",&a[i]);
        a[i] = 1 / a[i];
    }
    for(int i=0; i<n; i++){
        out += a[i];
    }
    printf("%lf",1/out);
	return 0;
}


Measured memory_bytes: 128
typedef char Bool;
#define true 39
#define false 0 
typedef long long int64;
typedef unsigned long long uint64;
typedef int int32;
typedef unsigned int uint32;
typedef unsigned char byte;
#pragma warning (disable:4996)
#include <stdio.h>


int main()
{
	int x[5];
	scanf("%d %d %d %d %d", &x[0], &x[1], &x[2], &x[3], &x[4]);
	
	for (int i = 0; i != 5; i++) 
	{
		if (x[i] == 0) 
		{
			printf("%d", i + 1);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1688
#!/usr/bin/env python3
import itertools

def main():
    N = int(input())
    F = [list(map(int,input().split())) for _ in range(N)]
    P = [list(map(int,input().split())) for _ in range(N)]
    bit_list = list(itertools.product([0, 1], repeat=10))
    bit_list.pop(0)
    answer = -10**9-1
    for b in bit_list:
        profit = 0
        for i in range(N):
            a = 0 ## 一致してる営業時間の数
            for j in range(10):
                if b[j]==1 and F[i][j]==1:
                    a+=1
            profit+=P[i][a]

        answer = max(answer,profit)

    print(answer)
    return 

if __name__ == '__main__':
    main()



Measured memory_bytes: 3188
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n;
    while (cin >> n && n != 0) {
        int *a = new int[n];
        int m;
        for (int i = 0; i < n; i++) {
            int t;
            cin >> t;
            a[i] = t;
        }
        m = a[0];
        for (int j = 0; j < n; j++) {
            int t = 0;
            for (int k = j; k < n; k++) {
                t += a[k];
                if (m < t) m = t;
            }
        }
        delete [] a;
        cout << m << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N,K;
	double ans=0;
	cin>>N>>K;
	for(int i=1;i<=N;i++){
		double tempp=1.0/N;
		int a=i;
		while(a<K){
			a*=2;
			tempp/=2;
		}
		ans+=tempp;
	}
	printf("%.12lf",ans);
	return 0;
}

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

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

    int r = n % 10;
    if (r == 2 || r == 4 || r == 5 || r == 7 || r == 9)
        cout << "hon" << endl;
    else if (r == 0 || r == 1 || r == 6 || r == 8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int length, result, flag;
char S[100005], change[5] = "01";

int main()
{
    scanf("%s", S);
    length = strlen(S);
    int count = 0;
    for(int i = 0; i < length; i++)
    {
        if(S[i] != change[flag])
        {
            count++;
        }
        flag = !flag;
    }
    result = count;
    flag = 1;
    count = 0;
    for(int i = 0; i < length; i++)
    {
        if(S[i] != change[flag])
        {
            count++;
        }
        flag = !flag;
    }
    printf("%d", min(result, count));
}

Measured memory_bytes: 384
#include <stdio.h>
#include <utility>

using namespace std;

int read_int(){
    int a;
    scanf("%d",&a);
    return a;
}


int main(){
    int var[3];
    for(int i=0;i<3;++i){
        var[i] = read_int();
    }
    swap(var[0], var[1]);
    swap(var[0], var[2]);

    printf("%d %d %d\n",var[0],var[1],var[2]);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1001001;
char s[N];
int n;
int main(){
	ios::sync_with_stdio(false);
	cin>>s;
	n=strlen(s);
	int l=0,r=0;
	int l0=0,r0=0;
	int l1=l-2;
	int r1=r+2;
	for(int i=0;i<n;i++){
		char c=s[i];
		if(c=='1'){
			l0++;
			r0++;
			if(l1!=l-2)l1++;
			if(r1!=r+2)r1++;
		}
		else if(c=='0'){
			l0--;
			r0--;
			if(l1!=l-2)l1--;
			if(r1!=r+2)r1--;
		}
		else{
			l0--;
			r0++;
			if(l1!=l-2)l1--;
			if(r1!=r+2)r1++;
		}
		int d=(r0-l0)%2==0?2:1;
		if(l0<l){
			l1=l0;
			l0+=d;
		}
		if(r0>r){
			r1=r0;
			r0-=d;
		}
		if(l0>r0){
			if(l1!=l-2&&r1!=r+2){
				l0=l1;
				r0=r1;
				if(l1<l){
					l--;
					r0--;
				}
				else{
					r++;
					l0++;
				}
				l1=l-2;
				r1=r+2;
			}
			else if(l1!=l-2){
				l--;
				l0=r0=l1;
				l1=l-2;
			}
			else{
				r++;
				l0=r0=r1;
				r1=r+2;
			}
		}
		// cerr<<l<<" "<<r<<" "<<l0<<" "<<r0<<" "<<l1<<" "<<r1<<endl;
	}
	int ans=r-l;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4648
// 解説放送のままのコードでAC 2hくらい…
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<int>l(Q), r(Q);
  for (int i = 0; i < Q; i++) {
    cin >> l[i] >> r[i];
  }
  // 累積和
  vector<int>sum(N + 1, 0); // それぞれの文字の間にとるので+1, 0で初期化
  // ACが出る可能性があるのは2番目から
  for (int i = 1; i < N; i++) {
    if (S[i - 1] == 'A' && S[i] == 'C') {
      sum[i + 1] = sum[i] + 1;
    }
    else sum[i + 1] = sum[i];
  }
  for (int i = 0; i < Q; i++) {
    int ans = sum[r[i]] - sum[l[i]]; // 図書いたらわかります、図大事
    cout << ans << endl;
  }
}

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

#define ll long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18

void testCase()
{
     
   // ll t; cin>>t; while(t--)
    
    {
        ll n;
        cin>>n;
        if(n%2==0)
        {
            cout<<"-1";
        }
        else
        {
            ll temp=0;
          for(int i=1;i<=100000000;i++)
          {
              temp=temp*10+7;
             
              if(temp%n==0)
              {
                  cout<<i;
                return;
              }
              temp=temp%n;
          }  
          cout<<"-1";
        }
    }
    
        
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    testCase();
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <sstream>
#include <regex>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
//const int INF = 100100100;
const int INF = (1LL<<32);
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;

string divide[4] = { "dream","dreamer","erase","eraser" };

signed main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	queue<int>q;
	q.push(0);
	bool can = false;
	while (!q.empty()) {
		int f = q.front();
		q.pop();
		rep(i, 4) {
			string d = divide[i];
			if (s.substr(f, d.size()) == d) {
				q.push(f + d.size());
			}
		}
		if (f == s.size()) {
			can = true;
		}
	}
	if (can) cout << "YES\n";
	else cout << "NO\n";
	return 0;
}



Measured memory_bytes: 512
/*
 *       ~ AtCoder  Botay ~
 *        code by kazalika
 */

#include <bits/stdc++.h>

//#pragma GCC optimize("O3")

using namespace std;

const int N = 1e5 + 5;
vector <int> g[N];


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

  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector <int> res(n), used(n);

  queue <int> q;
  q.push(0);
  used[0] = 1;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int u : g[v])
      if (!used[u]) {
        used[u] = 1;
        q.push(u);
        res[u] = v;
      }
  }
  if (*min_element(used.begin(), used.end()) == 0) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  for (int i = 1; i < n; ++i)
    cout << res[i] + 1 << '\n';

}

Measured memory_bytes: 10596
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var S = ReadText();
            var T = ReadText();

            var count = 0L;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == T[i]) count++;
            }
            return count;
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 11092
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
int n,m,k[1001][2],y,ans;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>k[i][1];
	for(int i=0;i<m;i++) {
		cin>>y;
		for(int j=1;j<=n;j++){
			if(y>=k[j][1]){
				k[j][0]++;
				break;
			}
		}
	}
	y=0;
	for(int i=1;i<=n;i++){
		if(y<k[i][0]){
			ans=i;
			y=k[i][0];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <algorithm>

using vi = std::vector<int>;
using vvi = std::vector<vi>;

int step(const vvi &g, vi &q, vi &marked) {
    static vi q2;
    int r = 0;
    for (auto a : q) {
        if (!marked[a]) {
            marked[a] = 1;
            r++;
            for (auto b : g[a]) {
                if (!marked[b]) q2.push_back(b);
            }
        }
    }
    q.clear();
    std::swap(q, q2);
    return r;
}

int main() {
    int n; std::cin >> n;
    vvi g(n + 1);
    for (int i = 0; i < n-1; i++) {
        int a, b; std::cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vi marked(n + 1);
    vi q1 = {1}, q2 = {n};
    int c1 = 0, c2 = 0;

    while (!(q1.empty() || q2.empty())) {
        c1 += step(g, q1, marked);
        c2 += step(g, q2, marked);
    }
    while (!q1.empty()) c1 += step(g, q1, marked);
    while (!q2.empty()) c2 += step(g, q2, marked);

    std::cout << (c1 > c2 ? "Fennec" : "Snuke") << std::endl;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],arr1[1000000],arr2[1000000],temp[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	long long n,k,i,j,x,y,z;   
    cin>>n>>k;
    for (i=0;i<n;i++)
    {
    	cin>>arr[i];
	}
	while (k--)
	{
		for (i=0;i<n;i++)
		{
			j=0;
			x=min(n,i+arr[i]+1);
			y=max(j,i-arr[i]);
			arr1[y]++;
			arr1[x]--;
		}
		z=0;
		for (i=1;i<n;i++)
		{
			arr1[i]+=arr1[i-1];
			if (arr1[i]!=arr[i])
			{
				z=1;
			}
		}
		if (z==0)
		{
			break;
		}
		for (i=0;i<n;i++)
		{
			arr[i]=arr1[i];
			arr1[i]=0;
		}
	}
	for (i=0;i<n;i++)
	{
		cout<<arr[i]<<" ";
	}
	cout<<endl;
}

Measured memory_bytes: 6660
#include"bits/stdc++.h"
#include<atcoder/dsu>
using namespace std;
using namespace atcoder;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============

int main()
{
    int N, Q;
    cin >> N >> Q;
    dsu uf(N);
    rep(_, Q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            uf.merge(u, v);
        }
        else {
            cout << (uf.same(u, v) ? 1 : 0) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
int n;
pair<pair<string,int>,int> res[120];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>res[i].first.first>>res[i].first.second;
		res[i].first.second*=-1;
		res[i].second=i;
	}
	sort(res+1,res+n+1);
	for(int i=1;i<=n;i++){
		cout<<res[i].second<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<functional>
using namespace std;

const int N = 50;

int n;
vector<int> beaker;
bitset<N> full;
bitset<N> used;

bool pour(int water, int start);
bool check();

bool pour(int water, int start) {
    for(int i = start; i < n; ++i) {
        if(used[i]) continue;

        if(water < beaker[i]) continue;
        else if(water == beaker[i]) {
            full.set(i);
            used.set(i);
            if(check()) return true;
            full.reset(i);
            used.reset(i);
        } else {
            full.set(i);
            used.set(i);
            if(pour(water - beaker[i], i + 1)) return true;
            full.reset(i);
            used.reset(i);
        }
    }
    return false;
}

bool check() {
    if(used.count() == n) return true;
    for(int i = 0; i < n; ++i) {
        if(!used[i] && !used[i]) return false;
        if(!full[i]) continue;
        full.reset(i);
        if(pour(beaker[i], i + 1)) return true;
        full.set(i);
    }
    return false;
}

int main() {
    while(cin >> n, n) {
        beaker.resize(n);
        for(auto& b: beaker) cin >> b;
        sort(beaker.begin(), beaker.end(), greater<int>());
        full = bitset<N>(1);
        used = bitset<N>(1);
        cout << (check() ? "YES" : "NO") << endl;
    }
}

Measured memory_bytes: 1208
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> P;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

ll h;
cin >> h;
ll ans=0;
int i;
for(i=0;h>1;++i){
    ans += pow(2,i);
    h /= 2;
}
ans+=pow(2,i);
fin(ans);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)
#define fcout cout << fixed << setprecision(10)

using namespace std;

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

    vector<int> x(3);
    REP(i, 3) cin >> x[i];
    sort(x.begin(), x.end());
    if (x[0] == 5 && x[1] == 5 && x[2] == 7) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    sb.append("ACL");
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 35760
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
using ll = long long;
using namespace std;
int main(){
    ll x,y;
    cin >> x >> y;
    int count=0;
    while(x<=y){
        x *= 2;
        count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    def segfunc(x, y):
        return x | y

    def init(arr):
        for i in range(n):
            seg[i+num-1] = {arr[i]}
        for i in range(num-2,-1,-1) :
            seg[i] = segfunc(seg[2*i+1],seg[2*i+2]) 
        
    def update(k,x):
        k += num-1
        seg[k].clear()
        seg[k] = {x}
        while k:
            k = (k-1)//2
            seg[k].clear()
            seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
        
    def query(p,q):
        if q<=p:
            return ide_ele
        p += num-1
        q += num-2
        res=ide_ele
        while q-p>1:
            if p&1 == 0:
                res = segfunc(res,seg[p])
            if q&1 == 1:
                res = segfunc(res,seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = segfunc(res,seg[p])
        else:
            res = segfunc(segfunc(res,seg[p]),seg[q])
        return res

    n = int(input())
    s = list(input().rstrip())
    for i in range(n):
        s[i] = ord(s[i]) - 97

    ide_ele = set()

    num =2**((n-1).bit_length())

    # セグ木初期化
    seg=[ide_ele]*2*num
    init(s)

    q = int(input())
    for _ in range(q):
        a,b,c = input().rstrip().split()
        if a == '1':
            b = int(b)
            c = ord(c) - 97
            update(b-1, c)
        else:
            b = int(b)
            c = int(c)
            print(len(query(b-1, c)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 477660
#include <iostream>
using namespace std;
int main() {
  int n;
  while(cin >> n) {
	int cnt = 0;
	for(int i = 0; i <= 9; ++i) {
	  if(i > n) break;
	  for(int j = 0; j <= 9; ++j) {
		if(i+j > n) break;
		for(int k = 0; k <= 9; ++k) {
		  if(i+j+k > n) break;
		  for(int l = 0; l <= 9; ++l) {
			if(i+j+k+l > n) break;
			else if((i+j+k+l) == n) cnt++;
		  }
		}
	  }
	}
	cout << cnt << endl;
  }
  return 0;
}

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

int sum[100000], p[100000];
int main() {
	int n, m; scanf("%d%d", &n, &m);
	rep(i, m) {
		scanf("%d", &p[i]); p[i]--;
		if (i) {
			sum[min(p[i], p[i - 1])]++;
			sum[max(p[i], p[i - 1])]--;
		}
	}
	ll ans = 0;
	rep(i, n - 1) {
		if (i)sum[i] += sum[i - 1];
		ll a, b, c; scanf("%lld%lld%lld", &a, &b, &c);
		ans += min(sum[i] * a, c + sum[i] * b);
	}
	printf("%lld\n", ans);
}

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

using namespace std;

bool isDifferentLength(const int a, const int b, const int c);
bool canMakeTriangle(const int a, const int b, const int c);

int main() {
	int n;
	cin >> n;
	vector<int> vec(n);
	for(int i = 0; i < n; i++) {
		cin >> vec[i];
	}

	int count = 0;

	for(int i = 0; i < n - 2; i++) {
		for(int j = i + 1; j < n - 1; j++) {
			for(int k = j + 1; k < n; k++) {
				if(canMakeTriangle(vec[i], vec[j], vec[k])) { count++; }
			}
		}
	}

	cout << count << endl;

	return 0;
}

bool isDifferentLength(const int a, const int b, const int c) {
	if(a == b) { return false; }
	if(b == c) { return false; }
	if(c == a) { return false; }
	return true;
}

bool canMakeTriangle(const int a, const int b, const int c) {
	if(!isDifferentLength(a, b, c)) { return false; }
	if(a >= b + c) { return false; }
	if(b >= c + a) { return false; }
	if(c >= a + b) { return false; }
	return true;
}


Measured memory_bytes: 3636
local D=io.read"*n"

local c={}
for i=1,26 do c[i]=io.read"*n"end
local s={}
for i=1,D do s[i]={}for j=1,26 do s[i][j]=io.read"*n"end end

local function copy(t)local ret={}for i,v in ipairs(t)do ret[i]=v end return ret end

local function calc(d,t,l)
	local a=0
	l[t]=d
	for j=1,26 do
		a=a-c[j]*(d-l[j])
	end
	return a+s[d][t]
end

local t={}
for i=1,D do t[i]=io.read"*n"end

local last={}
for i=1,26 do
last[i]=0
end

local ret={}
local a=0
for i=1,D do
	local lastt={}
	for j=1,26 do
		lastt[j]=copy(last)
	end
	
	local max=calc(i,1,lastt[1])
	ret[i]=1
	for j=2,26 do
		local c=calc(i,j,lastt[j])
		if(c>max)then
			max=c
			ret[i]=j
		end
	end
	last=lastt[ret[i]]
end

for i=1,D do print(ret[i])end

Measured memory_bytes: 3024
// Author: 23forever
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define fi first
#define se second
typedef long long LL;
const int MAXN = 1000000;
using namespace std;

inline int read() {
  int x = 0, w = 1;
  char c = ' ';
  
  while (!isdigit(c)) {
    c = getchar();
    if (c == '-') w = -1;
  }

  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }

  return x * w;
}

int n, a[MAXN + 5];
LL ans[MAXN + 5];

void init() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
}

int main() {
#ifdef forever23
  freopen("test.in", "r", stdin);
  //freopen("test.out", "w", stdout);
#endif
  init();
  
  ans[1] = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 2) {
      ans[1] += a[i];
    } else {
      ans[1] -= a[i];
    }
  }

  for (int i = 2; i <= n; ++i) {
    ans[i] = 2 * a[i - 1] - ans[i - 1];
  }

  for (int i = 1; i <= n; ++i) printf("%lld ", ans[i]);
  printf("\n");
  return 0;
}

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

using namespace std;

int main()
{
    int n;

    cin>>n;

    int array[n];

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

    int dp[n];

    dp[0]=0;
    dp[1]=abs(array[1]-array[0]);

    for(int i=2;i<n;i++)
    {
        dp[i]= min(dp[i-1]+abs(array[i]-array[i-1]), dp[i-2]+abs(array[i]-array[i-2]));
    }

    cout<<dp[n-1];
    
    return 0;
}

Measured memory_bytes: 4388
import math
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

A=1
for i in range(n):
    tmp=a[i]
    for j in range(i):
        if a[j]<a[i]: tmp-=1 
    A+=math.factorial(n-i-1)*(tmp-1)

B=1
for i in range(n):
    tmp=b[i]
    for j in range(i):
        if b[j]<b[i]: tmp-=1 
    B+=math.factorial(n-i-1)*(tmp-1)

print(abs(A-B))

Measured memory_bytes: 3064
#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;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 1;
//---------------------------------//

int main() {
	string n; cin >> n;
	REP(i, n.size()) putchar(n[i] == '1' ? '9' : '1');
	puts("");
	
	return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(N: Int, A: IntArray, B: IntArray, C: IntArray){
    val a = A.sorted()
    val b = B.sorted()
    val c = C.sorted()
    // 各biについて, biより大きいciの数
    val cumSum = b.map{ (N - c.upperBound(it)).toLong() }.scanLeft(0L){ a,b -> a+b }.toList()
    // println(cumSum)
    val ans = a.map{ cumSum.last() - cumSum.getOrElse(b.upperBound(it)-1){ 0L } }.sum()
    println(ans)
    return
}


fun <T, R> Iterable<T>.scanLeft(initial: R, operation: (acc: R, T) -> R): Sequence<R> {
    var last = initial
    return this.asSequence().map { last = operation(last, it); last }
}

fun <T : Comparable<T>> List<T?>.upperBound(
        element: T,
        fromIndex: Int = 0,
        toIndex: Int = size
): Int {
    var low = fromIndex
    var high = toIndex
    while (low < high) {
        val mid = (low + high) / 2
        if (element >= this.get(mid)!!) {
            low = mid + 1
        } else {
            high = mid
        }
    }
    return low
}



fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val A = IntArray(N)
    for (i in 0 until N) {
        A[i] = sc.next().toInt()
    }
    val B = IntArray(N)
    for (i in 0 until N) {
        B[i] = sc.next().toInt()
    }
    val C = IntArray(N)
    for (i in 0 until N) {
        C[i] = sc.next().toInt()
    }
    solve(N, A, B, C)
}



Measured memory_bytes: 85144
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[allow(dead_code)]
fn solve(s: Vec<Vec<char>>, H: usize, W: usize) -> String{
    let mut res = String::with_capacity(H * 2 * W);
    for h in 0..2 * H {
        for w in 0..W {
            res.push(s[h / 2][w]);
        }
        res.push('\n');
    }
    res
}

fn main() {
    input!{
        H: usize,
        W: usize,
        c: [chars; H]
    }
     print!("{}", solve(c, H, W));
}




Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    
    int N;
    cin >> N;
    vi L(N*2);
    in(N*2,L);
    sort(all(L));
    int ans = 0;
    rep(i,N) ans+=L[i*2];
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+5;
const ll mod =   1e9+7;
ll n; vector<pair<ll,ll> > vp;
bool comp1(pair<ll,ll> p1,pair<ll,ll> p2){
	return p1.fi+p1.se<p2.fi+p2.se;
}
bool comp2(pair<ll,ll> p1,pair<ll,ll> p2){
	return p1.fi+p2.se<p1.se+p2.fi;
}
int main()
{  fast
cin>>n;
for(int i=0;i<n;i++){
	ll x,y;
	cin>>x>>y;
	vp.emplace_back(x,y);
}
sort(vp.begin(),vp.end(),comp1);
ll ans=0;
ans=max(ans,abs(vp[0].fi-vp[n-1].fi)+abs(vp[0].se-vp[n-1].se));
sort(vp.begin(),vp.end(),comp2);
ans=max(ans,abs(vp[0].fi-vp[n-1].fi)+abs(vp[0].se-vp[n-1].se));;
cout<<ans;
}

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

int main(){
    long long N, A, B; cin >> N >> A >> B;

    long long a = N / (A + B);
    long long b = N % (A + B);

    if(b == 0) {
        cout << a * A << endl;
    } else if(A > b && b > 0) {
        cout << a * A + b  << endl;
    } else {
        cout << a * A + A << endl;
    }
}

Measured memory_bytes: 256
h , w = map(int,input().split())
src = [input() for i in range(h)]

dxy = [(-1,0), (0,-1),(1,0),(0,1)]
for y in range(h):
    for x in range(w):
        if src[y][x] == '.': continue
        for dx, dy in dxy:
            nx, ny = x+dx, y+dy
            if not 0 <= nx < w: continue
            if not 0 <= ny < h: continue
            if src[ny][nx] == '#':
                break
        else:
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(void){
    long long n;
    cin>>n;
    int ans=0,c=0;
    while(n>0){
        if(n<10){
            if(c==0)ans+=n;
            else ans+=n-1;
        }
        else ans+=9;
        if(n%10!=9)c=1;
        n/=10;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);((a)<(b)?i<=(b):i>=(b));((a)<(b)?++i:--i))
#define SZ(v)      ((int)(v).size())
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

inline void YESNO(bool ans){cout<<(ans?"YES":"NO")<<endl;}
inline void YesNo(bool ans){cout<<(ans?"Yes":"No")<<endl;}
inline void yesno(bool ans){cout<<(ans?"yes":"no")<<endl;}

int main(){
	double d,t,s;
	cin>>d>>t>>s;
	
	bool ans=(d/s<=t);
	
	YesNo(ans);
}

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

// as + bt = GCD(a,b) a,b:const s,t:var(any)
// return GCD(a,b)
long long extGCD(long long a, long long b, long long& s,
                 long long& t) {
  s = 1, t = 0;
  while(b) {
    long long tmp = a / b;
    a -= b * tmp;
    s -= t * tmp;
    swap(a, b);
    swap(s, t);
  }
  return a;
}

// (mod)x+ay=1, calculate y -> a^-1 (mod m) (a,m : coprime)
long long calcinv(long long a, long long m) {
  long long s, t;
  extGCD(a, m, s, t);
  return (s + m) % m;
}

long long MOD;
vector<long long> ans;

// P(x_i) = y_i(i:[0,n])
vector<long long> lagrange_interpolation(
    long long mod, vector<long long>& y,
    vector<long long>& x) {
  assert(y.size() == x.size());
  long long n = y.size();
  vector<long long> ans(n, 0), Q(n), c[2];
  for(int i = 0; i < 2; ++i) c[i] = vector<long long>(n, 0);
  c[0][0] = 1;
  for(int i = 0; i < n; ++i) {
    long long inv = 1;
    for(int j = 0; j < n; ++j)
      if(j != i) {
        inv *= x[i] - x[j];
        if((inv %= mod) < 0) inv += mod;
      }
    Q[i] = y[i] * calcinv(inv, mod) % mod;
    for(int j = 0; j < n; ++j) {
      c[(i + 1) % 2][j] =
          (c[i % 2][j] * (-x[i]) % mod + mod) % mod;
      if(j != 0)
        (c[(i + 1) % 2][j] += c[i % 2][j - 1]) %= mod;
    }
  }
  for(int i = 0; i < n; ++i) {
    for(int j = n - 1; j >= 0; --j) {
      if(j == n - 1)
        c[(n + 1) % 2][j] = 1;
      else
        c[(n + 1) % 2][j] =
            (c[n % 2][j + 1] +
             c[(n + 1) % 2][j + 1] * x[i] % mod) %
            mod;
      (ans[j] += (c[(n + 1) % 2][j] * Q[i]) % mod) %= mod;
    }
  }
  return ans;
}

int main() {
  cin >> MOD;
  vector<long long> a(MOD), b(MOD);
  for(int i = 0; i < MOD; ++i) cin >> a[i];
  for(int i = 0; i < MOD; ++i) b[i] = i;
  ans = lagrange_interpolation(MOD, a, b);
  for(int i = 0; i < MOD; ++i) {
    if(i != 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
#20131025
#a d n
#a<=9370
#d<=346
#n<=210

#Eratosthenes
Max=1000000
prime=Array.new Max
prime[0]=prime[1]=false
prime[2]=true
index=4
while index<prime.length
	prime[index] = false
	index+=2
end
1.upto(Max/2-1){|i|
	num=i*2+1
	if prime[num] == nil
		prime[num] = true
		index = num*2
		while index < Max
			prime[index]=false
			index+=num
		end
	end
}

while true
	a,d,n = gets.split(" ").map{|e|e.to_i}
	break if a==0 && d==0 && n==0

	num=a
	while num < Max && n != 0
		if prime[num] 
			n-=1
			ans=num
		end
		num+=d
	end
	p ans
end

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

Measured memory_bytes: 3632
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 int n=ir.nextInt();
 boolean[][] mat=new boolean[n][n];
 for(int i=0;i<n;i++){
  int u=ir.nextInt()-1;
  int k=ir.nextInt();
  int[] v=ir.nextIntArray(k);
  for(int j=0;j<k;j++) mat[u][v[j]-1]=true;
 }
 for(int i=0;i<n;i++){
  for(int j=0;j<n;j++){
   out.print((mat[i][j]?1:0)+(j==n-1?"\n":" "));
  }
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

Measured memory_bytes: 26824
#include<bits/stdc++.h>
using namespace std;
string a;
bool b[30];
int main()
{
	cin>>a;
	for(int s=0;s<a.size();s++)
	{
		b[a[s]-'a']=1;
	}
	for(int s=0;s<26;s++)
	{
		if(b[s]==false)
		{
			cout<<char(s+'a')<<endl;
			exit(0);
		}
	}
	cout<<"None"<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define SYOU(x) setprecision(x)
#define abs(x,y) max(x,y)-min(x,y)
#define mp make_pair
#define fi first
#define se second
using namespace std;
int i[100],u[100][5];
vector<int> ii;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=0,h,j;
  string s;
  cin >>a>>b;
  if(a<=b) cout <<0<<'\n';
  else cout <<a-b<<'\n';
  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 a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if ((a==b && a!=c) || (a==c && a!=b) ||(b==c && a!=b)) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}


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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int a[n];
	map<int, int> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		m[a[i]]++;
	}
	sort(a, a+n);
	int dsize = a[n-1]+1;
	bool d[dsize];
	fill(d, d+dsize, true);
	d[0] = false;
	for (int i = 0; i < n; i++) {
		if (d[a[i]] == false)
			continue;
		if (m[a[i]] >= 2)
			d[a[i]] = false;
		for (int j = 2*a[i]; j < dsize; j+=a[i]) {
			d[j] = false;
		}
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (d[a[i]])
			count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 14508
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

const ll MAX = 2e6;
const ll MOD = 1e9 + 7;
vector<ll> fac(MAX);
vector<ll> finv(MAX);
vector<ll> inv(MAX);

// COMinit()を忘れないように！
void COMinit(){
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(ll 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;
  }
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, K; cin >> N >> K;
  COMinit();
  ll ans = 0;
  for(ll i = 0; i <= min(K, N-1); i++){
    ans = (ans + (nCr(N, i)*nCr(N-1, i))%MOD)%MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 49152
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        public class ub : IComparer<long>
        {
            public int Compare(long x, long y)
            { return 0 < x.CompareTo(y) ? 1 : -1; }
        }
        public class lb : IComparer<long>
        {
            public int Compare(long x, long y)
            { return 0 <= x.CompareTo(y) ? 1 : -1; }
        }
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var Ai = Sarray();

            var counts = new long[200000 + 1];
            for (var i = 0; i < N; ++i)
            {
                ++counts[Ai[i]];
            }
            var sum = 0L;
            foreach (var c in counts)
            {
                if (1 < c)
                    sum += c * (c - 1) / 2;
            }
            for (var i = 0; i < N; ++i)
            {
                var c = counts[Ai[i]];
                if (c == 1)
                {
                    WriteLine(sum);
                    continue;
                }
                var sumd = sum - c + 1;
                WriteLine(sumd);
            }
            Out.Flush();
        }
    }
}

Measured memory_bytes: 39228
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	t := 0
	h := 0
	for i := 0; i < n; i++ {
		var a, b string
		fmt.Scan(&a, &b)
		if a > b {
			t += 3
		} else if a < b {
			h += 3
		} else {
			t++
			h++
		}
	}
	fmt.Println(t, h)
}



Measured memory_bytes: 1176
#include<stdio.h>
#include<ctype.h>
 
int main(){
    char str[100000];
    int i;

    fgets(str, 100000, stdin);
    for(i=0; str[i] != '\0'; i++){
        str[i] = toupper(str[i]);
    }
    printf("%s", str);
    return 0;
}

Measured memory_bytes: 524