akhauriyash/Code-Regression huggingface dataset:
N = int(input())
Q = [[] for _ in range(N)]

for i in range(N):
    A = int(input())

    for _ in range(A):
        x, y = map(int, input().split())
        Q[i].append((x - 1, y == 1))

res = 0

for k in range(1 << N):
    flag = False
    for i in range(N):
        f = (k & (1 << i)) > 0

        if not f:
            continue
        for q in Q[i]:
            x, y = q
            tx = (k & (1 << x)) > 0

            if (y and not tx) or (not y and tx):
                flag = True
                break

        if flag:
            break
    else:
        res = max(res, bin(k).count("1"))

print(res)


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

using namespace std;

int main (void) {
    int N, K;
    cin >> N >> K;

    int n = 0;
    int half_n = 0;
    for ( int i = 1; i <= N; i++ ) {
        if ( K % 2 == 0 ) {
            if ( i % K == 0 )
                n++;
            else if ( i % (K / 2) == 0 )
                half_n++;
        } else {
            if ( i % K == 0 )
                n++;
        }
    }

    cout << (long long)n * n * n + (long long)half_n * half_n * half_n << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define l(i,n) for(int i=0; i<n; i++)
int main()
{
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    cout<<n/3<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)

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

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)

/*
    problem : http://abc058.contest.atcoder.jp/tasks/arc071_a
    들어오는 n개의 string으로 만들 수 있는 글자 중 가장 긴 것중 사전순으로 가장 작은것을 출력
*/
int n;
const int Alphabet = 26;
VVI A;
string solve()
{
    REP(i, 0, n)
    {
        string s;
        cin >> s;

        for(auto c : s)
            ++A[i][c - 'a'];
    }

    string ans;
    REP(i, 0, Alphabet)
    {
        int cnt = 0, numChars = INT_MAX;
        REP(j, 0, n)
            if(A[j][i] != 0)
            {
                numChars = min(numChars, A[j][i]);
                ++cnt;
            }
        
        if(cnt == n)
            while(numChars--)
                ans += (char)i + 'a';
    }

    return ans;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
    cin >> n;

    A = VVI(n, VI(Alphabet, 0));

    cout << solve() << endl;

	return 0;
}

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

int Count(int A) {
  int count = 0;
  while (A % 2 == 0) {
    count++;
    A /= 2;
  }
  return count;
}

int main() {
  
  int N; cin >> N; int ans = 100;
  
  for (int i = 0; i < N; i++) {
    int A; cin >> A;
    int tmp = Count(A);
    ans = min(ans, tmp);
  }
  
  cout << ans << endl;
  
}

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

using namespace std;

int main() {
	string S,T;
	cin >> S;
	cin >> T;
	int count = 0;

	for(int i = 0; i < S.size(); i++) {
		if(S.at(i) != T.at(i)) {
			count++;
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3916
import java.util.Scanner;

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

		String S = sc.next();
		int start = 0;	// Rの開始
		int end = 0;	// Lの次のRの位置

		int[] itg = new int[S.length()];

		while (start < S.length()) {
			int rl = start;		//	Rの次のLの位置
			for (; rl < S.length(); rl++) {
				if (S.charAt(rl) == 'L') {
					break;
				}
			}
			for (end = rl; end < S.length(); end++) {
				if (S.charAt(end) == 'R') {
					break;
				}
            }
			itg[rl] = (end - rl - 1) / 2 + (rl - start) / 2 + 1;	// end～rlの次の偶数離れ + rl～startの偶数離れ + 自分
			itg[rl - 1] = end - start - itg[rl];

			start = end;
		}

		for (int i : itg) {
			System.out.print(String.valueOf(i) + " ");
		}
		System.out.println();
	}
}

Measured memory_bytes: 41000
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

import bisect
A2 = []
B2 = []
C2 = []
# for a,b,c in zip(A,B,C):
#     bisect.insort_left(A2, a)
#     # bisect.insort_left(B2, b)
#     bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

Measured memory_bytes: 22516
#include<iostream>
#include<stdio.h>
using namespace std;
int hikizan(int a,int b){
	return a-b;
	}
int main(){
	int most[7],least[7];
	for(int i=0;i<7;i++){
		cin>>most[i]>>least[i];
		}
	for(int i=0;i<7;i++){
		cout<<hikizan(most[i],least[i])<<endl;
		}
	return 0;
}

Measured memory_bytes: 1160
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]



s = input()

last = ""
for i in s:
    if (last == i):
        print("Bad")
        exit()
    last = i
print("Good")


