akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define _rep4(i,p,n,k) for(int i=(p),_rep##_bound=(n),_rep##_inc=(k);i<_rep##_bound;i+=_rep##_inc)
#define _rep3(i,p,n,_a) _rep4(i,p,n,1)
#define _rep2(i,n,_a,_b) _rep4(i,0,n,1)
#define _repcall(a,b,c,d,name,...) name(a,b,c,d)
#define rep(...) _repcall(__VA_ARGS__,_rep4,_rep3,_rep2)

int work(std::istream &in) {
    int N;
    in >> N;

    int ret = 0;
    rep(i, 1, N + 1, 2) {
        int c = 0;
        rep(j, 1, i + 1) {
            if (i % j == 0) ++c;
        }
        if (c == 8) ++ret;
    }
    return ret;
}

int runTest() {
    int ret = 0;

    struct testcase {
        const char *input;
        int expected;
    };

    struct testcase testdata[] = {
        { "105", 1 },
        { "7", 0 },
    };

    for (const auto &t : testdata) {
        auto in = std::stringstream(t.input);
        int actual = work(in);
        if (actual != t.expected) {
            fprintf(stderr, "expected %d, but actual %d\n", t.expected, actual);
            ret = 1;
        }
    }

    return ret;
}

int main(int argc, char *argv[]) {
    if (argc == 2 && strcmp("--test", argv[1]) == 0) {
        puts(argv[1]);
        return runTest();
    }
    printf("%d\n", work(std::cin));
    return 0;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <unordered_set>
using namespace std;

int main(){
    int a;
    cin >> a;
    cout << a*a+a+a*a*a<< endl;
}

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

using namespace std;
typedef long long ll;

int mems[200000];
int n,a,b,c,d;
string s;

int main(){
    cin >> n >> a >> b >> c >>d;
    cin >> s;

    a--, b--, c--, d--;
    bool chk1=true;
    for( int i=a; i<c-1; i++){
        if( (s[i]=='#')&&(s[i+1]=='#') ) {
            chk1=false;
            break;
        }
    }
    for( int i=b; i<d-1; i++){
        if( (s[i]=='#')&&(s[i+1]=='#') ) {
            chk1=false;
            break;
        }
    }
    if( chk1==false ){
        cout << "No" <<endl;
        return 0;
    }
    if( c < d ){
        cout << "Yes" <<endl;
        return 0;
    }

    bool chk = false;
    for( int i=d; i>=b; i--){
        if( (s[i-1]=='.')&&(s[i]=='.')&&(s[i+1]=='.') ){
            chk = true;
            break;
        }
    }
    if( chk==true ) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();

                if (ab[0] == 0 && ab[1] == 0)
                    break;
                Array.Sort(ab);
                Console.WriteLine("{0} {1}", ab[0], ab[1]);
            }




        }
    }
}

Measured memory_bytes: 9884
def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    cnt=[]
    for i in a:cnt.append([i,1])
    for i in range(m):
        b,c=map(int,input().split())
        cnt.append([c,b])
    cnt.sort(reverse=True)
    s,k=0,0
    for i,j in cnt:
        if k+j>=n:
            s+=(n-k)*i
            break
        else:
            s+=i*j
        k+=j
    print(s)

if __name__ == '__main__':
    main()

Measured memory_bytes: 34640
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <deque>
#include <unordered_map>
#include <unordered_set>

int main(void)
{
  int N;
  std::cin >> N;
  std::vector<int> a(N);
  for(int i = 0; i < N; ++i){ std::cin >> a[i]; }

  std::unordered_set<int> set(a.begin(), a.end());

  if(set.size() > 2){
    std::cout << "No" << std::endl;
    return 0;
  }

  if(set.size() == 1){
    int v = *set.begin();
    std::cerr << v << std::endl;
    if(N == v + 1){ std::cout << "Yes" << std::endl; return 0; }
    if(N < v*2){ std::cout << "No" << std::endl; return 0; }
    std::cout << "Yes" << std::endl;
    return 0;
  }

  // set.size() == 2                                                                                                                           
  int s, b;
  {
    std::vector<int> vec(set.begin(), set.end());
    int i = vec[0];
    int j = vec[1];
    s = i < j ? i : j;
    b = i > j ? i : j;
  }
  std::cerr << s << " " << b << std::endl;

  int cs = 0, cb = 0;
  for(auto i : a){
    if(i == s){ cs++; }
    else{ cb++; }
  }
  std::cerr << cs << " " << cb << std::endl;

  if(cs > s){ std::cout << "No" << std::endl; return 0; }

  int bd = b - cs;

  if(bd*2 > cb){ std::cout << "No" << std::endl; return 0; }

  std::cout << "Yes" << std::endl;
  return 0;
}



Measured memory_bytes: 4608
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int INF=1000000000;
const int MOD=1000000007;

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

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

typedef vector<vi> G;

