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

using namespace std;

int main(){
    int X, N; cin >> X >> N;
    set<int> numbers;
    for(int i = 0; i < N; i++){
        int temp; cin >> temp;
        numbers.insert(temp);
    }
    if(numbers.find(X) == numbers.end()){
        cout << X;
    }else{
        int j = 1;
        for(int i = 1; ; i++){
            if(numbers.find(X-i) == numbers.end()){
                cout << X-i;
                break;
            }else if((numbers.find(X+i) == numbers.end())){
                cout << X+i;
                break;
            }
        }
    } 
    return 0;
}

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

using namespace std;

typedef long int lint;
typedef long long int llint;

#define INF 1073741824
#define LINF 4611686018000000000
#define MOD 1000000007

int n;
double p[3300];
double dp[3300][3300];

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
    }
    dp[0][0] = 1.0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (j == 0)
                dp[i][j] = dp[i - 1][j] * (1 - p[i]);
            else
                dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
        }
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans = ans + dp[n][i];
    }
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 78080
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
long long int mod = 1000000007;
int main()
{
  long long int n, k;
  cin>>n>>k;
  long long int ans = 0;
  for(long long int i=k; i<=n+1; i++)
  {
    long long int temp = ((i % mod) * (n-i+1) % mod) % mod;
    temp+=1;
    ans = ans % mod + temp % mod;
  }

  cout<<ans<<"\n";
}


Measured memory_bytes: 3560
#include<iostream>
#include<math.h> 
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long int lli;
lli mod=1000000007;
vector < lli> primes;

void Sieve(lli n) 
{ 
    bool prime[n+1];
	for(lli i=0;i<n+1;++i)
		prime[i]=true;
    for (lli p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (lli i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(lli p=2; p<=n; p++) 
       if (prime[p]) 
		primes.push_back(p);  
}
lli gcd(lli a,lli b)  
 {
    if(b>a)
        swap(a,b);
    if (a%b==0)  
        return b;  
    else 
        return gcd(a%b,b);  
 }
lli lcm(lli a,lli b)
{
    return (a*b)/gcd(a,b);    
}
lli power(lli x,lli y,lli m)   
{ 
    lli res = 1; 
    x=x%m;   
    while (y > 0) 
    {  
        if (y%2==1) 
            res =(res*x)%m;  
        y=y/2; 
        x=(x*x)%m; 
    } 
    return res; 
}
bool sortcol( const vector<lli>& v1, const vector<lli>& v2 ) { 
    return v1[1] < v2[1]; 
}
bool sortcol1( const vector<lli>& v1, const vector<lli>& v2 ) { 
    return v1[0] < v2[0]; 
}
int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	lli n,m;
	cin>>n>>m;
	vector <vector<lli>> e(n);
	for(lli i=0;i<m;++i)
	{
		lli a,b;
		cin>>a>>b;
		e[a-1].push_back(b-1);
	}
	lli t,s;
	cin>>t>>s;
	queue <pair<lli,lli>> curr;
	pair <lli,lli> temp;
	temp.first=t-1;
	temp.second=0;
	curr.push(temp);
	lli done[n]={0};
	lli pos[n][4]={0};
	while(!curr.empty())
	{
		pair<lli,lli> p=curr.front();
		lli f=p.first;
		lli x=p.second;
		curr.pop();
		if(pos[f][0])
		{
			continue;
		}
		else
			pos[f][0]=1;
		for(lli i=0;i<e[f].size();++i)
		{
			lli e1=e[f][i];
			if(pos[e1][1])
				continue;
			else
				pos[e1][1]=1;
			for(lli j=0;j<e[e1].size();++j)
			{
				lli e2=e[e1][j];
				if(pos[e2][2])
					continue;
				else
					pos[e2][2]=1;
				for(lli k=0;k<e[e2].size();++k)
				{
					if(!done[e[e2][k]])
					{
						temp.first=e[e2][k];
						temp.second=x+1;
						if(e[e2][k]==(s-1))
						{
							cout<<x+1<<endl;
							exit(0);
						}
						curr.push(temp);
						done[e[e2][k]]=1;
					}
				}
			}
		}
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 9600
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    _ = input()
    m = []
    i = 0
    for l in sys.stdin:
        ar = list(map(int, l.split()))
        ar.append(i)
        m.append(ar)
        i+=1

    m.sort(key=lambda x: (x[0], x[1]))
    right = 1
    for i in range(len(m)):
        if i != 0 and m[i][0] != m[i-1][0]:
            right = 1
        m[i].append("{:0>6}{:0>6}".format(m[i][0], right))
        right += 1

    m.sort(key=lambda x: x[2])
    for a in m:
        print(a[3])


main()


Measured memory_bytes: 38668
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		int M = in.nextInt();
		ArrayList<int[]> ab = new ArrayList<int[]>();
		for(int i = 0; i < M; i++){
			int[] edge = {in.nextInt(), in.nextInt()};
			ab.add(edge);
		}
		
		//ab.sort((a1,a2)->a1[1]-a2[1]);
		Collections.sort(ab, new edgeComparator());
		
		/*
		for(int i = 0; i < M; i++){
			int[] edge = ab.get(i);
			int a = edge[0];
			int b = edge[1];
			System.out.println(a + " " + b);
		}
		*/
		
		
		int ans = 0;
		int preVisitedIndex = 0;
		
		for(int i = 0; i < M; i++){
			int[] edge = ab.get(i);
			int a = edge[0];
			int b = edge[1];
			
			if(preVisitedIndex >= a && preVisitedIndex < b)
				continue;
			
			preVisitedIndex = b - 1;
			ans++;
		}
		
		System.out.println(ans);
	}
	
	public static class edgeComparator implements Comparator<int[]> {

		@Override
		public int compare(int[] e1, int[] e2) {
			return e1[1] - e2[1];
		}
	}
}

Measured memory_bytes: 88868
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val upper = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    val lower = readLine()!!.split(" ").map { it.toInt() }.toMutableList()

    upper.add(0, 0)
    lower.add(0, 0)

    val upperCumsum = Array(n+1) {0}
    val lowerCumsum = Array(n+1) {0}
    for (i in 1..n) {
        upperCumsum[i] = upperCumsum[i - 1] + upper[i]
        lowerCumsum[i] = lowerCumsum[i - 1] + lower[i]
    }

    var ans = 0
    for (i in 1 .. n) {
        val upperSum = upperCumsum[i]  - upperCumsum[0]
        val lowerSum = lowerCumsum[n]  - lowerCumsum[i - 1]

        ans = Math.max(ans, upperSum + lowerSum)
    }

    println(ans)
}