Measured memory_bytes: 9104
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
int n;
LL A[100010];
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n);
  LL a=1ll*(n+1)*n/2,b=0;
  for(int i=1;i<=n;++i) {
    read(A[i]);
    b+=A[i];
  }
  A[n+1]=A[1];
  if(b%a) return puts("NO"),0;
  LL cnt=b/a,g=0;
  for(int i=1;i<=n;++i) {
    if(A[i]<cnt||A[i]>cnt*n) return puts("NO"),0;
    A[i]=A[i]-A[i+1];
    if((A[i]+cnt)%n) return puts("NO"),0;
    g+=(A[i]+cnt)/n;
  }
  if(g!=cnt) puts("NO");
  else puts("YES");
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
#define pai 3.1415926535
int main(void){
    double a,b,c,crad;
    scanf("%lf %lf %lf",&a,&b,&crad);
    crad*=pai/180;
    c=sin(crad)*b;
    printf("%lf\n",a*c/2);
    printf("%lf\n",a+b+pow(a*a+b*b-2*a*b*cos(crad),0.5));
    printf("%lf\n",c);
    return 0;
}


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

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

  	int cnt[110] ={};
  	rep(i,K){
    	int d;cin>>d;
      rep(j,d){
      	int a;cin>>a;
  		a--;
        cnt[a]++;
      }
    }
  	
  	int ans=0;
    rep(i,N){
    	if(cnt[i]==0)ans++;
    }
     cout <<ans <<endl;
      
      return 0;
     
    }
  
  
  
  
   
    
  	



Measured memory_bytes: 3576
import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
L = list(map(int, input().split()))

num_length = [0]*(2001)

for i in range(N):
	num_length[L[i]] += 1

for i in range(1, len(num_length)):
	num_length[i] += num_length[i - 1]

sum = 0
for i in range(N):
	for j in range(N):
		if i != j:
			x = max(L[i], L[j]) - min(L[i], L[j])
			sum += num_length[L[i] + L[j] - 1]
			sum -= num_length[x]
			if L[i] > x:
				sum -= 1
			if L[j] > x:
				sum -= 1


print(sum//6)

Measured memory_bytes: 42656
N=int(input())
L=[int(i) for i in input().split()]
# print(N,L)

sum=0
for i in range(len(L)):
    sum+=L[i]

L_max = max(L)
# print(L_max)
if L_max < sum-L_max:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
n=int(input())
l=list(map(int,input().split()))
f={}
x=1
   
ans=n
min=l[0]
c=0
for i in range(n):
    if l[i]<=min:
        #ans+=1
        min=l[i]
    else:
        c+=1
        #print(l[i])
        
    #print(min)
    
print(ans-c)


Measured memory_bytes: 75472
#include<bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int W,H,C;
  cin>>W>>H>>C;
  cout<<(W*H/((__gcd(W,H))*(__gcd(W,H))))*C<<'\n';
  return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
typedef vector<bool> vb;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
ll llpow(ll e,ll x){ll res=1LL;while(x){if(x&1)res*=e;e*=e;x/=2;}return res;}
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353



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

    // solution comes here

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

    rep(i, N) if(i) A[i] += A[i-1];

    ll ans=INF;
    rep(i, N-1) chmin(ans, abs(A[i]*2 - A[N-1] ));
    cout << ans << nl;
}

Measured memory_bytes: 1792
N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

sum_mod = [0]
A.each_with_index do |a, idx|
  sum_mod[idx + 1] = (sum_mod[idx] + a) % M
end

count = Hash.new(0)
ans = 0
sum_mod.each do |sm|
  ans += count[sm]
  count[sm] += 1
end

puts ans


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

int main(void){

    int f=0;
    string str;
        cin>>str;
    string id;
        cin>>id;
    int len_str=str.size();
    int len_id=id.size();

    if( !id.empty()){
        id.pop_back();
        if(str==id){
            f=1;
        }
    }

    if(f)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void) {

	int b, f, r, v, n;
	int a[12][10] = { 0 };

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		a[(b - 1) * 3 - 1 + f][r - 1] += v;
	}

	for (int i = 0; i < 12; i++) {
		if (i == 3 || i == 6 || i == 9)
			cout << "####################" << endl;
		for (int j = 0; j < 10; j++) {
			cout << " ";
			cout << a[i][j];
		}
		cout << endl;
	}

	return 0;
}

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

