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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD (ll)1e9+7      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[])
{
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    ll dp[2][n+2];
    dp[0][0] = 1;
    dp[1][0] = 0;
    dp[0][1] = 1;
    dp[1][1] = 0;
    REP(i,m)
    {
        cin >> a[i];
        dp[0][a[i]] = INF * -1;
        dp[1][a[i]] = INF * -1;
    }
    

    FOR(i,2,n)
    {   
        if (dp[0][i] == INF * -1) continue;
        dp[0][i] = (max(dp[0][i-1],(ll)0) + max(dp[1][i-1],(ll)0));
        dp[1][i] = (max(dp[0][i-2],(ll)0) + max(dp[1][i-2],(ll)0));
        dp[0][i] %= MOD;
        dp[1][i] %= MOD;
        
    }

    ll ans = dp[0][n] + dp[1][n];
    ans %= MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
program xor_battle
  implicit none
  integer :: t, n, m, i, j, k
  integer(8) :: a(200) = 0, b(200) = 0, x
  character(200) :: s
  read(*,*) t
  do k = 1, t
    read(*,*) n
    read(*,*) a(1:n)
    read(*,*) s
    m = 0
    b = 0
    do i = n, 1, -1
      x = a(i)
      do j = 1, m
        x = min(x, xor(x, b(j)))
      end do
      if (x > 0) then
        if (s(i:i) == '0') then
          m = m + 1
          b(m) = x
        else
          write(*,'(i0)') 1
          goto 100
        end if
      end if
    end do
    write(*,'(i0)') 0
  100 end do
end program xor_battle

Measured memory_bytes: 2808
a,b,c=map(int,input().split())
s=a+b+c

if s%2==0:
    if a+b==c:
        print("Yes")
    elif a+c==b:
        print("Yes")
    elif c+b==a:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3060
n = input()
P = map(int, raw_input().split())
C = [0]*n
for i in xrange(n):
    C[P[i]-1] = i+1
A = [0]*n
B = [0]*n
su = 0
for i in xrange(n):
    su += C[i]
    A[i] = su
su = 0
for i in xrange(n-1, -1, -1):
    su += C[i]
    B[i] = su
print ' '.join(map(str, A))
print ' '.join(map(str, B))


Measured memory_bytes: 6620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 123456789012


int main(){
    ll i,j;
	string s;
	cin>>s;
	for(i=0;i<s.size();i++){
		if(i%2==0){
			if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
				cout<<"No"<<endl;
				return 0;
			}
		}
		else{
			if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define in1(n) cin>>n;
#define in2(n, k) cin>>n>>k;
#define in3(n, k, s) cin>>n>>k>>s;
#define scn(t) scanf("%d", &t)
#define scnld(t) scanf("%ld", &t)
#define scnlld(t) scanf("%lld", &t)
#define scnc(t) scanf("%c", &t)
#define scns(t) scanf("%s", t)
#define scnf(t) scanf("%f", &t)
#define scnlf(t) scanf("%lf", &t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define nloop(i, j, k, in) for (int i = j; i < k; i += in)
#define rloop(i, j, k, in) for (int i = j; i >= k; i -= in)
#define rep(i, j) nloop(i, 0, j, 1)
#define rrep(i, j) rloop(i, j, 0, 1)
#define inar(n, a) \
    rep(i, n)\
        cin>>a[i];
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert(B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define fast  \
    ios_base::sync_with_stdio(false);\
    cin.tie(NULL);
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
const double pi = acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

int main()
{
    fast
    int a, b, c, k;
    cin>>a>>b>>c>>k;
    int ans = 0;
    if (k >= a)
    {
        ans += a;
        k -= a;
    }
    else
    {
        ans += k;
        k = 0;
    }
    if (k >= b)
    {
        k -= b;
    }
    else
    {
        k = 0;
    }
    if (k >= c)
    {
        k -= c;
        ans -= c;
    }
    else
    {
        ans -= k;
        k = 0;
    }
    cout<<ans;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

void solve(int test_case) {
	ll n,m;
	cin>>n>>m;
	ll sol =0;
	if(m>=n*2) {
		sol=n;
		m-=n*2;
		sol+=m/4;
	} else {
		sol=m/2;
	}
	cout<<sol;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


Measured memory_bytes: 3572
package main

import (
	"fmt"
)

func main() {
	var s string
	var total int
	fmt.Scan(&s)

	total = 700
	for i:=0; i<len(s); i++ {
		if string(s[i]) == "o" {
			total += 100
		}
	}
	fmt.Println(total)
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> v(H);
  for (int i = 0; i < H; i++) cin >> v[i];

  for (int i = 0; i < H; i++) {
    bool flag = true;
    for (int j = 0; j < W; j++) if (v[i][j] != '.') flag = false;
    if (flag) for (int j = 0; j < W; j++) v[i][j] = '*';
  }

  for (int i = 0; i < W; i++) {
    bool flag = true;
    for (int j = 0; j < H; j++) if (v[j][i] != '.' && v[j][i] != '*') flag = false;
    if (flag) for (int j = 0; j < H; j++) v[j][i] = '*';
  }

  for (int i = 0; i < H; i++) {
    bool flag = false;
    for (int j = 0; j < W; j++) {
      if (v[i][j] != '*') {
        cout << v[i][j];
        flag = true;
      }
    }
    if (flag) cout << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int H,W,a,b,c=0;
	while(1){
		scanf("%d %d",&H,&W);
		if(c==1){printf("\n");}
		else{c=1;}
		for(a=0;a<H;a++){
			for(b=0;b<W;b++){
				if(a==0||a==H-1||b==0||b==W-1){
				printf("#");}
				else{printf(".");}
			}
			printf("\n");
		}
		if(H==0&&W==0){
			break;}
	}
	return 0;

}

Measured memory_bytes: 2620
using System;

public class Example {
    public static void Main() {
        while (true) {
            int[] score = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), delegate(string value) {
                return int.Parse(value);
            });
            if (score[0] < 0 && score[1] < 0 && score[2] < 0) break;
            if (score[0] < 0 || score[1] < 0) {
                Console.WriteLine("F");
            } else if (score[0] + score[1] >= 80) {
                Console.WriteLine("A");
            } else if (score[0] + score[1] >= 65) {
                Console.WriteLine("B");
            } else if (score[0] + score[1] >= 50) {
                Console.WriteLine("C");
            } else if (score[0] + score[1] >= 30) {
                Console.WriteLine(score[2] >= 50 ? "C" : "D");
            } else {
                Console.WriteLine("F");
            }
        }
    }
}

Measured memory_bytes: 8908
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if(v[i] >= k) ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	int x[200],y[200];
	while(true){
	cin>>n;
	if(n==0)
		break;
	x[0]=0,y[0]=0;
	int mx=0,dx=0,my=0,dy=0;
	int d,e;
	for(int i=1;i<n;i++){
		cin>>d>>e;
		x[i]=x[d],y[i]=y[d];
		if(e==0)
			x[i]--;
		if(e==1)
			y[i]--;
		if(e==2)
			x[i]++;
		if(e==3)
			y[i]++;
		if(x[i]>mx)
			mx=x[i];
		if(x[i]<dx)
			dx=x[i];
		if(y[i]>my)
			my=y[i];
		if(y[i]<dy)
			dy=y[i];
	}
	cout<<mx-dx+1<<" "<<my-dy+1<<endl;
	}
    return 0;
}

Measured memory_bytes: 1160
a_list = input()

for i in range(8):
    ans = int(a_list[0])
    z = format(i, '03b')

    if z[0] == "0":
      ans = ans + int(a_list[1])
      op1 = "+"
    else:
      ans = ans - int(a_list[1])
      op1 = "-"

    if z[1] == "0":
      ans = ans + int(a_list[2])
      op2 = "+"
    else:
      ans = ans - int(a_list[2])
      op2 = "-"

    if z[2] == "0":
      ans = ans + int(a_list[3])
      op3 = "+"
    else:
      ans = ans - int(a_list[3])
      op3 = "-"
    
    if ans == 7:
      print("{}{}{}{}{}{}{}=7".format(
        a_list[0], op1, a_list[1], op2, a_list[2], op3, a_list[3]
        ))
      break

Measured memory_bytes: 3064
#include <stdio.h>
int roman(char c) {
	if ('I' == c)
		return 1;
	if ('V' == c)
		return 5;
	if ('X' == c)
		return 10;
	if ('L' == c)
		return 50;
	if ('C' == c)
		return 100;
	if ('D' == c)
		return 500;
	if ('M' == c)
		return 1000;
	return 0;
}

int main() {
	char line[101];
	int i, value, buf;
	while (scanf("%100s ", line) != EOF) {
		value = buf = 0;
		for (i = 0; line[i] != '\0'; i++) {
			buf += roman(line[i]);
			if (line[i] != line[i+1]) {
				value += buf > roman(line[i+1]) ? buf : -buf;
				buf = 0;
			}
		}
		printf("%d\n", value);
	}
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }

        static long Solve(int H, int W, int K)
        {
            const int M = 1000000007;
            var counts = new int[W][];
            for (int i = 0; i < W; ++i) { counts[i] = new int[W]; }
            for (int i = 0; i < (1 << (W - 1)); ++i)
            {
                bool valid = true;
                for (int j = 0; j < W - 1; ++j)
                {
                    int mask = 3 << j;
                    if ((i & mask) == mask) { valid = false; }
                }
                if (valid)
                {
                    for (int j = 0; j < W; ++j)
                    {
                        int L = (j - 1 >= 0) ? 1 << (j - 1) : 0;
                        int R = (j < W - 1) ? 1 << j : 0;
                        if ((i & L) != 0)
                        {
                            ++counts[j][j - 1];
                        }
                        else if ((i & R) != 0)
                        {
                            ++counts[j][j + 1];
                        }
                        else
                        {
                            ++counts[j][j];
                        }
                    }
                }
            }
            var sum1 = new long[W];
            sum1[0] = 1;
            for (int i = 0; i < H; ++i)
            {
                var sum2 = new long[W];
                for (int j = 0; j < W; ++j)
                {
                    for (int k = 0; k < W; ++k)
                    {
                        sum2[k] += (sum1[j] * counts[j][k]) % M;
                        sum2[k] %= M;
                    }
                }
                sum1 = sum2;
            }
            return sum1[K - 1];
        }
        static void Main(string[] args)
        {
            var V = ReadInts();
            Console.WriteLine(Solve(V[0], V[1], V[2]));
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define N 1000010
using namespace std;
int pri[N];


int main(){
  for(int i=2;i*i<=N;i++)
    if(pri[i]==0)for(int j=2;j<=N/i;j++)pri[i*j]=1;
  while(1){
    int n;
    cin>>n;
    if(n==0) break;

    int cnt=0;
    for(int i=2;i<=n;i++){
      if(pri[i]==0) {
	int ans=n-i;
	if(pri[ans]==0 && i<=ans)cnt++;
      }
    }
    cout<<cnt<<endl;
  }
  return 0;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        bool ok = false;
        repeat(i,1, 10) {
            if(N % i == 0) ok |= N / i < 10;
        }
        cout << (ok ? "Yes" : "No") << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
long long shakutori(const vector<int>& a, long long x){
    int right = 1;
    long long ans = 0;
    long long sum = 0;
    for (int left = 0; left < a.size(); left++)
    {
        while(sum + a[right-1] <= x && right <= a.size()) {
            sum += a[right-1];
            right++;
        }
        ans += right - left - 1;
        if(left == right) ++right;
        sum -= a[left];
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<long long> ans(q,0);
    for (int i = 0; i < q; i++)
    {
        long long x; cin >> x;
        ans[i] = shakutori(a, x);
    }
    for (int i = 0; i < q; i++)
    {
        cout << ans[i] << endl;
    }
    
    return 0;
}


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

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

	int ans = 0;
	for (int digit = 3; digit <= 9; digit++) {
		for (int i3 = 1; i3 <= digit - 2; i3++) {
			for (int i5 = 1; i3 + i5 <= digit - 1;i5++) {
				int i7 = digit - i3 - i5;
				vector<int>v;
				for (int i = 0;i < i3;i++) {
					v.push_back(3);
				}
				for (int i = 0;i < i5;i++) {
					v.push_back(5);
				}
				for (int i = 0;i < i7;i++) {
					v.push_back(7);
				}
				do {
					int vnum = 0;
					for (auto x : v) {
						vnum *= 10;
						vnum += x;
					}
					if (vnum <= n) {
						ans++;
					}
				} while (next_permutation(v.begin(), v.end()));     // 次の順列を生成
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   int[] a = new int[N+1];
   int[] b = new int[N+1];
   int[] c = new int[N+1];
 
   for(int i=0;i<N;i++)
   {
     a[i] = sc.nextInt();
     b[i] = sc.nextInt();
     c[i] = sc.nextInt();
   }
   int[][] dp = new int[N+1][3];
   dp[0][0]=0;
   dp[0][1]=0;
   dp[0][2]=0;
   dp[1][0]=a[0];
   dp[1][1]=b[0];
   dp[1][2]=c[0];

   for(int i=2;i<=N;i++)
   {
     if(dp[i-1][0]+b[i-1]>dp[i-1][2]+b[i-1]) dp[i][1]=dp[i-1][0]+b[i-1];
     else dp[i][1]=dp[i-1][2]+b[i-1];
     if(dp[i-1][1]+a[i-1]>dp[i-1][2]+a[i-1]) dp[i][0]=dp[i-1][1]+a[i-1];
     else dp[i][0]=dp[i-1][2]+a[i-1];
     if(dp[i-1][0]+c[i-1]>dp[i-1][1]+c[i-1]) dp[i][2]=dp[i-1][0]+c[i-1];
     else dp[i][2]=dp[i-1][1]+c[i-1];
   }
   int[] arr = {dp[N][0],dp[N][1],dp[N][2]};
   Arrays.sort(arr);
   System.out.println(arr[2]);
 }
}

Measured memory_bytes: 93604
#include<iostream>
using namespace std;
int main()
{
string s;
cin>>s;
if(s=="SAT")
{
    cout<<"1"<<endl;
}
else if(s=="SUN")
{
    cout<<"7"<<endl;
}
else if(s=="MON")
{
    cout<<"6"<<endl;
}
else if(s=="TUE")
{
    cout<<"5"<<endl;
}
else if(s=="WED")
{
    cout<<"4"<<endl;
}
else if(s=="THU")
{
    cout<<"3"<<endl;
}
else if(s=="FRI")
{
    cout<<"2"<<endl;
}
    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
int main() {
	int i,j,sum;
	scanf("%d %d", &i,&j);
	sum=i+j;
	if (sum == 0) {
		printf("%d\n",0);
	}
	else if(sum >= 1) {
		printf("%d\n", 1);
	}
	else if(sum<=-1){
		printf("%d\n", -1);
	}
	return 0;
}


Measured memory_bytes: 2688
d = dict()

def getv(a):
  M = int(input())
  for x in range(M):
    n = input()
    if d.get(n) is None:
      d[n] = 0
    d[n] += a

getv(1)
getv(-1)

print(max(0,d[sorted(d, key=lambda x:d[x], reverse=True)[0]]))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a[1001];
int b[1001];
int main() {
	int n,cnt=0,flag=0;
	scanf("%d",&n);
	for(int i=1; i<=n; i++) {
		scanf("%d",&a[i]);
		if(a[i]>i) flag=1;
		if(!b[a[i]]) b[a[i]]=a[i];
		else {
			for(int j=i-1; j>=a[i]; j--)
				b[j+1]=b[j];
			b[a[i]]=a[i];
		}
	}
	if(flag) puts("-1"),exit(0);
	for(int i=1; i<=n; i++)
		printf("%d\n",b[i]);
	return 0;
}

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

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

  ll n, T;
  string str;
  cin >> n >> T >> str;
  ll ans = 0;
  bool flg = true;


  for(size_t i = 0; i < str.length(); i+=4){
    int beki = str[i+2] - '0';
    ll adding = 1;
    for(int i  = 0; i < beki; i++){
      adding *= n;
      if(adding > M){
	flg = false;
	break;
      }
    }
    if(flg == false) break;
    adding *= T;
    if(adding > M){
      flg = false;
      break;
    }
    ans += adding;
    if(ans > M){
      flg = false;
      break;
    }
  }
  if(flg) cout << ans << endl;
  else cout << "TLE" << endl;

  return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <tuple>
#define ed "\n"
using namespace std;
struct P
{
    int x;
    int y;
};
int main()
{
    int n;
    cin >> n;
    vector<P> m(n);
    if (n == 1)
    {
        cout << "1" << ed;
        return 0;
    }
    //入力
    for (int i = 0; i < n; i++)
    {
        cin >> m[i].x >> m[i].y;
    }
    sort(m.begin(), m.end(), [](const P &a, const P &b) { if(a.x == b.x){ return a.y < b.y; } return a.x < b.x; });
    map<tuple<int, int>, int> memo;
    int max = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            P t;
            if (m[i].x - m[j].x >= 0)
                t = {m[i].x - m[j].x, m[i].y - m[j].y};
            else
                t = {-(m[i].x - m[j].x), -(m[i].y - m[j].y)};
            cerr << m[i].x << "-" << m[j].x << " " << i << " " << j << "\n";
            memo[make_tuple(t.x, t.y)]++;
            if (max < memo[make_tuple(t.x, t.y)])
                max = memo[make_tuple(t.x, t.y)];
        }
    }
    cout << n - max << ed;
    
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//      std macros
typedef long long ll;
typedef pair<int ,int> pii;
typedef pair<ll ,ll> pll;
//      dereference
#define F first
#define S second
#define pb push_back
#define mp make_pair
//      loops
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,a,b) for(int i=a;i<=b;++i)
#define PER(i,b,a) for(int i=b;i>=a;--i)
#define all(X) (X).begin(), (X).end()
//      I/O
#define sd(n) scanf("%d",&n)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sll(n) scanf("%lld",&n)
#define sll2(x,y) scanf("%lld%lld",&x,&y)
#define sll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define ss(s) scanf("%s",s)
//      debug
#define debug(x) cerr<<"debug->"<<#x<<"::"<<x<<endl
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<"\n"
//      set values
#define mset(n,k) memset(n,k,sizeof(n))
//modular expo
ll power(ll a,ll b, ll c){
    ll x=1,y=a;
    while(b>0){
        if(b&1)
            x=(x*y)%c;
        y=(y*y)%c;
        b/=2;
    }
    return x%c;
}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};//clockwise from left
int dr[]={1,1,0,-1,-1,-1, 0, 1};
int dc[]={0,1,1, 1, 0,-1,-1,-1};//anticlockwise from down
const int N = 505;
ll C[N],S[N],F[N],T[N];
int main() {

	ll n;
	sll(n);
	REP(i,1,n-1) {
		sll3(C[i],S[i],F[i]);
	}
	ll el = 0;
	REP(i,1,n) {
		el=S[i]+C[i];
		REP(j,i+1,n-1) {
			ll nx = S[j];
			if(nx>el) {
				el+=(nx-el);
				el+=C[j];
			}
			else {
				int diff = el-nx;
				if(diff%F[j] == 0) {
					el+=C[j];
				}
				else {
					ll tk = 0;
					for(;;) {
						tk+=F[j];
						if(tk>el)
							break;
					}
					el+=(tk-el);
					el+=C[j];
				}
			}
		}
		T[i] = el;
		printf("%lld\n",T[i]);
	}

	
	
	return 0;
}

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


int main()
{
	int n;
	cin >> n;
	long long m=0,a=0,r=0,c=0,h=0;
	while (n--)
	{
		string s;
		cin >> s;
		if (s[0]=='M')
			m++;
		if (s[0]=='A')
			a++;
		if (s[0]=='R')
			r++;
		if (s[0]=='C')
			c++;
		if (s[0]=='H')
			h++;
	}
	unsigned long long answer=0;
	answer += m*a*r;
	answer += m*a*c;
	answer += m*a*h;
	answer += m*r*c;
	answer += m*r*h;
	answer += m*c*h;
	answer += a*r*c;
	answer += a*r*h;
	answer += a*c*h;
	answer += r*c*h;
	cout << answer;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

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

    int N3 = N * 3;
    int A[N3];

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

    sort(A, A + N3, greater<int>());

    long long sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += A[i * 2 + 1];
    }
    cout << sum << endl;
}

Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>
#include<limits>
#include <unordered_map>
#include <numeric>
#include <array>
#include <queue>
#include <chrono>
#include <random>
#include <fstream>


using namespace std;
using  ull = unsigned long long int;

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)
#define INF (1<<29)
#define MD 1000000007

int main() {

	int n, a ,sub;
	cin >> n >> a;

	if (n < 500)sub = n;
	else sub = n % 500;

	if (sub <= a) cout << "Yes" << endl;
	else cout << "No" << endl;






	return 0;
}

Measured memory_bytes: 256
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//s配列に格納した単語を、辞書順にソートする
//getline(cin, s);
//  sort(s.begin(), s.end());
//  string t = "keyence";//で文字列入力ができる
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int kan_hyaku(int n){
  int kurai = 0;
  for(int i=0;i<3;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ju(int n){
  int kurai = 0;
  for(int i=0;i<2;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ichi(int n){
  int kurai = 0;
  for(int i=0;i<1;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i);
  int count = 0;
  if(n%2!=0){//奇数のとき
    for(int i=0;i<n;i++){
      if(i%2==0){
        b.at( (n-1)/2 -count) = a.at(i);
      }
      else{
        count ++;
        b.at( (n-1)/2 + count) = a.at(i);
      }
    }
  }
  else{
    for(int i=0;i<n;i++){
      if(i%2==0){
        b.at(n/2 + count) = a.at(i);
      }
      else{
        count ++;
        b.at(n/2 - count) = a.at(i);
      }
    }
  }
  rep(i,n){
    cout<<b.at(i);
    if(i!=n-1) cout<<" ";
    else       cout<<endl;
  }
}


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

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

void dfs(int v, int parent=-1){
	for(int u : to[v]){
		if(u == parent) continue;
		ans[u] += ans[v];
		dfs(u,v);
	}
}

int main(){
	int n, q;
	cin >> n >> q;
	
	rep(i,n-1){
		int a, b;
		cin >> a >> b;
		--a; --b;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	
	ans.resize(n);
	
	rep(i,q){
		int p, x;
		cin >> p >> x;
		--p;
		ans[p] += x;
	}
	
	dfs(0);
	
	rep(i,n){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 23552
N = int(input())
*A, = map(int, input().split())
A.sort()

a, b, c = 0, 0, 0
for i in A:
    if i<0:
        a+=1
    elif i>0:
        c+=1
    else:
        b+=1

if b:
    ans = sum(map(abs, A))
elif c:
    for i,j in enumerate(A):
        if j>=0:break

    if a%2==0:
        ans = sum(map(abs, A))
    else:
        for i,j in enumerate(A):
            if j>=0:break
        ans = sum(map(abs, A)) + 2 * max(-abs(A[i-1]), -abs(A[i]))
else:
    if a%2 == 0:
        ans = sum(map(abs, A))
    else:
        ans = sum(map(abs, A[:-1]))+A[-1]

print(ans)

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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



class UnionFind {
public:
	vector<int>rank, parent;
	//初期化
	UnionFind(int size) {
		rank.resize(size, 0);
		parent.resize(size, 0);
		REP(i, size)parent[i] = i;
	}
	//木の根を求める
	int find(int x) {
		if (parent[x] == x)return x;
		else return parent[x] = find(parent[x]);
	}
	//xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y])
			parent[x] = y;
		else {
			parent[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	//xとyが同じ集合に属するか否か
	bool same(int x, int y) {
		return (find(x) == find(y));
	}
};

ll count(set<int>& st, vector<pair<int, int>>& xy) {
	set<int> stx, sty;
	for (auto idx : st) {
		stx.insert(xy[idx].first);
		sty.insert(xy[idx].second);
	}
	return (ll)stx.size()*sty.size();
}

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

	UnionFind uf(N);
	vector<pair<int, int>> xy(N);
	REP(i, N)cin >> xy[i].first >> xy[i].second;

	// mp:  pos -> idx
	map<int, set<int>> mpx, mpy;
	REP(i, N) {
		mpx[xy[i].first].insert(i);
		mpy[xy[i].second].insert(i);
	}
	for (auto itr : mpx) {
		auto st = itr.second;
		int base = *st.begin();
		for (auto opp : st)uf.unite(base, opp);
	}
	for (auto itr : mpy) {
		auto st = itr.second;
		int base = *st.begin();
		for (auto opp : st)uf.unite(base, opp);
	}

	// mp: par->idx
	map<int, set<int>> par;
	REP(i, N) par[uf.find(i)].insert(i);

	// calc
	ll res = 0;
	for (auto itr : par) res += count(itr.second, xy);
	cout << res - N << endl;
	return 0;
}


Measured memory_bytes: 34560
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <stack>
using namespace std;
typedef long long LL;
const int N = 1e5+7 , INF = 0x3f3f3f3f , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
template<typename T1>
T1 gcd(T1 a , T1 b){ return b ? gcd(b,a%b) : a;}

LL a[N];

int fabs_int(int x){
    return x >= 0 ? x : -x;
}

int solve(int n,int m){
    if( fabs_int(n-m) > 1 ) return 0;
    LL ans = a[n] * a[m] * ( fabs_int(n-m) == 1 ? 1 : 2 ) % MOD;
    return (int)ans;
}

int main(){
#ifdef LOCAL
    freopen("F:\\c++\\in.txt", "r", stdin);
//  freopen("F:\\c++\\out.txt","w",stdout);
#endif
    a[0] = 1;
    for(int i = 1 ; i < N ; i++)
        a[i] = a[i-1]*i%MOD;
    int n,m;
    scanf("%d%d",&n,&m);
    printf("%d\n",solve(n,m));
    return 0;
}


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

int main() {
	int n,T;cin>>n>>T;
	vector<int> c(n),t(n);
	int ans=1001;
	for(int i=0;i<n;i++){
		cin>>c[i]>>t[i];
		if(t[i]<=T){
			if(ans>c[i]){
				ans=c[i];
			}
		}
	}
	if(ans==1001){
		cout<<"TLE"<<endl;
	}else{
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();

    let mut count = 0;
    for i in 0..n {
        let mut count2 = 0;
        if i % 2 == 0 {
            for j in 0..i {
                if (i+1) % (j+1) == 0 {
                    count2 += 1;
                }
            }
            if count2 == 7 {
                count += 1;
            }
        }
    }
    println!("{}", count);
}

Measured memory_bytes: 4352
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;

int main() {
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    vector<int> h;
    for (int i = 0; i < n; i++) {
        int hi;
        scanf("%d", &hi);
        h.push_back(hi);
    }

    // binary search
    ll left = 0;
    ll right = *max_element(h.begin(), h.end());
    ll mid = (left + right) / 2;

    while (left < right) {
        ll num_plus = 0;
        for (int i = 0; i < n; i++) {
            // 切り上げの計算
            num_plus += max((ll)0, (h[i] - b * mid + a - b - 1) / (a - b));
        }

        if (mid < num_plus) {
            left = mid + 1;
        } else if (mid > num_plus) {
            right = mid;
        } else {
            break;
        }

        mid = (left + right) / 2;
    }
 
    printf("%lld\n", mid);

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define SIZE 1000005
#define ALP 30
using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;

struct trie
{
	vector <char> ch;
	vector <trie*> nd;
	bool end;
	trie(bool end=false):end(end){}
};
trie root;
char str[SIZE];
string S[SIZE];
int cnt[ALP];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%s",&str);
		S[i]=str;
		reverse(S[i].begin(),S[i].end());
		trie *at=&root;
		for(int j=0;j<S[i].size();j++)
		{
			int pos=-1;
			for(int k=0;k<at->ch.size();k++) if(at->ch[k]==S[i][j]) pos=k;
			if(pos==-1)
			{
				pos=at->ch.size();
				at->ch.push_back(S[i][j]);
				at->nd.push_back(new trie());
			}
			at=at->nd[pos];
		}
		at->end=true;
	}
	int ret=0;
	for(int i=0;i<n;i++)
	{
		memset(cnt,0,sizeof(cnt));
		for(int j=0;j<S[i].size();j++) cnt[S[i][j]-'a']++;
		trie *at=&root;
		for(int j=0;j<S[i].size();j++)
		{
			int pos=-1;
			for(int k=0;k<at->ch.size();k++)
			{
				if(at->nd[k]->end)
				{
					int c=at->ch[k]-'a';
					if(cnt[c]>0) ret++;
				}
				if(at->ch[k]==S[i][j]) pos=k;
			}
			cnt[S[i][j]-'a']--;
			at=at->nd[pos];
		}
	}
	printf("%d\n",ret-n);
}

Measured memory_bytes: 160628
#include <stdio.h>

int main(void)
{
  int n, k, q, a[100000];
  scanf("%d %d %d", &n, &k, &q);
  int i;
  for (i = 0;i < q;i++){
    scanf("%d", &a[i]);
  }
  int score[n + 1];
  int j;
  for (j = 1;j <= n;j++){
    score[j] = k - q;
  }
  
  int l;
  for (l = 0;l < q;l++){
    score[a[l]] += 1;
  }
  
  int m;
  for (m = 1;m <= n;m++){
    if (score[m] > 0){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return 0;
}


Measured memory_bytes: 1280
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 >= c) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}

Measured memory_bytes: 23764
from itertools import permutations
def cal(a, b):
    x, y = a
    x1, y1 = b
    dis = ((x - x1) ** 2 + (y - y1) ** 2)**0.5
    return dis

n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
cnt = 0
dis = 0
for l in permutations(range(n), n):
    cnt += 1
    for i in range(n - 1):
        dis += cal(xy[l[i]], xy[l[i + 1]])
print(dis / cnt)


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int a, b; cin >> a >> b;
  cout << a * b << '\n';
  return 0;
}


Measured memory_bytes: 3652
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, Y = MAP()

for i in range(Y//10000+1):
	rr = Y - 10000*i
	kk = N - i
	for j in range(rr//5000 + 1):
		remain = rr - 5000*j
		k = kk - j
		if k >= 0 and k*1000 == remain:
			print(i, j, k)
			exit()

print(-1, -1, -1)


Measured memory_bytes: 14356
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1e9+7;

int n;
string s;
ll dp[3001][3001];
void solve()
{
  dp[n][0]=(s[n-2]=='>')?1:0;
  dp[n][1]=(s[n-2]=='<')?1:0;
  for(int i=n-1;i>=2;i--)
  {
    int total=n-i+1;
    for(int g=0;g<=total;g++)
    {
      if(g==0)
      {
        dp[i][g]=0;
        if(s[i-2]=='<')
        continue;
        //s=total-g=total-0=total
        for(int j=1;j<=total;j++)
        dp[i][g]=(dp[i][g]+dp[i+1][total-j])%mod;
      }
      else
      {
        if(s[i-2]=='>')
        dp[i][g]=(mod+dp[i][g-1]-dp[i+1][g-1])%mod;
        else
        dp[i][g]=(mod+dp[i][g-1]+dp[i+1][g-1])%mod;
      }
    }
  }
}
int main()
{
  cin>>n;
  cin>>s;
  solve();
  ll ans=0;
  for(int gr=n-1;gr>=0;gr--)
    ans=(ans+dp[2][gr])%mod;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 49732
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,c;
	cin >>n;
     c=1;
	while (1) {
		if (c<= n/2) {
			c*= 2;
		}
		else {
			break;
		}
	}

	cout <<c<< endl;
return 0;
}



Measured memory_bytes: 256
using System;

namespace C___Slimes
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int count = 1;
            char c = s[0];
            for (int i = 0; i < n; i++)
            {
                if (s[i] != c)
                {
                    count++;
                    c = s[i];
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11232
#include<stdio.h>
#include<stdlib.h>
  
#define NIL -1
#define MAX 500001
  
typedef struct{
  int right;
  int left;
  int key;
  int parent;
} Node;
  
void Insert(Node*,int,int);
void PreOrder(Node*,int);
void InOrder(Node*,int);
void Find(Node*,int, int);
void Delete(Node*,int);
int Successor(Node*, int);
  
int main(void){
  int i, n, k, f, del, count=0;
  char state[8];
  Node T[MAX];
  
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s", state);
  
    if(state[0] == 'i'){
  
      scanf("%d",&k);
      Insert(T, count, k);
      count++;
  
    } else if(state[0] == 'p'){
  
      if(count > 0){
        InOrder(T, 0);
        printf("\n");
        PreOrder(T, 0);
        printf("\n");
      }
  
    } else if(state[0] == 'f'){
  
      scanf("%d", &f);
      Find(T, f, 0);
  
    } else if(state[0] == 'd'){
  
      scanf("%d", &del);
      Delete(T, del);
  
    }
  }
  return 0;
}
  
void Insert(Node *T,int count, int k){
  int x, y;
  
  T[count].key = k;
  T[count].left = NIL;
  T[count].right = NIL;
  //T[count].parent = NIL;
  
  if(count == 0) return;
  
  x = 0;
  while(x!=NIL){
    y = x;
  
    if(k < T[x].key) x = T[x].left;
    else x = T[x].right;
  
  }
  
  T[count].parent = y;
  
  if(k < T[y].key) T[y].left = count;
  else T[y].right = count;
  
  return;
}
  
void PreOrder(Node *T, int u){
  
  if(u == NIL) return;
  
  printf(" %d", T[u].key);
  PreOrder(T, T[u].left);
  PreOrder(T, T[u].right);
  
  return;
}
  
void InOrder(Node *T, int u){
  
  if(u == NIL) return;
  
  InOrder(T, T[u].left);
  printf(" %d", T[u].key);
  InOrder(T, T[u].right);
  
  return;
}
  
void Find(Node *T, int f, int u){
  
  if(u == NIL) printf("no\n");
  else if(T[u].key == f) printf("yes\n");
  else if(T[u].key > f && T[u].left != NIL) Find(T, f, T[u].left);
  else Find(T, f, T[u].right);
  
  return;
}
  
void Delete(Node *T, int k){
  int x, y, z = 0;
  
  while(1){
    if(T[z].key == k) break;
    else if(k < T[z].key) z = T[z].left;
    else z = T[z].right;
  
  }
  
  if(T[z].left == NIL || T[z].right == NIL) y = z;
  else y = Successor(T, z);
  
  if(T[y].left != NIL) x = T[y].left;
  else x = T[y].right;
  
  if(x != -1) T[x].parent = T[y].parent;
  
  if(T[y].parent != NIL){
    if(y == T[T[y].parent].left) T[T[y].parent].left = x;
    else T[T[y].parent].right = x;
  }
  
  if(y != z) T[z].key = T[y].key;
  
  return;
  
}
  
int Successor(Node *T,int x){
  int y;
  
  if(T[x].right != NIL){
    x = T[x].right;
    while(T[x].left != NIL) x = T[x].left;
    return x;
  } else {
    y = T[x].parent;
    while(y != NIL && x == T[y].right){
      x = y;
      y = T[y].parent;
    }
    return y;
  }
  
}



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

#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()  
{ 
    FAST_INP;
    string s,t;
    cin >> s >> t;
    int ans=0;
    for(int i=0;i<t.size()-1;i++){
        if(s[i]==t[i]) ans++;
    }
    if(ans==t.size()-1) cout << "Yes\n";
    else cout << "No\n";
    return 0;
} 

Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
    int A[3];
    for (int i = 0; i < 3; i++) {
        cin >> A[i];
    }

    sort(A, A + 3);
    cout << A[2] - A[0] << endl;
    return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:134217728")

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VInt;

#define FOR(i, a, b) for(i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair

VInt E[128];
int L[128];

int dfs(int a, int p)
{
	int res = 1;
	int i;
	FOR(i, 0, SIZE(E[a]))
		if (E[a][i] != p)
			res = max(res, dfs(E[a][i], a) + 1);

	return res;
}

void dfs(int a, int p, int pos)
{
	int cnt = 0;
	int i;
	FOR(i, 0, SIZE(E[a]))
		if (E[a][i] != p)
		{
			++cnt;
			dfs(E[a][i], a, pos + 1);
		}

	L[pos] = max(L[pos], cnt);
}

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

	int i, j;
	FOR(i, 1, N)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		--a;
		--b;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	vector<pair<int, PII>> v;
	FOR(i, 0, N)
		v.push_back(MP(dfs(i, -1), PII(i, -1)));

	FOR(i, 0, N)
		FOR(j, 0, SIZE(E[i]))
		{
			int a = i;
			int b = E[i][j];
			if (a > b) continue;
			v.push_back(MP(max(dfs(a, b), dfs(b, a)), PII(a, b)));
		}

	sort(ALL(v));
	Int res = 7LL << 60;
	FOR(i, 0, SIZE(v))
		if(v[i].first == v[0].first)
		{
			int a = v[i].second.first;
			int b = v[i].second.second;
			CLEAR(L, 0);
			dfs(a, b, 1);
			if (b != -1) 
			{
				dfs(b, a, 1);
				L[0] = 2;
			}
			Int r = 1;
			FOR(j, 0, N)
				if (L[j] != 0)
					r *= L[j];

			res = min(res, r);
		}

	printf("%d %lld\n", v[0].first, res);
	return 0;
};


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n, k ,h[100005],dp[100005];
int solve(int index)
{
  int  ans = 1e9;
    if (index == n)
        return 0;
    if (dp[index] != -1)
        return dp[index];
    for (int i = 1; i <= k; i++)
    {
        if(index+i<=n)
        ans = min(ans, abs(h[index+i]-h[index])+solve(index + i));
    }
    return dp[index]=ans;
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
    cin >> n >> k;
    for (int i = 0; i <= n + 50; i++)
        dp[i] = -1;
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    cout << solve(1);
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void yn(bool j){cout << (j ? "Yes" : "No") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> long long bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}

int main(){
    string S; cin >> S;
    pt(S == "ARC" ? "ABC" : "ARC");
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        int[] count = new int[N];
        
        for(int m=0;m<M;m++){
        	count[sc.nextInt()-1]++;
        	count[sc.nextInt()-1]++;
        }
        
        boolean ans = true;
        for(int n=0;n<N;n++){
        	if(count[n]%2!=0) ans = false;
        }
        
        if(ans) System.out.println("YES");
        else System.out.println("NO");
    }
}

Measured memory_bytes: 67524