Measured memory_bytes: 38076
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back

signed main(){
    int h,w,n,x,y;
    string s,t;
    cin >> h>>w>>n>>x>>y>>s>>t;
    int lb=0,rb=w+1,ub=0,db=h+1;

    for(int i=n-1;-1<i;i--){
        if(s.at(i)=='L'){
            lb++;
        }else if(s.at(i)=='R'){
            rb--;
        }else if(s.at(i)=='U'){
            ub++;
        }else{
            db--;
        }

        if(lb>=w || rb<=1 || ub>=h || db<=1 || rb-lb<=1 || db-ub<=1){
            cout << "NO" << endl;
            return 0;
        }//途中でsafezoneなくなったらおわり

        if(i!=0){
            if(t.at(i-1) =='L' && rb<=w){
                rb++;
            }else if(t.at(i-1) == 'R'&& 1<=lb){
                lb--;
            }else if(t.at(i-1) == 'U' && db<=h){
                db++;
            }else if(1<=ub && t.at(i-1)=='D'){//
                ub--;
            }
        }
    }

    if(lb<y && y<rb && ub<x && x<db){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;

ll pow(ll n, ll k, ll m) {
	ll r = 1;
	for (; k > 0; k >>= 1) {
		if (k & 1) r = (r*n) % m;
		n = (n*n) % m; 
	}
	return r;
}

int main() {
	ll n; cin >> n;
	ll ans = 0;
	vector<ll> res(1000001, 0);
	vector<ll> c(1000001, 0);
	for (ll i = 0; i < n; ++i) {
		ll a; cin >> a;
		c[a]++;
	}
	for (ll i = 1000000; i > 0; --i) {
		ll sum_of_sq = 0; ll sq_of_sum = 0;
		for (ll j = 1; j*i < 1000001; ++j) {
			sum_of_sq += pow(j*i, 2, MOD) * c[j*i];
			sum_of_sq %= MOD;
			sq_of_sum += j*i * c[j*i];
			sq_of_sum %= MOD;
		}
		sq_of_sum = pow(sq_of_sum, 2, MOD);
		ll dif = (sq_of_sum - sum_of_sq + MOD) % MOD;
		res[i] = dif * pow(2*i, MOD-2, MOD);
		res[i] %= MOD;
		for (ll j = 2; j*i < 1000001; ++j) {
			res[i] += (MOD - res[j*i]) * j;
			res[i] %= MOD;
		}
		ans += res[i];
		ans %= MOD;

	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 15872
#include <stdio.h>

int main(){
    int n,m,c,i,j,res,tmp,ret = 0;
    scanf("%d %d %d",&n,&m,&c);
    int num[m];
    for(i = 0;i<m;i++){
        scanf("%d",&num[i]);
    }

    for(i=0;i<n;i++){
        res =c;
        for(j=0;j<m;j++){
            scanf("%d",&tmp);
            res += num[j] * tmp;
        }
        if(res>0) ret++;
    }
    printf("%d",ret);
    return 0;
}

Measured memory_bytes: 128
s = str(input())

tmp_p = 0

tmp = ''
for i in range(len(s)//2):
    tmp += s[-(i+1)]
#print(tmp)
if tmp != s[0:len(s)//2]:
    tmp_p += 1

tmp_2 = s[0:(len(s)-1)//2]
tmp = ''
if len(tmp_2) != 1:
    for i in range(len(tmp_2)//2):
        tmp += tmp_2[-(i+1)]

    #print(tmp)
    #print(tmp_2[0:len(tmp_2)//2])
    if tmp != tmp_2[0:len(tmp_2)//2]:
        tmp_p += 1


tmp_3 = s[(len(s)+3)//2-1:]
tmp = ''
if len(tmp_3) != 1:
    for i in range(len(tmp_3)//2):
        tmp += tmp_3[-(i+1)]
    #print(tmp)
    #print(tmp_3[0:len(tmp_3)//2])
    if tmp != tmp_3[0:len(tmp_3)//2]:
        tmp_p += 1

if tmp_p != 0:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
 
int run_test(){
      int k;
      cin >> k;
      if(k % 2 == 0){
            cout << -1;
            return 0;
      }      
      set<int> s;
      int a = 0;
      bool flag = false;
      int i;
      for(i=0; i<k; i++){
            a = ((a * 10 )+ 7) % k;
            if(a == 0){
                  flag= true;
                  cout << i + 1;
                  return 0;
            }
            if(s.count(a) == 0){
                  s.insert(a);
            }
            else{
                  cout << -1;
                  return 0;
            }
      }
      cout << -1;
      return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}

Measured memory_bytes: 50332
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    int n; std::string s; std::cin >> n >> s;
    int cnt=0;
    for(int i=0; i<n-2; i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') cnt++;
    }
    std::cout << cnt << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	
	string a;
	cin>>a;
	int x;
	for(x=0;x<a.size()-1;x++)
	{
		if(a[x]==a[x+1])
		{
			cout<<"Bad"<<endl;
			return 0;
		}
	}
	cout<<"Good"<<endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  	ll n;
  	cin >> n;
  	vector<ll> a(n);
  	vector<ll> b(n);
  	
  	for(ll i = 0; i < n; i++){
      cin >> a[i];
    }
  
    for(ll i = 0; i < n; i++){
        cin >> b[i];
      }
  	ll s = 0;
  	for(ll i = 0; i < n; i++){
      if(a[i] > b[i]){
        s+=a[i] - b[i];
    }
  	}
      
      cout << s <<endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var str string
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%s", &str)
	chars := strings.Split(str, "")

	ans := 700
	for _, c := range chars {
		if c == "o" {
			ans = ans + 100
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static int valid(long x, long y,long z,long n){
        return (z*z+x*x+y*y+y*z+x*y+x*z==n?1:0);
    }
    public static int solve(int n){
        int ans=0;
        for (long x = 1; x*x+x*2 <= n ; x++) {
            for (long y = 1; y*y+x*y+x*x+x+y <= n ; y++) {
                for (long z = 1; z*z+x*x+y*y+y*z+x*y+x*z<= n ; z++) {
                    ans+= valid(x,y,z,n);
                }
            }
        }
        return ans;
    }
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int n;
        n = scan.nextInt();
        for (int i = 1; i <= n ; i++) {
            System.out.println(solve(i));
        }
    }
}


Measured memory_bytes: 39992
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

# 1から順番に並べられたらOK
a = 1
c = 0
for i in range(N):
    if A[i] == a:
        # 確定した扱い
        a += 1
    else:
        # 取り除いた扱い
        c += 1

print(c if a > 1 else -1)


Measured memory_bytes: 24744
namespace AdhocFs

open System

module Program =
  [<EntryPoint>]
  let main argv =

    let [|s; _|] = Console.ReadLine().Split([|' '|])
    let hatedDigits = Console.ReadLine().Split([|' '|]) |> Array.map int

    let digits = Set.difference (set [0..9]) (hatedDigits |> Set.ofArray)

    // 使える数字のうち、d を超える最小のもの
    let minDigitOver d =
      let largeDigits = digits |> Set.filter (fun d' -> d' > d)
      if largeDigits |> Set.isEmpty
      then None
      else Some (largeDigits |> Set.minElement)

    let minPositiveDigit = minDigitOver 0 |> Option.get

    let minDigit = digits |> Set.minElement

    let solve () =
      /// 同じ桁数で金額より大きい数値の構成を試みる。
      let rec loop acc isLarge i =
        if i = s.Length
        then acc |> List.rev |> List.map string |> String.concat "" |> int |> Some
        else
          if isLarge then
            loop (minDigit :: acc) true (i + 1)
          else
            let d = s.[i] |> string |> int
            if digits |> Set.contains d then
              loop (d :: acc) isLarge (i + 1)
            else
              match minDigitOver d with
              | Some d' -> loop (d' :: acc) true (i + 1)
              | None -> None
      match loop [] false 0 with
      | Some n -> n
      | None ->
        // 金額より1桁大きい数値で最小のものを構成する。
        string minPositiveDigit + String.replicate s.Length (string minDigit)
        |> int

    printfn "%d" (solve ())

    // exit code
    0


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

int main() {

	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	if (a[0] > a[1])
		swap(a[0], a[1]);
	if (a[1] > a[2])
		swap(a[1], a[2]);
	if (a[0] > a[1])
		swap(a[0], a[1]);
	cout << a[0] << " " << a[1] << " " << a[2] << "\n";
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

map<ll, ll> mp;

void prime_fact(int n)
{
    for (int i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            n /= i;
            mp[i]++;
        }
    }
    if (n != 1)
        mp[n]++;
}

int main()
{
    ll mod = 1e9 + 7;
    ll n;
    cin >> n;
    for (ll i = 1; i <= n; i++)
        prime_fact(i);

    ll ans = 1;
    for (auto x : mp)
        (ans *= x.second + 1) %= mod;

    OP(ans);
}

/*const int p = 1000;
int dp[1001][p + 1];

int main()
{

    rep(i, 1001) rep(j, p + 1) dp[i][j] = 0;

    for (int i = 1; i <= 1000; i++)
    {
        int num = i;
        for (int j = 2; j <= p; j++)
        {
            while (num % j == 0)
            {
                num /= j;
                dp[i][j]++;
            }
            dp[i][j] += dp[i - 1][j];
        }
    }

    ll mod = 1e9 + 7;
    ll sum = 1;
    int n;
    cin >> n;

    for (int j = 1; j <= p; j++)
    {
        sum = (sum * (dp[n][j] + 1)) % mod;
    }

    OP(sum);
    return 0;
}*/

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid ,int right){
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++)L[i]=A[left+i];
    for(int i=0;i<n2;i++)R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        cnt++;
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }else {
            A[k]=R[j++];
        }
    }
}

void mergeSort(int A[],int n,int left,int right){
    if(left+1<right){
        int mid =(left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}

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

    int A[MAX],n,i;
    cnt=0;

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

    mergeSort(A,n,0,n);

    for(int i=0;i<n;i++){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout<<endl;

    cout<<cnt<<endl;

    return 0;
}





Measured memory_bytes: 7020
N, M = map(int, input().split())
ab = [0] * M
for i in range(M):
    ab[i] = list(map(int, input().split()))

import sys
sys.setrecursionlimit(100500)

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

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

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

        if x == y:
            return

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

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

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

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

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

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

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

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

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

uf = UnionFind(N)

for i in range(M):
    uf.union(ab[i][0]-1, ab[i][1]-1)

print(uf.group_count() - 1)

Measured memory_bytes: 29352
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(K)
    Cinii(A,B);
    int t = (A+K-1)/K;
    if(A<=t * K && t * K <=B) cout << "OK" << nn;
    else cout << "NG" << nn;
    return 0;
}

Measured memory_bytes: 3160
import math

data = map(int, raw_input().split())
a = data[0]
b = data[1]
deg = math.radians(data[2])

c = (a**2 + b**2 - 2*a*b*math.cos(deg))**0.5
L = a + b + c
h = b * math.sin(deg)
S = a * h * 0.5

print S
print L
print h

Measured memory_bytes: 6712
n = gets.to_i
ps = [0, *gets.split.map(&:to_i)]

v = ps.each_with_index.with_object(Array.new(n + 1, 1)) do |(p, i), arr|
  arr[p] = 0 if p == i
end[1..-1]

ans = 0
n.times do |i|
  next if v[i] == 1

  v[i + 1] = 1
  ans += 1
end

ans += 1 if v[-1] == 0

puts ans


Measured memory_bytes: 13044
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    elif 0 in [ n%i for i in range(11,min(n-1,30),2) ]:return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(input())
for i in range(n):
  n = int(input())
  if is_prime(n): cnt+=1

print(cnt)

Measured memory_bytes: 7792
#include<iostream>
using namespace std;
int main(){
	int a,b;
	char s[100];
	cin>>a>>b;
	cin>>s;
	for (int i=0;i<a+b+1;++i){
		int k=s[i];
		if (i!=a){
			if (k>=48&&k<=57) ;
			else {
				cout<<"No"<<endl;
				return 0;
			}
		}
		else {
			if (s[a]!='-'){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input() for n in range(N)]
assert len(S) == N
counts = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for s in S:
  counts[s] += 1

for key in ['AC', 'WA', 'TLE', 'RE']:
	print('{} x {}'.format(key, counts[key]))

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

#define ll long long
#define ar array
#define vi vector<int>
#define INF 1000000000

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n; cin >> n;
	int people[n+1] = {0, 0};
	int subs[n+1] = {0};
	for(int i=2; i <= n; i++){
		int boss; cin >> boss;
		people[i] = boss;
		subs[boss]++;
	}	
	for(int i=1; i <= n; i++){
		cout << subs[i] << "\n";
	}	
	return 0;
}


Measured memory_bytes: 5204
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  var a = sc.next.sorted
  if(a.length == 1){ println("No");sys.exit()}
  for (i <- 0 until a.length - 1 if i % 2 == 0){
    if (a(i) != a(i+1)){
      println("No")
      sys.exit()
    }
  }
  println("Yes")
}


Measured memory_bytes: 55568
N = int(input())
A = [[int(x) - 1 for x in input().split()] for _ in range(N)]

id = [[0] * N for _ in range(N)]
V = 0
to = []
for i in range(N):
    for j in range(i+1, N):
        id[i][j] = V
        V += 1
        to.append([])

def toId(i, j):
    if i > j:
        i, j = j, i
    return id[i][j]

for i in range(N):
    for j in range(N - 1):
        A[i][j] = toId(i, A[i][j])
    for j in range(N - 2):
        to[A[i][j+1]].append(A[i][j])

visited = [False] * V
calculated = [False] * V
dp = [0] * V
def dfs(v):
    if visited[v]:
        if not calculated[v]:
            return -1
        return dp[v]
    visited[v] = True
    dp[v] = 1
    for u in to[v]:
        res = dfs(u)
        if res == -1:
            return -1
        dp[v] = max(dp[v], res + 1)
    calculated[v] = True
    return dp[v]

ans = 0
for i in range(V):
    res = dfs(i)
    if res == -1:
        ans = -1
        break
    ans = max(ans, res)

print(ans)

Measured memory_bytes: 180268
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    string S, T; cin >> S >> T;
    int N = (int)S.size();
    int M = (int)T.size();
    vector<vector<int>> dp(N+1, vector<int>(M+1));
    
    for(int i=0; i<N+1; i++){
        dp[i][0] = i;
    }
    for(int j=0; j<M+1; j++){
        dp[0][j] = j;
    }
    
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            int cost = 1;
            if(S[i]==T[j]) cost = 0;
            dp[i+1][j+1] = min(dp[i][j]+cost, min(dp[i+1][j] + 1, dp[i][j+1] + 1));
        }
    }
    
    cout << dp[N][M] << endl;
    return 0;
}






Measured memory_bytes: 6904
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut b: Vec<_> = a
        .into_iter()
        .enumerate()
        .map(|(i, x)| x - i as i64 - 1)
        .collect();

    b.sort();

    let m = if n & 1 == 1 {
        b[n / 2]
    } else {
        (b[n / 2] + b[n / 2 - 1]) / 2
    };

    println!(
        "{}",
        b.into_iter().map(|x| (x - m).abs() as usize).sum::<usize>()
    );
}


Measured memory_bytes: 8444
package main

import (
	"fmt"
)

var N int
var x int
var A []int

func input() {
  fmt.Scan(&N)
  for i:=0; i<N; i++ {
    fmt.Scan(&x)
    A = append(A, x)
  }
}

func main() {
  // input
  input()
  
  var zero int = 0
  for i:=0; i<N; i++ {
    if A[i] == 0 {
      zero++
    }
  }
  if zero > 0 {
    fmt.Println(0)
    return
  }
  
  var prod int = 1
  for i:=0; i<N; i++ {
    if A[i] <= 1000000000000000000/prod {
      prod *= A[i]
    }else {
      fmt.Println("-1")
      return
    }
  }
    fmt.Println(prod)
}

Measured memory_bytes: 6796
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        long[] arr = new long[n];
        for(int i = 0; i < n; i++)
        	arr[i] = sc.nextInt();

        long res = 0;
        for(int i = 1; i < n; i++)
        	res = res + Math.min(b, (arr[i] - arr[i-1]) * a);
        System.out.println(res);
    }
}


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

int main(){
    string s;
    cin >> s;

    int cnt = 0;
    if(s[0]=='o') cnt++;
    if(s[1]=='o') cnt++;
    if(s[2]=='o') cnt++;

    int ans = 700 + 100*cnt;

    cout << ans << endl;
}

Measured memory_bytes: 384
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

eof = false
while !eof
	a,b = array_integer(STDIN.gets.split(" "))
	if a == 0 and b == 0 then
		eof = true
		break
	elsif a > b then
		print b , " ", a, "\n"
	else
		print a , " ", b, "\n"
	end
end



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

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int N;
string s[105];

int main() {
  while(1){
    cin>>N;
    if(N==0) break;
    REP(i,0,N) cin>>s[i];
    int ls = 0, rs = 0, prev = 0, ans = 0;
    REP(i,0,N){
      if(s[i] == "lu") ls = 1;
      if(s[i] == "ld") ls = 0;
      if(s[i] == "ru") rs = 1;
      if(s[i] == "rd") rs = 0;

      if(ls==0&&rs==0){
        if(prev != 0) ans++;
        prev = 0;
      }else if(ls==1&&rs==1){
        if(prev != 1) ans++;
        prev = 1;
      }/*else{
        prev = 2;
      }*/
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3140
n = int(input())
s = input()

#a,b = map(int,input().split())
#li = list(map(int,input().split()))
W = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
ans = ""
for i in range(len(s)):
    ans += W[W.index(s[i])+n]
print(ans)

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := nextInt()
	turu := 0

	for turu = 0; turu <= n; turu++ {

		if turu*2+(n-turu)*4 == a {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std;

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

    int n;
    cin >> n;

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


Measured memory_bytes: 3652
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    count = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            k = x - i - j
            if k >= j + 1 and k <= n:
                count += 1
    print(count)



Measured memory_bytes: 5592
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int):
    mn = N
    for i in range(N+1):
        s = i
        n = N - i
        sc = 0
        nc = 0
        while(s > 0):
            sc += s % 6
            s //= 6
        while(n > 0):
            nc += n % 9
            n //= 9
        if sc + nc < mn:
            mn = sc + nc
    print(mn)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5048
#include<iostream>
using namespace std;
long long n,a,b,c,d,ans;
int main(int argc, char const *argv[])
{
	cin>>a>>b>>c>>d>>n;
	a=a*4;
	b=b*2;
	long long x = min(a,min(b,c));
	if(n&1)
	{
		ans = min(n*x,n/2*d+x);
	}
	else ans = min(n*x,n/2*d);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int Y[]={0,1,0,-1};
int X[]={1,0,-1,0};
int MIN(int a,int b){return a<b?a:b;}
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int h,w,n,m,i,j,x[10010],y[10010],ny,nx,f[100][100]={};
  int a,b,c,t,r,l[110],u[100][100]={};
  char d[100][100];
  scanf("%d %d %d %d",&h,&w,&n,&m);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      scanf(" %c",&d[i][j]);
      if(d[i][j]=='D')d[y[0]=i][x[0]=j]='.';
    }
  }
  f[y[t=0]][x[0]]=1;
  for(r=1;r-t;t++){
    for(i=0;i<4;i++){
      ny=y[t]+Y[i];
      nx=x[t]+X[i];
      if(ny<0||h<=ny||nx<0||w<=nx)continue;
      if(d[ny][nx]=='#'||f[ny][nx])continue;
      f[y[r]=ny][x[r]=nx]=1;
      r++;
    }
  }
  for(i=0;i<n;i++)scanf("%d",&l[i]);
  l[n]=100;
  for(i=0;i<m;i++){
    scanf("%d %d %d",&a,&b,&c);
    u[MAX(0,b-l[c]  )][MAX(0,a-l[c]  )]++;
    u[MAX(0,b-l[c]  )][MIN(w,a+l[c]+1)]--;
    u[MIN(h,b+l[c]+1)][MAX(0,a-l[c]  )]--;
    u[MIN(h,b+l[c]+1)][MIN(w,a+l[c]+1)]++;
    if(c--){
      u[MAX(0,b-l[c]  )][MAX(0  ,a-l[c]  )]--;
      u[MAX(0,b-l[c]  )][MIN(w,a+l[c]+1)]++;
      u[MIN(h,b+l[c]+1)][MAX(0,a-l[c]  )]++;
      u[MIN(h,b+l[c]+1)][MIN(w,a+l[c]+1)]--;
    }
  }
  for(i=0;i<h;i++){
    for(j=1;j<w;j++)u[i][j]+=u[i][j-1];
  }
  for(j=a=b=0;j<w;j++){
    for(i=0;i<h;i++){
      if(i)u[i][j]+=u[i-1][j];
      if(u[i][j]==m&&d[i][j]=='.'){//printf("%d ",u[i][j]);
	a++;
	b+=f[i][j];
      }
    }
  }
  if(a==0)printf("Broken\n");
  else if(b%a)printf("Unknown\n");
  else printf("%s\n",b?"Yes":"No");
  return 0;
}
  
      
      
    
       

Measured memory_bytes: 704
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c, n;
string s;



int main()
{
cin>>a>>b;
  cout<<(a+b+1)/2<<endl;
	
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.close();
        if (a < 30) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }

        System.out.println();
    }
}


Measured memory_bytes: 35564
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N;
    cin >> N;
    map<ll,ll> cnt_m;
    for(ll i = 0; i < N; i++) {
        ll e;
        cin >> e;
        e *= -1;
        auto ite = cnt_m.upper_bound(e);
        if(ite == cnt_m.end()) {
            cnt_m[e]++;
        } else {
            ite->second--;
            if(ite->second == 0) cnt_m.erase(ite);
            cnt_m[e]++;
        }
    }
    ll ans = 0;
    for(auto &&ele : cnt_m) ans += ele.second;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6400
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut to_start = vec![false; n];
    let mut to_goal = vec![false; n];
    for i in 0..m {
        let v = read_vec::<usize>();
        let (a, b) = (v[0] - 1, v[1] - 1);
        if a == 0 {
            to_start[b] = true;
        }
        if b == n - 1 {
            to_goal[a] = true;
        }
    }

    if (0..n).any(|x| to_start[x] && to_goal[x]) {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2192
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctype.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef long long Int;
Int mod = 1e9+7;
Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    Int n = (Int)s.size();
    bool res = false;
    for (Int i = 0; i <= 7; i++) {
        string t = s.substr(0, i);
        t = t + s.substr(n-(7-i));
        // dump(t);
        if (t == "keyence") {
            res = true;
        }
    }
    if (s == "keyence") res = true;
    dump(res ? "YES" : "NO");
    return 0;  
}

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

int main(){
    // editorial解
    // 重なる区間を1発で済ませてしまえば良いことが自明なので
    // いもしてホイ
    int n, m;
    cin >> n >> m; 
    int imos[1005] = {};
    for(int i = 0; i < m; i++){
        int c, d;
        cin >> c >> d;
        imos[c]++, imos[d]--;
    }
    int ans = n+1;
    for(int i = 1; i <= n; i++){
        imos[i] += imos[i-1];
        if(imos[i]) ans += 2;
    }
    cout << ans << endl;
    return 0;


    // 自分の回答(AC)
    // int n, m;
    // cin >> n >> m;
    // if(m == 0){
    //     cout << n+1 << endl;
    //     return 0;
    // }
    // vector<int> dp(m, 1<<30);
    // vector<pair<int,int>> vp;
    // for(int i = 0; i < m; i++){
    //     int c, d;
    //     cin >> c >> d;
    //     vp.push_back({d, c});
    // }
    // sort(vp.begin(), vp.end());
    // for(int i = 0; i < m; i++){
    //     int to = vp[i].first, from = vp[i].second;
    //     for(int j = i; j >= 0; j--){
    //         from = min(from, vp[j].second);
    //         dp[i] = min(dp[i], (j==0 ? 0 : dp[j-1])+(to-from)*2);
    //     }
    // }
    // cout << dp[m-1]+n+1 << endl;
    // return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<cmath>
#define int long long
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
int a[214514];
signed main(){
	int n,m;
	cin>>n>>m;
	c(n*m)
}	


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

struct Node{
	int key;
	struct Node *right,*left,*parent;
};

struct Node *root,*NIL;

struct Node *treeMin(struct Node *x){
	while(x->left!=NIL)x=x->left;
	return x;
}

struct Node *find(struct Node *u,int k){
	while(u!=NIL && k!=u->key){
		if(k<u->key)u=u->left;
		else u=u->right;
	}
	return u;
}

struct Node *treeSuccessor(struct Node *x){
	if(x->right!=NIL)return treeMin(x->right);
	struct Node *y=x->parent;
	while(y!=NIL && x==y->right){
		x=y;
		y=y->parent;
	}
	return y;
}

void treeDel(struct Node *z){
	struct Node *y;
	struct Node *x;
	if(z->left==NIL || z->right==NIL)y=z;
	else y= treeSuccessor(z);
	if(y->left!=NIL){
		x=y->left;
	}
	else{
		x=y->right;
	}
	if(x!=NIL){
		x->parent=y->parent;
	}
	if(y->parent==NIL){
		root=x;
	}
	else{
		if(y==y->parent->left){
			y->parent->left=x;
		}
		else{
			y->parent->right=x;
		}
	}
	if(y!=z){
		z->key=y->key;
	}
	free(y);
}

void insert(int k){
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;
  z = malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z-> right = NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key < y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
}

void inorder(struct Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
	int n,i,x;
	char C[10];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",&C);
		if(C[0]=='f'){
			scanf("%d",&x);
			struct Node *t=find(root,x);
			if(t!=NIL) printf("yes\n");
			else printf("no\n");
		}
		else if(C[0]=='i'){
			scanf("%d",&x);
			insert(x);
		}
		else if(C[0]=='p'){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if(C[0]=='d'){
			scanf("%d",&x);
			treeDel(find(root,x));
		}
	}
	return 0;
}



Measured memory_bytes: 20552
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000007
typedef long long int lint;

int main(){
  lint N,D,cnt;
  cin >> N >> D;
  vector<lint> X(N),Y(N);
  rep(i,0,N){
    cin >> X[i] >> Y[i];
  }
  
  cnt = 0;
  rep(i,0,N){
    if(pow(X[i],2) + pow(Y[i],2) <= D*D){cnt++;}
  }
  co(cnt);
}

Measured memory_bytes: 6404
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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;
	
	if(n == 1 && m == 0){
		cout << 0 << endl;
		return 0;
	}
	
	//cout << n << m << endl;
	
	vector<int> s(m), c(m);
	rep(i,m) cin >> s[i] >> c[i];
	
	//rep(i,m) cout <<  s[i] << c[i] << endl;
	
	
	vector<int> a(n);
	rep(i, n) a[i] = -1;
	
	rep(i, m){
		int j = s[i] - 1;
		int value = c[i];
		if(a[j] == -1){
			a[j] = value;
			//cout << "test1" << endl;
		}
		else if(a[j] != value){
			cout << "-1" << endl;
			return 0;
		}
		//else cout << "test2" << endl;
	}
	if (n >= 2 && a[0] == 0){
		cout << "-1" << endl;
		return 0;
	}
	
	//cout << a[0] << endl;
	
	rep(i, n) {
		if(i == 0 && a[i] == -1) cout << 1;
		else if(a[i] == -1) cout << 0;
		else cout << a[i];
		
		//cout << "test3" << endl;
	}
	cout << endl;
	
	
//	sort(all(a));

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;

int main() {
    int x;
    cin >> x;
    if(x == 7 || x == 5 || x == 3) {
        cout << "YES";
    }else {
        cout << "NO";
    }
    return 0;
}



Measured memory_bytes: 256