int main(void){
    ll n;
    ll ans = 0;

    cin >> n;

    rep(i, n){
        ll tmp;
        cin >> tmp;
        ans += tmp - 1;
    }

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;

class Main
{
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static Scanner sc = new Scanner(new InputStreamReader(System.in));

	public static void main (String[] args) throws java.lang.Exception {
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		int[] w = new int[n];
		for (int i=0; i<n; i++) {
			w[i] = Integer.parseInt(br.readLine());
		}

		System.out.println(solve(n, k, w));
	}

	public static long solve(int n, int k, int[] w) {
		long min = 0;
		long max = 100000*10000;
		long mid;
		while (max - min > 1) {
			mid = (max + min) / 2;
			int count = containersAvailable(n, k, w, mid);
			if (count >= n) max = mid;
			else min = mid;
		}

		return max;
	}

	public static int containersAvailable(int n, int k, int[] w, long p) {
		long remainWeight = p;
		int truckNum = 0;
		int i;

		for (i=0; i<n; i++) {
			if (remainWeight < w[i]) {
				remainWeight = p;
				truckNum++;
				if (truckNum == k || remainWeight < w[i]) return i-1;
			}

			remainWeight -= w[i];
		}

		return n;
	}
}

Measured memory_bytes: 29732
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

L = [0]
R = [0]

g = A[0]
for a in A:
  g = gcd(g, a)
  L.append(g)

A = A[::-1]
g = A[0]
for a in A:
  g = gcd(g, a)
  R.append(g)

R = R[::-1]

ans = 1
for l, r in zip(L, R[1:]):
  ans = max(ans, gcd(l, r))

print(ans)

Measured memory_bytes: 16128
#include <atcoder/dsu>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3464
def get_distance(from_x, from_y, to_x, to_y) :
    distance_x = abs(from_x - to_x)
    distance_y = abs(from_y - to_y)
    return distance_x + distance_y

def main() :
    N = int(input())
    action_list = []
    for i in range(N) :
        action_list.append([int(i) for i in input().split()])
    
    from_x = 0
    from_y = 0
    now_t = 0

    for action in action_list :
        t = action[0]
        to_x = action[1]
        to_y = action[2]

        d = get_distance(from_x, from_y, to_x, to_y)
        if (d > (t - now_t) or (t-now_t) % 2 != d%2) :
            print("No")
            return
        
        from_x = to_x
        from_y = to_y
        now_t = t
    
    print("Yes")
    return


main()

Measured memory_bytes: 21108
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int INF = 10e8;
const int maxM = 1000010;
//const int maxN = 100010;
const int maxN = 110;

char s[maxN];
char t[maxN];
int main()
{

	scanf("%s",s);
	scanf("%s",t);
	int len = strlen(s);
	int flag = 0;
	for(int i=0;i<len;i++)
	{
		flag = 0;
		if(t[i] != s[0]) 
		{
			flag = 1;
			continue;
		}
		for(int j=1;j<len;j++)
		{
			int k = (i+j)%len;
			if(t[k] != s[j]) 
			{
				flag = 1;
			}
		}
		if(flag == 0)
		{
			break;
		}
	}
	if(flag == 0)
	{
		puts("Yes");
	}
	else
	{
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
using namespace std;
const int INF=2147483647;
struct Edge
{
	int to;
	int next;
	int flow;
}e[1000005];
int n,m,s,t,edgenum=1,head[1000005],dep[1000005],cur[1000005],match[100005],from[100005],to[100005];
bool flag[100005];
vector<int>root[100005];
queue<int>q;
void add(int u,int v,int f)
{
	e[++edgenum].flow=f;
	e[edgenum].to=v;
	e[edgenum].next=head[u];
	head[u]=edgenum;
}
bool bfs()
{
	while(!q.empty())q.pop();
	memset(dep,0,sizeof(dep));
	dep[s]=1;
	q.push(s);
	while(!q.empty())
	{
		int node=q.front();
		q.pop();
		for(int hd=head[node];hd;hd=e[hd].next)
		{
			int to=e[hd].to;
			if(e[hd].flow==0)continue;
			if(!dep[to])
			{
				dep[to]=dep[node]+1;
				q.push(to);
			}
		}
		if(dep[t])return 1;
	}
	return 0;
}
int dfs(int node,int nowf)
{
	if(node==t)return nowf;
	if(nowf==0)return 0;
	for(int&hd=cur[node];hd;hd=e[hd].next)
	{
		int to=e[hd].to;
		if(e[hd].flow==0)continue;
		if(dep[to]==dep[node]+1)
		{
			int d=dfs(to,min(nowf,e[hd].flow));
			if(d>0)
			{
				e[hd].flow-=d;
				e[hd^1].flow+=d;
				return d;
			}
		}
	}
	return 0;
}
int Dinic()
{
	int ans=0,d;
	while(bfs())
	{
		for(int i=1;i<=t;i++)
		  cur[i]=head[i];
		while(d=dfs(s,INF))
		  ans+=d;
	}
	return ans;
}
int main()
{
	scanf("%d",&n);
	s=1,t=2*n;
	for(int i=2;i<=n;i++)
	{
		add(s,i,1);
		add(i,s,0);
	}
	for(int i=n+1;i<2*n;i++)
	{
		add(i,t,1);
		add(t,i,0);
	}
	for(int i=2;i<=n;i++)
	{
		int size;
		scanf("%d",&size);
		while(size--)
		{
			int x;
			scanf("%d",&x);
			root[x].push_back(i);
			x--;
			if(x==0)continue;
			add(i,x+n,1);
			add(x+n,i,0);
		}
	}
	if(Dinic()!=n-1)
	{
		printf("-1\n");
		return 0;
	}
	for(int i=2;i<=n;i++)
	  for(int hd=head[i];hd;hd=e[hd].next)
		if(e[hd].flow==0)
		  match[i]=e[hd].to-n+1;
	while(!q.empty())q.pop();
	q.push(1);
	while(!q.empty())
	{
		int node=q.front();
		q.pop();
		for(int i=0;i<root[node].size();i++)
		{
			if(flag[root[node][i]])continue;
			flag[root[node][i]]=1;
			from[root[node][i]]=node;
			to[root[node][i]]=match[root[node][i]];
			q.push(match[root[node][i]]);
		}
	}
	for(int i=2;i<=n;i++)
	if(!from[i])
	{
		printf("-1\n");
		return 0;
	}
	for(int i=2;i<=n;i++)
	  printf("%d %d\n",from[i],to[i]);
	return 0;
}

Measured memory_bytes: 29952
use std::fmt::Debug;
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;
use std::usize;
use std::cmp;
use std::collections::vec_deque::VecDeque;
use std::i64::MAX;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.parse::<i64>();

    let mut ans = "No";

    for i in 0..100 {
        for j in 0..100 {
            if 4 * i + 7 * j == n  { ans = "Yes" }
        }
    }

    println!("{}", ans);
}

struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}

Measured memory_bytes: 4352
def main():

    n = int(input())

    if n > 81:
        print('No')
    else:
        k = n // 10 + 1
        while k < 10:
            if n % k == 0:
                print('Yes')
                return
            k += 1
        print('No')

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;

signed main() {
	int a, b, h;
	cin >> a >> b >> h;
	int ans = (a + b) * h / 2;
	cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,T,t[100],c[100],i,j,x=1001;
  scanf("%d %d",&n,&T);
  for(i=0;i<n;i++){
  scanf("%d%d",&c[i],&t[i]);
  if(c[i]<=x && t[i]<=T)x=c[i];
  
  }
  if(x==1001){
    printf("TLE",x);
    return 0;
  }
  printf("%d",x);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	long long int n,max,min;
	scanf("%lld%lld%lld",&n,&min,&max);

	if(min > max){
		printf("0");
		return 0;
	}
	if(n==1&&max!=min){
		printf("0");
		return 0;
	}
	if(n <= 2){
		printf("1");
		return 0;
	}

	//差+1　＊　n-2　-　n-1
	long long int ans = (max-min+1) * (n-2) - (n-3);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    string s;
    cin>>s;
    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;
    }
    else if(s=="SAT")
    {
        cout<<"1"<<endl;
    }
 
} 



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