int main()
{
    int N; cin >> N;
    vi a(N-1), b(N-1);
    G g(N+1);
    rep(i, N-1) {
        cin >> a[i] >> b[i];
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    int k = 0;
    rep1(i, N+1) chmax(k, (int)g[i].size());

    map<pii, int> m;

    queue<int> q;
    vi c(N+1, -1);
    q.push(1);
    c[1] = 0;
    while (!q.empty()) {
        int v = q.front(); q.pop();
        int color = 1;
        rep(i, g[v].size()) {
            int u = g[v][i];
            if (c[u] != -1) continue;
            if (color == c[v]) color++;
            c[u] = color;
            m[make_pair(v, u)] = color;
            m[make_pair(u, v)] = color++;
            q.push(u);
        }
    }

    cout << k << endl;

    rep(i, N-1) {
        cout << m[make_pair(a[i], b[i])] << endl;
    }
    
}


Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = acos(-1) ;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"


int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans;

	cin>>tc;
	n=tc;
	int arr[n];
	for(ll i=0;i<tc;i++)
	{
		cin>>arr[i];
		
	}
	z=1e12;
	for(ll i=1;i<=100;i++)
	{
		sum=0;
		for(ll j=0;j<tc;j++)sum+=abs(arr[j]-i)*abs(arr[j]-i);
		z=min(z,sum);
	}
	cout<<z<<nw;

}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int A[200001];
    cin >> N;
    rep(i,0,N){
        cin >> A[i];
    }
    int B[200001];
    rep(i,0,N){
        B[i] = A[i] - i - 1;
    }
    ll ans = 0;
    sort(B, B+N);
    if(N % 2 != 0){
        int pos = (N - 1)/2;
        int tmp = B[pos];
        rep(i,0,N){
            B[i] += (tmp * -1);
        }
    }else{
        int pos = N/2;
        int tmp = B[pos];
        rep(i,0,N){
            B[i] += (tmp * -1);
        }

    }
    rep(i,0,N){
        ans += abs(B[i]);
    }
    print(ans);
    
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
int c=scan.nextInt();
a-=b;
a%=c;
System.out.println(a);
	}
}


Measured memory_bytes: 22996
d, n  = map(int, input().split())

if d == 0:
    if n == 100:
        print(101)
    else:
        print(1 * n)
if d == 1:
    if n == 100:
        print(10100)
    else:
        print(100 * n)
if d == 2:
    if n == 100:
        print(1010000)
    else:
        print(10000 * n)


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


using namespace std;