int main()
{
  int a, i;
  i=0;
  while(1)
  {
    cin >>a;
    if(a==0){break;}
    else
    {
      i +=1;
      cout <<"Case "<<i<<": "<<a<<"\n"; 
    }
  }
  return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long M = GetLong();
		var cnt = new long[M];
		for(long i = 0; i < N; i++)
		{
			long K = GetLong();
			for(long j = 0; j < K; j++)
				cnt[GetLong() - 1]++;
		}
		WriteLine(cnt.Count(x => x == N));
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27844
string = str(input())
zero = 0
one = 0
chars = set(string)
for char in string:
    if char == list(chars)[0]:
        zero += 1
    else:
        one += 1

if zero == 0 or one == 0:
    print(0)
else:
    print(min(zero, one) * 2)

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

bool getHarshad(int N){
    int sumDigit = 0 ;
    int digit = 0 ,num = N;
    while((digit = num%10) != 0){
        sumDigit += digit;
        num /= 10; 
    }
    if(N % sumDigit == 0){
        return true;
    }else{
        return false;
    }
}
int main(){
    int N;
    cin >> N;

    bool flag = getHarshad(N);
    if(flag){
        cout << "Yes";
    }else{
        cout << "No";
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ever ;;
#define pb push_back

using namespace std;

#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}





int main()
{

	// #ifndef ONLINE_JUDGE
	// clock_t t;
	// t = clock();
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// freopen("error.txt","w",stderr);
	  
	// #endif
	int n; cin>>n;
	int arr[n];
	loop(i,0,n) cin>>arr[i];

	int count=0;
	loop(i,1,n-1) 
	{
		int brr[3];
		brr[0]=arr[i-1];
		brr[1]=arr[i];
		brr[2]=arr[i+1];
		sort(brr,brr+3);
		if(brr[1]==arr[i]) count++;
	}
	cout<<count<<endl;
	
	////------------------------------------------------------------------////
	// #ifndef ONLINE_JUDGE    
 //    t = clock() - t; 
 //    double time_taken = ((double)t)/CLOCKS_PER_SEC; 
 //    printf("Time: %fs\n", time_taken); 
 //    #endif
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

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 double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static string Solve(string S, int K)
        {
            var s = S.ToCharArray();
            s[K - 1] = char.ToLower(s[K - 1]);
            return new string(s);
        }
        static void Main(string[] args)
        {
            var V = ReadInts();
            var S = Read();
            Console.WriteLine(Solve(S, V[1]));
        }
    }
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

void debug(unordered_map<int, unordered_set<int>> &m){
    for(auto isi : m){
        fprintf(stderr, "%d: ", isi.first);
        for(auto s : isi.second){
            fprintf(stderr, "%d ", s);
        }
        cerr << endl;
    }
}

int main(){
    int n, m;
    cin >> n >> m;
    vi a(m), b(m);
    rep(i, m) cin >> a[i] >> b[i];
    
    unordered_map<int, unordered_set<int>> teikibin;
    for(int i = 0; i < m; i++){
        teikibin[a[i]].insert(b[i]);
    }
    for(int i = 1; i < n; i++){
        if(teikibin[1].find(i) != teikibin[i].end() && teikibin[i].find(n) != teikibin[i].end()){
            cout << "POSSIBLE\n";
            return 0;
        }
    }

    cout << "IMPOSSIBLE\n";
    return 0;
}

Measured memory_bytes: 29804
#include<stdio.h>
int main(void){
    int a, b;
    char c;
    while(1){
        scanf("%d %c %d", &a, &c, &b);
        if(c == '?') break;
        if(c == '+') printf("%d\n", a + b);
        else if(c == '-') printf("%d\n", a - b);
        else if(c == '*') printf("%d\n", a * b);
        else printf("%d\n", a / b);
    }
    return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    int sum = 0, tmp;
    for (int i = 0; i < m; i++) {
        cin >> tmp;
        sum += tmp;
    }

    if ( n - sum >= 0) cout << n - sum << endl;
    else cout << -1 << endl;

    return 0;
}



Measured memory_bytes: 3664
#include<stdio.h>
int main(){
	long long ans=0;
	int n;int tmp;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&tmp);
		ans+=tmp;
	}
	ans-=n;
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(abs(x-a) >= abs(x-b)) cout << 'B' << endl;
  else                     cout << 'A' << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int N = 0, M = 0;
int a[60];
int b[60];
int c[60];
int bits[20];

void setVal(int A, int B, int C)
{
	a[M] = A;
	b[M] = B;
	c[M] = C;
	M++;
}

int main()
{
	int L, T;

	cin >> L;
	T = L;

	while (T > 0) {
		bits[N] = T % 2;
		T /= 2;
		N++;
	}

	int w = 1;
	rep(i, N - 1) {
		setVal(i + 1, i + 2, 0);
		setVal(i + 1, i + 2, w);
		w *= 2;
	}

	w = 1;
	rep(i, N - 1) {
		if (bits[i] == 1) {
			setVal(i + 1, N, L - w);
			L -= w;
		}
		w *= 2;
	}

	cout << N << ' ' << M << endl;
	rep(i, M) cout << a[i] << ' ' << b[i] << ' ' << c[i] << endl;

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).rbegin(), (x).rend()
#define pb push_back
vi sixmemo;
vi ninememo;
int count(int n,vi memo)
{
    int res = 0;
    int i = 0;
    while(n>0){
        if(n>=memo[i]){
            res+= n / memo[i];
            n = n % memo[i];
        }
        i++;
    }
    return res;
}
int main()
{
    int n;
    cin >> n;
    int six = 0;
    while (pow(6, six) <= 100000)
    {
        sixmemo.push_back(pow(6, six));
        six++;
    }
    int nine = 0;
    while (pow(9, nine) <= 100000)
    {
        ninememo.push_back(pow(9, nine));
        nine++;
    }
    sort(all(sixmemo));
    sort(all(ninememo));
    int ans = INT_MAX;
    rep(i, n + 1)
    {
        int cc = 0;
        int j = n - i;
        cc += count(i, sixmemo);
        cc += count(j, ninememo);
        ans = min(ans, cc);
    }
    cout << ans << endl;
    return 0;
}

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

public class Main {
	
	private static class Path implements Comparable<Path>{
		int dist;
		int p;
		
		Path(int d, int p){
			this.dist = d;
			this.p = p;
		}

		@Override
		public int compareTo(Path arg0) {
			return this.p > arg0.p ? -1
								   : this.p < arg0.p ? 1
													 : 0;
		}
	}
			
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while(true){
			final int N = sc.nextInt();
			long M = sc.nextLong();
			
			if(N == 0 && M == 0){
				break;
			}
			
			Path[] ps = new Path[N];
			
			for(int i = 0; i < N; i++){
				ps[i] = new Path(sc.nextInt(), sc.nextInt());
			}
			
			Arrays.sort(ps);
			
			
			for(int i = 0; M != 0 && i < N; i++){
				if(M - ps[i].dist > 0){
					M -= ps[i].dist;
					ps[i].dist = 0;
				}else{
					ps[i].dist -= M;
					M = 0;
				}
			}
			
			int sum = 0;
			for(int i = 0; i < N; i++){
				sum += ps[i].dist * ps[i].p;
			}
			
			System.out.println(sum);
			
		}
		
	}

}

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

int main()
{
  string s;
  cin>>s;
  int i,j;
  int n=s.length();
  long long ans=0;
  for(i=0;i<(1<<(n-1));i++)
  {
    long long knum=s.at(0)-'0';
    long long kans=0;
    for(j=0;j<n-1;j++)
    {
      if((1<<j)&i)
      {
        kans+=knum;
        knum=s.at(j+1)-'0';
      }
      else
      {
        knum=knum*10+(s.at(j+1)-'0');
      }
    }
    kans+=knum;
    ans+=kans;
  }
  cout<<ans<<endl;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong N, D;
	vector<vector<llong> > X;

	cin >> N >> D;
	X.resize(N, vector<llong>(D));
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < D; ++j)
			cin >> X[i][j];

	llong ans = 0;
	for (int i = 0; i < N; ++i)
		for (int j = i+1; j < N; ++j) {
			llong sum = 0;
			for (int k = 0; k < D; ++k)
				sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			llong sq = sqrt(sum);
			ans += sq*sq == sum;
		}

	cout << ans << endl;

	return 0;
}

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

#define PI acos(-1)
#define all(a) a.begin(), a.end()
#define full(a, n) a, a + n
#define ma(type, size) (type *)malloc(sizeof(type) * size)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define f0(i, n) for (i = 0; i < (n); i++)
#define f1(i, n) for (i = 1; i < (n); i++)
#define f1n(i, n) for (i = 1; i <= (n); i++)
#define fab(i, a, b) for (i = (a); i <= (b); i++)
#define fr(i, b, a) for (i = (b); i >= (a); i--)

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
	tree_order_statistics_node_update> indexed_set;
//*/
typedef long long int ll;
typedef long int lo;

typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

//* utility function
inline bool compare(ll i, ll j)
{
    return i < j;
}
//*/

//* function prototypes
template< typename T>
T gcd(T a, T b);
template< typename T>
T modpow(T number, T power, T mod_value);
//*/

//int row, column;
//int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
//int dx[4] = {1,  0, -1, 0};
//int dy[4] = {0, -1,  0, 1};
//ll p2[63] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904};
#ifdef DEBUG
#endif // DEBUG

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll number_of_test_case = 1, test_case;
    //cin >> number_of_test_case;
    for (test_case = 1; test_case <= number_of_test_case; test_case++)
    {
        string a, b ,add;
        cin >> a >> b;
        add = a+b;
        ll n = atoi(add.c_str());

        ll sq = sqrt(n);

        if (sq*sq == n)cout << "Yes\n";
        else cout << "No\n";
    	//cout << "Test #" << test_case << ": ";
    	//cout << "Case " << test_case << ": ";
    }
    return 0;
}


template< typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a%b);
}
template< typename T>
T modpow(T number, T power, T mod_value)
{
    if (power == 0)
        return 1%mod_value;
    ll u = modpow(number,power/2,mod_value);
    u = (u*u)%mod_value;
    if (power%2 == 1)
        u = (u*number)%mod_value;
    return u;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
    int N,i,j,l;
    cin >> N;
    string w,x;
    vector<string> S(N);
    cin >> S.at(0);
    for(i=1;i<N;i++){
        cin >> w;
        x = S.at(i-1);
        l = x.length();
        if(w.at(0)!=x.at(l-1)){
            cout << "No" << endl;
            return 0;
        }
        for(j=0;j<i;j++){
            if(w == S.at(j)){
                cout << "No" << endl;
                return 0;
            }
        }
        S.at(i) = w;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var k, n int
	fmt.Scan(&k, &n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}

	var max int
	for i := 0; i < n; i++ {
		var d int
		if i == n-1 {
			d = as[0] + k - as[i]
		} else {
			d = as[i+1] - as[i]
		}
		if d > max {
			max = d
		}
	}

	fmt.Println(k - max)
}


Measured memory_bytes: 6784
#include <iostream>
#include <cmath>
#define ll long long
#define ld long double
using namespace std;

int main()
{
  ll A, B, C;
  cin>>A>>B>>C;

  ll mn = abs( A * B * (C/2) - A * B * (ll)ceil((ld)C/2) );
  mn = min(mn, (ll)abs( C * B * (A/2) - C * B * (ll)ceil((ld)A/2) ));
  mn = min(mn, (ll)abs( C * A * (B/2) - C * A * (ll)ceil((ld)B/2) ));

  cout<<mn;
  return 0;
}


Measured memory_bytes: 256
/**計算幾何学の問題を解く際に利用するクラス******/
//http://skyblueryu.blog54.fc2.com/blog-entry-27.html
#define _USE_MATH_DEFINES
#include <cmath>
#include <vector>
#include <cstdio>
#include <iostream>
#define EPS (pow(M_E,(double)-10))
//マクロの書式については 
//http://www7b.biglobe.ne.jp/~robe/cpphtml/html01/cpp01030.html
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;

class Point{
public:
	double x,y;

	//以下の記法に関しては
	//http://ameblo.jp/nana-2007-july/entry-10037680575.html
	Point(double x = 0,double y = 0): x(x), y(y) {};

	/***演算子のオーバーロード***********/
	Point operator + (Point p) { return Point(x + p.x,y + p.y);}
	Point operator - (Point p) { return Point(x - p.x,y - p.y);}
	Point operator * (double a) { return Point(a*x,a*y);}//スカラー倍
	Point operator / (double a) { return Point(x/a,y/a);}//スカラー倍
	/***********************************/

	double norm() { return x*x+y*y;}//ベクトルのノルムを返す
	double abs() { return sqrt(norm());}//ベクトルの長さを返す

	/***演算子のオーバーロード2***********/
	//Pointはクラスオブジェクトなのでサイズが大きく値渡しは適さない
	//Point &pという記法は参照渡しでポインタでない変数
	//に対してアドレスを引数にとりたい場合に使う．
	//参照渡しとポインタ渡しについては以下
	//http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1320144958
	//http://homepage2.nifty.com/well/Reference.html#PASS_BY_REFERENCE
	//
	//Point &pの前のconst修飾子は関数内で引数のオブジェクトの内容を
	//勝手に書き換えないようにするために付けている．(const Point &p)
	//の後のconstはこの関数がconstメンバ関数であることを意味する．
	//constメンバ関数に関して詳しくは以下
	//http://www.s-cradle.com/developer/sophiaframework/tutorial/Cpp/const.html

	bool operator < (const Point &p) const{
		//(条件)?(処理1):(処理2)
		//条件が真なら処理1，偽なら処理2が実行される
		return x != p.x ? x < p.x :y < p.y;
	}

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

};

typedef Point Vector;

//ベクトルaとbの内積を計算する関数
//これは参照渡しじゃなくていいんかいという疑問は正直ある
double dot(Vector a,Vector b){
	//double dot(const Vector& a,const Vector& b){
	return a.x*b.x + a.y*b.y;
}

//ベクトルaとbの外積を計算する関数
double cross(Vector a,Vector b){
	//double cross(const Vector& a,const Vector& b){
	return a.x*b.y - a.y*b.x;
}



//線分を表す構造体
struct Segment{
	Point p1, p2;
};
typedef Segment Line;

//円を表すクラス
class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0):c(c), r(r) {}
};