int main()
{
    int n,k;
    while(cin>>n>>k)
    {
        int ara[n+5];
        for(int i=0;i<n;i++)
            cin>>ara[i];

        n-=k;
        //cout<<n/(k-1)<<endl;
        int ans=0;
        if(n%(k-1))ans=(n/(k-1))+1;
        else ans=n/(k-1);
        cout<<ans+1<<endl;
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,k;
  cin >> a >> b >> k;
  for(int i=100;i>=1;i--){
    if(a%i==0 and b%i==0) k--;
    if(k==0){
      cout << i << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
from sys import stdin, stdout, setrecursionlimit as lim

lim(100003)

n = input()
inp = stdin.readlines()

g = [[] for i in xrange(n + 1)]

for line in inp:
    u, v, w = map(int, line.strip().split())
    g[u].append([v, w])
    g[v].append([u, w])

out = [0] * (n + 1)
vis = [0] * (n + 1)

def dfs(u, par, z):
    global out
    
    if z & 1: out[u] = out[par] ^ 1
    else: out[u] = out[par]
    vis[u] = 1
    for v, w in g[u]:
        if vis[v] == 1: continue
        dfs(v, u, w)

dfs(1, 1, 0)

stdout.write("\n".join(map(str, out[1:])))

Measured memory_bytes: 170808
#include <iostream>
using namespace std;
#define MAX_N 4000

int num[MAX_N/2+1];

int main(int argc, char const *argv[])
{
	// a+b=n???(a,b)????????????????????°????¨???? 0<=a<=1000, 0<=b<=1000
	for(int i=0;i<=MAX_N/4;i++){
		for(int j=0;j<=MAX_N/4;j++){
			num[i+j]++;
		}
	}
	int n;
	while(cin>>n){
		int ans=0;
		for(int i=0;i<=MAX_N/2;i++){
			int cd = n-i;
			if(cd<0)break;
			if(cd>2000)continue;
			ans += num[i] * num[cd];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <tuple>
#include <complex>
#include <ios>
#include <iomanip>
#include <cmath>

using point = std::complex<double>;

constexpr double EPS = 1e-12;
constexpr double INF = 1e6;
constexpr double pi = std::acos(-1.0);

point rotate (const point &e, double theta) {
	const double x = e.real(), y = e.imag();
	double a = x * std::cos(theta) - y * std::sin(theta);
	double b = x * std::sin(theta) + y * std::cos(theta);
	return point(a, b);
}

std::pair<point, point> f (point p1, double r1, point p2, double r2) {
	double d = std::sqrt(std::norm(p2 - p1));
	double rc = (r1 * r1 + d * d - r2 * r2) / (2.0 * d);
	double rs = std::sqrt(r1 * r1 - rc * rc);
	point e1 = (p2 - p1) / d, e2 = rotate(e1, pi / 2.0), e3 = rotate(e1, -pi / 2.0);
	point a = p1 + (e1 * rc) + (e2 * rs);
	point b = p1 + (e1 * rc) + (e3 * rs);
	return std::make_pair(a, b);
}

bool cross (point a, double r1, point b, double r2) {
	return ((r1 + r2 + EPS) > std::sqrt(std::norm(a - b)));
}

bool is_inner (point a, double r1, point b, double r2) {
	double d = std::sqrt(std::norm(a - b));
	if (not (r1 < r2)) std::swap(r1, r2);
	return (r1 + d <= r2 + EPS);
}

int main() {
	std::size_t n;
	int k;
	std::cin >> n >> k;
	std::vector<point> p(n);
	std::vector<double> c(n);
	for (std::size_t i = 0; i < n; i++) {
		double a, b;
		std::cin >> a >> b >> c[i];
		p[i] = point(a, b);
	}
	
	auto solve = [&](double t) -> bool {
		std::vector<point> dat = p;
		for (std::size_t i = 0; i < n; i++) {
			for (std::size_t j = i + 1; j < n; j++) {
				double r1 = t / c[i], r2 = t / c[j];
				if (not cross(p[i], r1, p[j], r2)) continue;
				if (is_inner(p[i], r1, p[j], r2)) continue;
				point a, b;
				tie(a, b) = f(p[i], r1, p[j], r2);
				dat.push_back(a);
				dat.push_back(b);
			}
		}
		
		int niku = 0;
		for (const point & cp : dat) {
			int count = 0;
			for (std::size_t i = 0; i < n; i++) {
				double r = t / c[i], d = std::sqrt(std::norm(cp - p[i]));
				if (r + EPS >= d) count++;
			}
			niku = std::max(niku, count);
		}
		
		return (niku >= k);
	};
	
	int loop = 100;
	double ng = 0, ok = INF;
	while (loop--) {
		double x = (ok + ng) / 2.0;
		if (solve(x)) ok = x;
		else ng = x;
	}
	
	std::cout << std::fixed << std::setprecision(10) << ok << '\n';
	
	return 0;
}


Measured memory_bytes: 384
N, M = map(int, input().split())

s_c_dict = {}
for i in range(M):
    s, c = map(int, input().split())
    if N != 1 and s == 1 and c == 0:
        print("-1")
        exit()
    if s in s_c_dict and s_c_dict[s] != c:
        print("-1")
        exit()

    s_c_dict[s] = c
if N ==3:
	ans = ["1", "0", "0"]
elif N == 2:
  	ans = ["1", "0"]
else:
    ans = ["0"]
for i in range(1, N+1):
    if i in s_c_dict:
        ans[i-1] = str(s_c_dict[i])
print(int("".join(ans)))

Measured memory_bytes: 38384
void main() {
  problem();
}

void problem() {
  auto L = scan!real;

  real solve() {
    return L*L*L/27L;
  }

  writefln("%.10f", solve());
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


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

int main()
{
	int n;
	cin >> n;
	for (int i=3; i <= n; i++) {
		if (i%3) {
			if (i%10==3)
				cout << ' ' << i;
			else if (i/10)
				if (i/10%10==3)
					cout << ' ' << i;
			else if (i/100)
				if (i/100%10==3)
					cout << ' ' << i;
			else if (i/1000)
				if (i/1000%10==3)
					cout << ' ' << i;
		}			
		else cout << ' ' << i;
	
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3088
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		OriginScanner os = new OriginScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int k = os.nextInt();
		int x = os.nextInt();
		
		if (k * 500 >= x) pw.println("Yes");
		else pw.println("No");
		
		pw.close();
	}
	
	static class OriginScanner {
		private BufferedReader br;
		private StringTokenizer st;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		String next() {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(nextLine());
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

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

using namespace std;

#define LL long long

int digits(LL x) {
    return (int) to_string(x).length();
}


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

    int ans = 100;
    for (LL a = 1; a * a <= n; ++a) {
        if (n % a == 0) {
            ans = min(ans, max(digits(a), digits(n / a)));
        }
    }

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


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
a_xy = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = [int(item) for item in input().split()]
        a_xy[i].append((x-1, y))
    
ans = 0
# Decide true or not
for i in range(2**n):
    ok = True
    for j in range(n):
        # Who Saying true
        if i & (1 << j):
            for x, y in a_xy[j]:
                if y == 1:
                    if not (i & (1 << x)):
                        ok = False
                        break
                else:
                    if i & (1 << x):
                        ok = False
                        break
        if not ok:
            break
    if ok:
        ans = max(ans, bin(i).count("1"))

print(ans)

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

int N;
int A[44][44];

int dp[44][44][44];

signed main(){
    cin>>N;
    N*=2;
    rep(i,N){
        string s;cin>>s;
        rep(j,N)A[i][j]=s[j]=='1';
    }


    for(int i=1;i<N;i++){
        dp[i][i+1][i]=1;
    }    
    for(int len=3;len<N;len+=2){
        for(int i=1;i+len<=N;i++){
            int j=i+len;

            for(int m=i;m<j;m++){
                for(int l=i+1;l<=m;l+=2){
                    for(int ml=i;ml<l;ml++){
                        if(dp[i][l][ml]==0)continue;
                        for(int r=j-1;r>=m;r-=2){
                            for(int mr=r;mr<j;mr++){
                                if(dp[r][j][mr]==0)continue;
                                if(A[ml][mr]==0)continue;
                                dp[i][j][m]+=dp[i][l][ml]*dp[l][r][m]*dp[r][j][mr];
                            }
                        }
                    }
                }
            }
        }
    }


    int ans=0;
    for(int i=1;i<N;i++){
        if(A[0][i])ans+=dp[1][N][i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int G[N];
int ans,n,k;
vector<int> D[N];
int dfs(int u,int v) {
	int res = 0; 
	for (int p : D[v]) res = max(res,dfs(v,p));
	res++;
	if (res == k) ans++; 
	return res%k;
}
int main() {
	cin >> n >> k;
	for (int i=1;i<=n;i++) {
		cin >> G[i];
		if (i > 1) D[G[i]].push_back(i);
	}
	ans = (G[1] == 1) ? 0 : 1;
	for (int i=2;i<=n;i++) if (G[i] == 1) {
		for (int x : D[i]) dfs(i,x);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10752
#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;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int D, T, S; cin >> D >> T >> S;
  if(S*T >= D){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main(){
int i, j, N, M; cin >> N; M=N-1; int u, v, w, cl[N]={};
vector< vector<int> > nxV(N), nxD(N);
for(i=0; i<M; i++){
  cin >> u >> v >> w; u--; v--;
  nxV[u].push_back(v); nxV[v].push_back(u);
  nxD[u].push_back(w); nxD[v].push_back(w);
}
vector<int> V={0}; bool ksht[N]={}; ksht[0]=true;
for(i=0; i<V.size(); i++){
int v=V[i];
  for(j=0; j<nxV[v].size(); j++){
  int nv=nxV[v][j], nd=nxD[v][j]; if(ksht[nv]){ continue; }
  cl[nv]=(nd%2)?(cl[v]+1)%2:cl[v]; V.push_back(nv); ksht[nv]=true;
  }
}
for(i=0; i<N; i++){ cout << cl[i] << "\n"; }
}

Measured memory_bytes: 12416
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1; (i)>=(k); --(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
using namespace std;

int main() {
  int N;
  cin >> N;
  cout << ((N / 10 == 9 || N % 10 == 9) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <string>
#include <unordered_map>
using namespace std;
long long ans = 1;
int main(void){
    long long N,P;
    cin >> N >> P;
    if(N==1){
        cout << P << endl;
        return 0;
    }
    for(long long i=2;i * i<=P;i++){
        if(P % i == 0){
            int count = 0;
            while(P % i == 0){
                P /= i;
                count++;
                if(count == N){
                    ans *= i;
                    count = 0;
                }
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 3160
a, b = [int(i) for i in input().split()]



def createTriangularNumber(n):
    list_ = []
    list_.append(1)
    for k in range(2, n+1):
        list_.append(list_[-1] + k)
    return list_

triangular_number = createTriangularNumber(999)
diff = b - a
true_a = triangular_number[diff-2]
true_b = triangular_number[diff-1]
print(true_a - a)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define VI vector<int> 
#define SI set<int>
#define QI queue<int> 
#define PB push_back
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define M 1000000007
using namespace std;

int main()
{
    FIO
    ll n; cin>>n;
    if(n&1) {
        cout<<0;
    }
    else
    {
        ll count=0;
        for (ll i = 10; n/i >= 1; i*=5)
        {
            count += n/i;
        }
        cout<<count;
    }
    


    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/math>
using namespace std;
using namespace atcoder;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef long long ll;

int main(){
	ll n;
	cin >> n;
	ll ans = 2 * n;

	vector<ll> qs;
	for(ll p = 2; p * p <= n; ++p)
		if(n % p == 0){
			ll q = 1;
			do {
				q *= p;
				n /= p;
			} while(n%p == 0);
			qs.push_back(q);
		}
	if(n > 1) qs.push_back(n);
	int l = sz(qs);
	rep(msk,0,1<<l){
		vector<ll> r(l), m(l);
		rep(i,0,l){
			m[i] = qs[i]%2 ? qs[i] : 2 * qs[i];
			r[i] = msk & (1<<i) ? -1 : 0;
		}
		auto pa = crt(r, m);
		if(pa.first == 0) pa.first = pa.second;
		ans = min(ans, pa.first);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

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

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    vector<edge> edges;
    vvll cost(n, vll(n, LINF));
    rep(i, m) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        if (c > l) continue;
        --a;
        --b;
        cost[a][b] = min(cost[a][b], c);
        cost[b][a] = min(cost[b][a], c);
    }

    rep(k, n) rep(i, n) rep(j, n) {
        cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
    }

    vvint ans(n, vint(n, INF));
    rep(i, n) rep(j, n) {
        if (cost[i][j] <= l) ans[i][j] = 1;
    }
    rep(k, n) rep(i, n) rep(j, n) {
        ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
    }

    int q;
    cin >> q;
    vint s(q), t(q);
    rep(i, q) {
        cin >> s[i] >> t[i];
        --s[i];
        --t[i];
    }
    rep(i, q) {
        if (ans[s[i]][t[i]] == INF) puts("-1"); 
        else {
            cout << ans[s[i]][t[i]]-1 << endl;
        }
        
    }
    
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n; i >= 0; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n;
  cin >> n;
  vector<pair<pair<string, int>, int>> c(n);
  rep(i,n) {
    string s;
    int p;
    cin >> s >> p;
    c[i] = make_pair(make_pair(s,-p), i+1);
  }
  sort(all(c));
  
  rep(i,n) {
    cout << c[i].se << endl;
  }
}

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

#define _USE_MATH_DEFINES

struct Point{double x, y;};

void koch(int n, Point a, Point b){
    if(n == 0)return;
    
    Point s, t, u;
    double rad = 60.0 * M_PI / 180.0;
    s.x = (2.0 * a.x + 1.0 * b.x)/3.0;
    s.y = (2.0 * a.y + 1.0 * b.y)/3.0;
    t.x = (1.0 * a.x + 2.0 * b.x)/3.0;
    t.y = (1.0 * a.y + 2.0 * b.y)/3.0;
    u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
    u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;
    
    koch(n-1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n-1, t, b);
}

int main(void){
    Point a, b;
    int n;
    
    scanf("%d", &n);
    
    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;
    
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);
    
    return 0;
}


Measured memory_bytes: 2736
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-03-25 17:35:55
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod) {
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod) {
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod) {
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    map<int, int> memo;
    for (int i = 0; i < n; i++) 
        memo[a[i]]++;

    LL total = 0;
    for (const auto& x : memo) {
        int v = x.second;
        total += (LL)v*(v-1)/2;
    }

    for (int i = 0; i < n; i++) {
        int w = a[i];
        int v = memo[w];

        cout << total - v + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 8320
use std::io::BufRead;
use std::str::FromStr;
use std::fmt::Debug;

struct Scanner<R: BufRead> {
    buf_reader: R,
}

impl<R: BufRead> Scanner<R> {
    fn new(buf_reader: R) -> Self {
        Scanner {buf_reader: buf_reader}
    }
    fn read_line<T>(&mut self) -> Vec<T> where T: FromStr, <T as FromStr>::Err: Debug {
        let mut line = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        line.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
    }
    fn read_single_value<T>(&mut self) -> T where T: FromStr, <T as FromStr>::Err: Debug {
        let mut line = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        let sv: Vec<&str> = line.trim().split_whitespace().collect();
        sv[0].parse::<T>().unwrap()
    }
}

fn gcd(x: i32, y: i32) -> i32 {
    if x < y {
        gcd(y, x)
    }
    else if x % y == 0 {
        y 
    }
    else {
        gcd(y, x%y)
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut scanner = Scanner::new(stdin.lock());
    let mut a = scanner.read_line::<i32>();
    println!("{}", gcd(a[0], a[1]));
}



Measured memory_bytes: 5036
import java.util.*;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        
        int[] map  = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		int[] boxs = new int[N];
		int sumF = 0;
		for (int i = map.length-1; i >= 0; i--) {
			int a = map[i];
			int sum = 0;
			for (int j = (i+1); j-1 < map.length; j += (i+1)) {
				sum += boxs[j-1];
			}
			
			if (a != (sum % 2)) {
				boxs[i] = 1;
				sumF++;
			}
		}
		
		System.out.println(sumF);
		
		for (int i=1; i<=N; i++) {
			if (boxs[i-1] == 1) {
				System.out.println(i);
			}
		}
		
    }
}

Measured memory_bytes: 84872
import math
a,b,x =map(int,input().split( ))
if x >= (a**2*b/2):
    k=2*x/(a**2)-b
    cos=math.sqrt((b-k)**2/((a**2)+(b-k)**2))
    print(90-math.degrees(math.acos(cos)))
else:
    k=2*x/(a*b)
    cos=math.sqrt(b**2/(b**2+k**2))
    print(90-math.degrees(math.acos(cos)))

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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<int> cumsum(N);
  cumsum[0] = 0;
  for (int i = 1; i < N; i++) {
    cumsum[i] = cumsum[i - 1];
    if (S[i] == 'C' && S[i - 1] == 'A') cumsum[i]++;
  }
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    cout << cumsum[r] - cumsum[l - 1] - (S[l - 1] == 'A' && S[l] == 'C')
         << endl;
  }
  return 0;
}

Measured memory_bytes: 1408
while True:
    h, w = map(int, raw_input().split())
    if h == 0 and w == 0:
        break
    else:
        result = list()
        for i in range(h):
            result.append(['#' for j in range(w)])
        for i in range(1, h - 1):
            for j in range(1, w - 1):
                result[i][j] = '.'
        for i in result:
            print("".join(j for j in i))
        print("")

Measured memory_bytes: 6476
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

void solve(int A, int B);

void solve(int A, int B) {
  int ans;
  if (A >= 13) {
    ans = B;
  } else if (A >= 6) {
    ans = B / 2;
  } else {
    ans = 0;
  }
  cout << ans << endl;
}

int main() {
  int A, B;
  cin >> A >> B;
  solve(A, B);
  return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int[] a = new int[3];
		int sum = 0;
		for(int aa : a) {
			aa = Integer.parseInt(scanner.next());
			sum += aa;
		}
		String ans = "win";
		if(sum > 21) {
			ans = "bust";
		}else {
			ans = "win";
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 21844
n,k=map(int,input().split())
a=list(map(int,input().split()))
d={j:0 for j in range(41)}
for ai in a:
  for j in range(41):
    if (ai>>j) & 1:
      d[j]+=1
ans=0
l=len(bin(k))-3
import sys
sys.setrecursionlimit(10**7)

def dp(m,t): # 一番左の桁（l桁目）から考える。一番右の桁は0桁目。t:kより真に小さいかどうか
  if m<0:return 0
  ret=0
  if t==1: # 以降は好きに選んでいいので、最適な数字を選ぶ。一意。
    for i in range(m+1):
      tmp=max(0,n-2*d[i])
      ret+=pow(2,i)*tmp
  else:
    if (k>>m)&1: #kのm桁目が1なら1か0を選べる
      # 1にするとき
      tmp1=dp(m-1,0)+(n-2*d[m])*pow(2,m)
      # 0にするとき
      tmp0=dp(m-1,1)                    
      ret+=max(tmp1,tmp0)
    else:
      ret+=dp(m-1,0)
  return ret

print(sum(a)+dp(l,0))

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

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

const int MAXN = 2E5 + 10;

char s[MAXN];

int main(){
	scanf("%s", s);
	int tot = 0;
	vector<int> cnt(26, 0);
	for (int i = 0; s[i]; ++i)
		++tot, ++cnt[s[i] - 'a'];
	ll ans = 0;
	for (int i = 0; i < 26; ++i)
		ans += cnt[i] * 1ll * (tot - cnt[i]);
	printf("%lld\n", ans / 2 + 1);
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 1005
#define ll long long
#define mod 1000000007
int n,a[N],b[N],m,ans=1,c=1,r=1,rem,col[N*N],row[N*N];
int q_pow(int x,int n){int ret=1;for(;n;n>>=1,x=(ll)x*x%mod)if(n&1)ret=(ll)ret*x%mod;return ret;}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(row[a[i]])return puts("0"),0;
		row[a[i]]=1;
	}
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&b[i]);
		if(col[b[i]])return puts("0"),0;
		col[b[i]]=1;
	}
	if(!row[n*m]||!col[n*m])return puts("0"),0;
	for(int i=n*m-1;i;i--)
	{
		if(row[i]&&col[i]){rem+=c+r,c++,r++;if(c>m||r>n)return puts("0"),0;}
		else if(col[i]){ans=(ll)r*ans%mod;c++;rem+=r-1;if(c>m)return puts("0"),0;}
		else if(row[i]){ans=(ll)ans*c%mod;r++;rem+=c-1;if(r>n)return puts("0"),0;}
		else {ans=(ll)ans*rem%mod;rem--;if(rem<0)return puts("0"),0;}
	}
	printf("%d\n",ans);
}

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

string shuffle(string s, int h){
  return s.substr(h, s.size()-h) + s.substr(0, h);
}

int main(){
  string s, ans[10];
  int m, h;

  int j=0;
  while(1){
    cin >> s;
    if(s == "-") break;
    cin >> m;
    
    for(int i=0; i<m; i++){
      cin >> h;
      s = shuffle(s, h);
    }
    ans[j] = s;
    j++;
  }
  
  for(int i=0; i<j; i++)
    cout << ans[i] << endl;
  return 0;
}



Measured memory_bytes: 3208
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
#define ll long long
const int maxn=(1<<18)+5;
const int maxnodes=(1<<9)+5;
const int maxcost=1e5+5;
int w[maxn],v[maxn],depth[maxn];
ll dp[maxnodes][maxcost];
vector<int> need;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&v[i],&w[i]);
    for(int i=2;i<=n;i++)
        depth[i]=depth[i/2]+1;
    int half=depth[n]/2;
    for(int i=1;i<=((1<<(half+1))-1);i++)
        for(int j=1;j<=100000;j++)
        {
            dp[i][j]=dp[i/2][j];
            if(j>=w[i])
                dp[i][j]=max(dp[i][j],dp[i/2][j-w[i]]+(ll)v[i]);
        }
    int q;
    scanf("%d",&q);
    while(q--)
    {
        int which,l;
        scanf("%d%d",&which,&l);
        need.clear();
        while(depth[which]>half)
        {
            need.push_back(which);
            which=which/2;
        }
        int items=(int)need.size();
        ll res=0;
        if(items==0)
            res=dp[which][l];
        else
            for(int i=0;i<(int)(1<<items);i++)
            {
                ll val=0;
                int cost=0;
                for(int j=0;j<items;j++)
                    if(i&(1<<j))
                    {
                        val+=(ll)v[need[j]];
                        cost+=w[need[j]];
                    }
                if(l>=cost)
                    res=max(res,dp[which][l-cost]+val);
            }
        printf("%lld\n",res);
    }
    return 0;
}


Measured memory_bytes: 406096
import sys
import random

def rd():
        return sys.stdin.readline().rstrip()

def rdi():
        return [ int(x) for x in rd().split() ]

(c11, c12, c13) = rd()
(c21, c22, c23) = rd()

if c12 == c22 and c11 == c23 and c13 == c21:
        print "YES"
else:
        print "NO"


Measured memory_bytes: 3316
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N;
	
	cin >> N;

	ll A[N];
	rep(i, N)
	{
		cin >> A[i];
	}

	sort(A, A+N);
	ll sum[N+1];
	sum[0] = 0;

	rep(i, N)
	{
		sum[i+1] = sum[i] + A[i];
	}

	int i = N-1;
	for(; i >= 0; i--)
	{
		if (sum[i] * 2 < A[i])
		{
			break;
		}
	}

	cout << N - i << endl;


	
	return 0;
}


Measured memory_bytes: 1792
module modulo_util
  implicit none
  integer(8), parameter :: md = 998244353_8
  integer(8), allocatable :: f(:), invf(:)
contains
  subroutine init(n)
    integer, intent(in) :: n
    integer :: i
    if (allocated(f)) deallocate(f)
    if (allocated(invf)) deallocate(invf)
    allocate(f(0:n),invf(0:n))
    f = 0_8
    invf = 0_8
    f(0) = 1_8
    do i = 1, n
      f(i) = mod(f(i-1)*int(i,8),md)
    end do
    invf(n) = inv(f(n))
    do i = n, 1, -1
      invf(i-1) = mod(invf(i)*int(i,8),md)
    end do
  end
  integer(8) function perm(n,k)
    integer, intent(in) :: n, k
    perm = 0_8
    if (k > n .or. n < 0 .or. k < 0) return
    perm = mod(f(n)*invf(n-k),md)
  end
  integer(8) function comb(n,k)
    integer, intent(in) :: n, k
    comb = mod(perm(n,k)*invf(k),md)
  end
  integer(8) function homo(n,k)
    integer, intent(in) :: n, k
    homo = 1_8
    if (n == 0 .and. k == 0) return
    homo = comb(n+k-1,k)
  end
  function inv(n) result(y)
    integer(8), intent(in) :: n
    integer(8) :: a, b, x, y, t, q
    a = mod(n,md)
    b = md
    x = 0_8
    y = 1_8
    do while (b /= 0_8)
      q = a/b
      t = b
      b = mod(a,b)
      a = t
      t = y
      y = x
      x = t-q*x
    end do
    y = mod(mod(y,md)+md,md)
  end
  function pow(a,b) result(r)
    integer(8), intent(in) :: a
    integer, intent(in) :: b
    integer :: i
    integer(8) :: r, p
    r = 1_8
    p = a
    do i = 0, 32
      if (btest(b,i)) r = mod(r*p,md)
      p = mod(p*p,md)
    end do
  end
end module modulo_util
program gp2
  use modulo_util
  implicit none
  integer :: n, m, i, d
  integer(8) :: ans = 0_8
  read(*,*) n, m
  call init(3*max(n,m))
  do i = mod(m,2), min(n,m), 2
    d = (3*m-i)/2
    ans = mod(ans+mod(comb(n,i)*modulo(homo(n,d)-int(i,8)*homo(n,d-m)-int(n-i,8)*homo(n,d-m-1),md),md),md)
  end do
  write(*,'(i0)') ans
end program gp2

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

#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)

using ll = long long;
#define INF 1e9

string s;
int K;

int main(){
  cin >> s;
  cin >> K;
  vector<string> sub;
  REP(i, s.size()){
    FOR(j, 1, K+1){
      if(i+j <= s.size()){
        sub.push_back(s.substr(i, j));
      }
    }
  }
  sort(sub.begin(), sub.end());
  int cnt = 0;
  string pre = sub[0] + "ab";
  REP(i, sub.size()){
    if(pre != sub[i]){
      cnt++;
      pre = sub[i];
    }
    if(cnt == K){
      cout << pre << endl;
      break;
    }
  }
  
  return 0;
}


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

int main(){
    int R,G,B,N; cin>>R>>G>>B>>N;

    ll ans=0;
    for(int r=0; r*R<=N; r++){
        for(int g=0; g*G<=N; g++){
            int b = N - r*R -g*G;
            if(b<0) break;
            if(b%B==0) ans++;
            // cerr << r << " " << g << " " << b <<endl;
        }
    }
    cout << ans << endl;
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// del

const i64 MAXN = 300005;

i64 n;
i64 m;

i64 a[MAXN];
i64 c[MAXN];
i64 ps[MAXN];

bool f(i64 k, i64 t) {
    i64 i = lower_bound(c + 1, c + m + 1, -t) - c;
    i64 s = ps[i - 1] - t * (i - 1);
    return s <= n - (k * t);
}

i64 bin(i64 k, i64 l, i64 r) {
    if (l == r) {
        return l;
    }
    if (l + 1 == r) {
        if (f(k, r)) {
            return r;
        }
        else {
            return l;
        }
    }

    i64 t = (l + r) / 2;
    if (f(k, t)) {
        return bin(k, t, r);
    }
    else {
        return bin(k, l, t);
    }
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

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

    for (i64 i = 0; i < n; i++) {
        c[a[i]]++;
    }

    sort(c + 1, c + n + 1, greater<i64>());

    for (i64 i = 1; i <= n; i++) {
        ps[i] = ps[i - 1] + c[i];
        if (c[i] != 0) {
            m++;
        }
    }

    for (i64 i = 1; i <= n; i++) {
        c[i] *= -1;
    }

    //i64 tt = f(3, 2);
    //cerr << tt << endl;

    stringstream ss;
    for (i64 k = 1; k <= n; k++) {
        i64 R = bin(k, 0, n / k);
        ss << R << endl;
    }

    cout << ss.str();

    return 0;
}

Measured memory_bytes: 9220
#include <iostream>
#include <float.h>
#include <cfloat>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <errno.h>
#include <cerrno>
#include <assert.h>
#include <cassert> 
#include <map>
#include <memory.h>
#include <cctype>
#include <ctype.h>
#include <math.h>
#include <vector> 
#include <cstdio> 
#include <set>
#include <string.h>
#include <stdio.h>
#include <new>
#include <memory>
#include <cmath>
#include <queue>
#include <cstring>
#define ll long long
#define fo(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define br break
#define ct continue
#define pb push_back
#define mp make_pair 
#define pi 3.141592653589793238462643383279502884197169
#define F first
#define S second
#define pii pair<int,int>  
#define em empty()
#define vei vector<int>
#define ves vector<string>
#define qui queue<int> 
#define qu queue
using namespace std;
bool compare(int x,int y)
{if(x>=y)
 return true;
 return false;
}
int main()
{int n,k,a,b;
 cin>>n>>k>>a>>b;
 if(compare(n,k))
 cout<<a*k+b*(n-k);
 else if(!compare(n,k))
 cout<<a*n;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;

int main() {
  int h, w, n;
  cin>>h>>w>>n;
  vector<pair<int,int>> vp;
  REP(i,n) {
    int a,b;
    cin>>a>>b;
    vp.emplace_back(a, b);
  }
  sort(ALL(vp));
  deque<int> odd, even;
  REP(i,w) {
    int index = i+1;
    if (index % 2) {
      odd.push_back(index);
    } else {
      even.push_back(index);
    }
  }
  auto itr = begin(vp);
  REP(i,h) {
    int y = i+1;
    swap(odd, even);
    if ((y % 2) == 0) {
      odd.push_front(even.front());
      even.pop_front();
      even.push_back(odd.back());
      odd.pop_back();
    }
    while (itr != end(vp) && itr->first < y) ++itr;
    for (; itr != end(vp) && itr->first == y; ++itr) {
      swap(odd[itr->second/2], even[(itr->second-1)/2]);
    }
  }
  vector<int> res(w);
  REP(i,w/2) {
    res[odd[i]-1] = i*2+1;
    res[even[i]-1] = i*2+2;
  }
  for (int i : res) {
    cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 5916