//多角形の表現(多角形は点の列で表現できる)
typedef vector<Point> Polygon;

int main(){
	Point p1,p2;
	int Q;
	scanf("%lf %lf",&p1.x,&p1.y);
	scanf("%lf %lf",&p2.x,&p2.y);
	scanf("%d",&Q);//クエリ数

	Vector d((p2.x-p1.x),(p2.y-p1.y));//方向ベクトル
	double abs = d.abs();
	d = d/abs;

	Point p;
	Vector v;//p1→p
	Vector proj;
	Vector ref;
	for(int q = 0;q < Q;q++){
		scanf("%lf %lf",&p.x,&p.y);

		v = p - p1;//演算子をオーバーロードしてるからこういう風にかける．便利！
		proj = d * dot(v,d);
		ref = p + (proj - v)*2;

		printf("%.10f %.10f\n",ref.x,ref.y);
	}

	return 0;
}

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

int main() {
  int seq;
  int s1;
  int s2;
  int s3;
  cin >> seq;
  s3 = seq % 10;
  s2 = ((seq - s3) % 100) / 10;
  s1 = ((seq - s3 - (10 * s2)) % 1000) / 100;
  cout << s1 + s2 + s3 << endl;
}


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

int main() {
    int n;
    cin >> n;
    int l, r;

    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> l >> r;
        sum += r - l + 1;
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3576
/**
*    author:  yuya1234
*    created: 22.08.2020 21:02:50
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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

  string s;
  cin>>s;

  ll sum=0;
  REP(i,SZ(s))
  {
    sum+=s[i]-'0';
  }

  if(sum%9==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


  return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <utility>
#include <numeric>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.endl(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  const double pi = 3.141592653589793;
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double dig1 = 360.0 * (m / 60.0);
  double dig2 = 30.0 * h + 30.0 * (m / 60.0);
  dig1 *= (2.0 * pi) / 360.0;
  dig2 *= (2.0 * pi) / 360.0;
  double ans =
      (b * cos(dig1) - a * cos(dig2)) * (b * cos(dig1) - a * cos(dig2)) +
      (b * sin(dig1) - a * sin(dig2)) * (b * sin(dig1) - a * sin(dig2));
  cout << setprecision(20) << sqrt(ans) << endl;
}


Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define en "\n"
#define ITER(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define mod 1000000007
#define mpp make_pair
#define mes(a,b) memset((a),(b),sizeof((a))
typedef map<int,int> MI;
typedef pair<int,int>   PI;
typedef vector<int> VI;
typedef long long int LL;

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    int s=0,f=0;
    if(a==7)
    s++;
    else if(a==5)
    f++;
    if(b==7)
    s++;
    else if(b==5)
    f++;
    if(c==7)
    s++;
    else if(c==5)
    f++;
    if(f==2 && s==1)
    cout<<"YES";
    else
    cout<<"NO";
	return 0;
}


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

int main(void){
	int a,b,c,l,r;
	cin >> a >> b >> c;
	l=max(a,max(b,c));
	r=a+b+c-l;
	if(l==r) cout << "Yes";
	else cout << "No";
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	ll n, m;
	cin>>n>>m;
	ll l = 0LL, r = 1e12;
	rep(i, 64){
		ll mid = (l + r) /2;
		ll k = m - mid * 2;
		if(k < 0 || (k / 2+ n < mid)) r = mid;
		else l = mid;
	}
	cout<<l<<endl;
}


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

int main(){
  int i,n,a[250];
  scanf("%d",&n);
  for(i=1;i<n+1;i++){
    scanf("%d",&a[i]);

  }
  for(i=1;i<n+1;i++){
    printf("node %d: key = %d, ",i,a[i]);
    if(i!=1){
      printf("parent key = %d, ",a[i/2]);
    }
    if(n>=i*2)
      printf("left key = %d, ",a[i*2]);
    if(n>=i*2+1)
      printf("right key = %d, ",a[i*2+1]);
    printf("\n");

  }
  


}



Measured memory_bytes: 2052
#!/usr/bin/perl

my ($n) = map {$_ - 0} split(/\s+/o,<STDIN>);
my ($d,$x) = map {$_ - 0} split(/\s+/o,<STDIN>);

my $s = 0;
for(my $i=1;$i<=$n;$i++){
  my ($a) = map {$_ - 0} split(/\s+/o,<STDIN>);
  $s += 1+int(($d - 1)/$a);
}
my $r = $s + $x;
print "$r\n";

exit(0);



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

using namespace std;

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

    int n,d;
    cin >> n >> d;
    vector<vector<int>> a(n, vector<int>(d));

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

    auto dis = [&] (int i, int j){
        int ret = 0;
        for (int k = 0;k<d;++k){
            ret += (a[i][k] - a[j][k])*(a[i][k] - a[j][k]);
        }
        return ret;
    };

    int sum = 0;
    for (int i=0;i<n;i++){
        for (int j=i+1;j<n;j++){
            int ret = dis(i,j);
            int g = sqrt(ret);
            if (g*g == ret){
                sum++;
            }
        }
    }

    cout << sum <<endl;

    return 0;
}

Measured memory_bytes: 3616