akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long

int distance[200005];
int dp[200005];
vector<int> t_Sorted;
vector<int> visited;
int n,m;
void topologicalSort(int curr,vector<vector<int>> &g){
    visited[curr]=true;
    for(auto i : g[curr]){
        if(!visited[i])
            topologicalSort(i,g);
    }
    t_Sorted.push_back(curr);
}

int solve(int node,vector<vector<int>> &g){
    visited[node]=true;
    if(dp[node]!=-1) return dp[node];
    int &ans=dp[node];
    ans=0;
    for(auto i : g[node]){
        ans=max(ans,1+solve(i,g));
    }
    return ans;
}

int32_t main(){
    memset(dp,-1,sizeof(dp));
    cin>>n>>m;
    vector<vector<int>> v(n);
    for(int i=0,x,y;i<m;i++){
        cin>>x>>y;x--;y--;
        v[x].push_back(y);
    }
    visited.assign(n,false);
    for(int i=0;i<n;i++){
        if(!visited[i])
            topologicalSort(i,v);
    }
    vector<int> ans(n);
    reverse(t_Sorted.begin(),t_Sorted.end());
    fill(visited.begin(),visited.end(),false);
    for(auto i : t_Sorted){
         ans[i]=solve(i,v);
    }
    cout<<*max_element(ans.begin(),ans.end())<<"\n";
}

Measured memory_bytes: 14452
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long a,b;
  cin >> a >> b;
  if(a==1) a=14;
  if(b==1) b=14;
  if(a>b) cout << "Alice" << endl;
  else if(a<b) cout << "Bob" << endl;
  else cout << "Draw" << endl;
}

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


int main() {
    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    vector<vector<int>> t(h,vector<int>(w));
    int ans=0;
    for (int i=0;i<h;i++) {
        for (int j=0;j<w;j++) {
            cin >> s[i][j];
            if (s[i][j]=='.') ans++;
            t[i][j]=10000;
        }
    }
    queue<pair<int,int>> q;
    q.push(make_pair(0,0));
    int dx[4]={0,-1,0,1};
    int dy[4]={-1,0,1,0};
    bool flag=0;
    t[0][0]=0;
    while (!q.empty()) {
        int x=q.front().second;
        int y=q.front().first;
        q.pop();
        if (x==w-1 && y==h-1) {
            flag=1;
            break;
        }
        for (int i=0;i<4;i++) {
            int nx=x+dx[i];
            int ny=y+dy[i];
            if (nx>=0 && nx<w && ny>=0 && ny<h) {
                if (s[ny][nx]=='.' && t[ny][nx]==10000) {
                    q.push(make_pair(ny,nx));
                    t[ny][nx]=t[y][x]+1;
                }
            }
        }
        
    }
    if (flag) cout << ans-t[h-1][w-1]-1 << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <math.h>
#include <algorithm>
#include<queue>
#include <bits/stdc++.h>


using namespace std;

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

main(){
    string S;
    int numwin = 0;
    cin >> S;
    FOR(i, 0, S.length()){
        if(S[i] == 'o'){
            numwin += 1;
        }
    }
    if(7 - (int)(S.length()) + numwin >= 0){cout << "YES" << endl;}
    else{cout << "NO" << endl;}
    }

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val t = List.fill(n)(sc.nextLong())

  def gcd(a: Long, b: Long): Long = {
    if (b == 0) a else gcd(b, a % b)
  }

  def lcm(a: Long, b: Long): Long = {
    (a / gcd(a, b)) * b
  }

  println(t.reduceLeft(lcm))
}


Measured memory_bytes: 55048
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

N, K = list(map(int, sys.stdin.readline().split()))

# 一番左の色が決まるとその右も決まる
print(pow(K - 1, N - 1) * K)


Measured memory_bytes: 13640
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

    string s;
    cin >> s;

    int count = 1;

    for (int i = 0; i < n - 1; ++i) {
        if (s[i] != s[i + 1]) {
            ++count;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;

ll n;


ll solve(ll n)
{
  if(n<=1) return 0;
  if(n%3==0)
    {
      return solve(n/3)+1;
    }
  else
    {
      return solve(n/3+1)+1;
    }
}

int main(int argc,char const* argv[])
{
  cin >> n;
  cout << solve(n) << endl;;
      
  return 0;
}



Measured memory_bytes: 3092
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int N;
	cin >> N;
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	for (int i = 0; i < N; i++)
	{
		string temp;
		cin >> temp;
		if (temp == "AC")
		{
			ac++;
		}
		else if (temp == "WA")
		{
			wa++;
		}
		else if (temp == "TLE")
		{
			tle++;
		}
		else
		{
			re++;
		}
	}
	cout << "AC x " << ac<<endl;
	cout << "WA x " << wa<<endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;

}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int a,b,c; cin >> a>>b >>c;
	cout << a+b+c-max({a,b,c}) << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   vector<char>s(n);
   for(int i=0;i<n;i++){
       cin>>s.at(i);
       if(s.at(i)=='Y'){
           cout<<"Four"<<endl;
           return 0;
       }
   }
   cout<<"Three"<<endl;
    }


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

int main(){
	int X,Y;
	bool can = false;
	cin >> X >> Y;
	for(int a = 0;a <= X;a++){
		for(int b = 0;b <= X - a;b++){
			if(a + b == X && 2*a + 4*b == Y){
				can = true;
			}
		}
	}
	if(can){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3128
const val INF = 1000000000000000L
fun main(args: Array<String>) {
    val (a, b, q) = readLine()!!.split(" ").map { it.toInt() }
    val s = LongArray(a+2) { when(it){
        0 -> -INF
        a+1 -> INF
        else -> readLine()!!.toLong()
    } }
    val t = LongArray(b+2) { when(it){
        0 -> -INF
        b+1 -> INF
        else -> readLine()!!.toLong()
    } }
    val x = (1..q).map { readLine()!!.toLong() }

    val st = s.map {
        if(it==INF||it==-INF) return@map 0L
        val l = -t.binarySearch(it)-2
        val r = -t.binarySearch(it)-1
        Math.min(t[r]-it , it-t[l])
    }
    val ts = t.map {
        if(it==INF||it==-INF) return@map 0L
        val l = -s.binarySearch(it)-2
        val r = -s.binarySearch(it)-1
        Math.min(s[r]-it , it-s[l])
    }

    x.map { xi ->
        val ls = -s.binarySearch(xi)-2
        val rs = -s.binarySearch(xi)-1
        val lt = -t.binarySearch(xi)-2
        val rt = -t.binarySearch(xi)-1
        listOf(xi-s[ls]+st[ls], s[rs]-xi+st[rs], xi-t[lt]+ts[lt], t[rt]-xi+ts[rt] ).min()
    }.joinToString("\n").let { println(it) }
}


Measured memory_bytes: 67984
n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[]
sum=0
for i in a:
    sum+=i
#print(sum)
for i in a:
    if i>=sum/(4*m):
        l.append(i)
#print(l)
x=len(l)
#print(x)
if x>=m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		long[] A = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		long ans = 0L;
		long sum = 0L;
		for (int i = N - 1; i > 0; i--) {
			sum += A[i];
			sum %= 1000000007L;
			ans += (A[i - 1] * sum);
			ans %= 1000000007L;
		}
		System.out.println(ans);
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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

Measured memory_bytes: 35724
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  string s;
  cin>>s;
  set<int>Sr;
  set<int>Sg;
  set<int>Sb;
  for(int i=0;i<N;i++){
  if(s.at(i)=='R')
    Sr.insert(i);
    else if(s.at(i)=='G')
      Sg.insert(i);
    else
      Sb.insert(i);
  }int64_t ans=0;
  int b=Sb.size();
  for(auto p:Sr){
  for(auto q:Sg){
  int x=0;
    if(p%2==q%2){
    if(Sb.count((p+q)/2))
       x++;
       if(Sb.count(2*p-q))
       x++;
       if(Sb.count(2*q-p))
       x++;
    }else{
     if(Sb.count(2*p-q))
       x++;
       if(Sb.count(2*q-p))
       x++;
    }ans+=(b-x);
  
  }
  }cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 3836
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>

using namespace std;

int main()
{
    const char *YES = "YES";
    const char *NO = "NO";

    int r, g, b;
    if (scanf("%d%d%d", &r, &g, &b) < 3) return 0;

    printf("%s\n", (r * 100 + g * 10 + b) % 4 ? NO : YES);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MAXN 100010
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x<n and y >=0 and y<n)
using namespace std;
const ll mod = 1e18 + 7;

ll funcao(ll a, ll b, ll x){
    return (a*x)/b - a*(x/b);
}

int main (){
    ios_base::sync_with_stdio(false);
    
    ll a,b, n;

    cin >> a >> b >> n;

    cout << funcao(a, b, min(n, b-1)) << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>
int n,m;
int s[111111];
int t[111111];

int main(){
  cin>>n;
  rep(i,n)cin>>s[i];
  cin>>m;
  rep(i,m)cin>>t[i];

  int ans=0;
  sort(s,s+n);

  rep(i,m){
      int now=t[i];
      int ng=-1,ok=n;
      while(abs(ok-ng)>1){
        int mid=(ok+ng)/2;
        ((s[mid]<now)?ng:ok)=mid;
      }
      if(s[ok]==now)ans++;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3724
import java.util.Scanner;

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

        while(true){
            h = sc.nextInt();
            w = sc.nextInt();

            if(h == 0 && w == 0) break;

            for(int i = 0 ; i < h ; i++){
                for(int j = 0 ; j < w ; j++){
                    if((i+j)%2==0){
                        System.out.print("#");
                    }else{
                    	System.out.print(".");
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 34720
#include <stdio.h>

int main(void)
{
    long long int A, B, K;

    scanf("%lld %lld %lld",&A,&B,&K);

    if(A>=K)//高橋君だけクッキー食べるとき
    {
        printf("%lld %lld\n",A-K,B);
    }
    else if(B >= (K-A))//高橋君がクッキーを食べたあとの残り行動回数と、青木君の枚数を比べる
    {
        K = K-A;
        printf("0 %lld\n",B-K);
    }
    else
    {
        printf("0 0\n");
    }

    return 0;
}

Measured memory_bytes: 128
S = input()
K = int(input())

if len(S) == 1:
    print(K // 2)
    exit(0)

if len(set(S)) == 1 and len(S) % 2 == 1:
    print(len(S)*K//2)
    exit(0)

pre_s = ''
flag1 = 0
flag2 = 0
flag = True

pre_s = S[0]
flag1 = 1
for s in S[1:]:
    if pre_s == s:
        flag1 += 1
    else:
        break

if S[-1] == S[0]:
    pre_s = S[-1]
    flag2 = 1
    for i, s in enumerate(S[::-1]):
        if i == 0:
            continue
        if pre_s == s:
            flag2 += 1
        else:
            break

    # if flag1 > 0 and flag1 % 2 == 0 and flag2 % 2 != 0:
    if flag1 > 0 and flag1 % 2 == 0:
        flag = False

pre_s = ''
rep_count = 0
    

for s in S:
    if pre_s == s:
        rep_count += 1
        pre_s = s.upper()
    else:
        pre_s = s

rep_count *= K
if S[0] == pre_s and flag:
    rep_count += K - 1


print(rep_count)





Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

signed main() {
	string s;
	int k;
	cin >> s >> k;
	rep(i, (int)s.size()) {
		int x = ('z' - s[i] + 1) % 26;
		if (k >= x) {
			k -= x;
			s[i] = 'a';
		}
	}
	if (k > 0) {
		s.back() = ((s.back() - 'a' + k) % 26) + 'a';
	}
	cout << s << endl;

	system("pause");
}

Measured memory_bytes: 760
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
ld pie=3.141592653589793238462643383279;
int mod=1e9+7;

struct Edge {
    int a, b, cost;
};

int n, m;
vector<Edge> edges;
const int INF = 1000000000;

void solve()
{
    cin>>n>>m;
    for(int i=0;i<m;++i){
      int A,B,C; cin>>A>>B>>C;
      --A; --B;
      Edge lp; lp.a=A; lp.b=B; lp.cost=C;
      edges.pb(lp);
    }
    vector<int> d(n);
    vector<int> p(n, -1);
    int x;
    for (int i = 0; i < n; ++i) {
        x = -1;
        for (Edge e : edges) {
            if (d[e.a] + e.cost < d[e.b]) {
                d[e.b] = d[e.a] + e.cost;
                p[e.b] = e.a;
                x = e.b;
            }
        }
    }

    if (x == -1) {
        cout << "NO";
    } else {
        for (int i = 0; i < n; ++i)
            x = p[x];

        vector<int> cycle;
        for (int v = x;; v = p[v]) {
            cycle.push_back(v);
            if (v == x && cycle.size() > 1)
                break;
        }
        reverse(cycle.begin(), cycle.end());

        cout << "YES\n";
        for (int v : cycle)
            cout << v << ' ';
        cout << endl;
    }
}
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a[5] ;
  f(i,0,5) cin>>a[i];
  f(i,0,5) if(a[i]==0) {
    cout<<i+1;
    return 0;
  } 
  return 0;
}


Measured memory_bytes: 3612
using Atcoder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var A = int.Parse(S.Substring(0, 2));
            var B = int.Parse(S.Substring(2, 2));
            if (A < 13 && B < 13 && A != 0 && B != 0)
            {
                Console.Write("AMBIGUOUS");
                return;
            }
            if ((A >= 13 && B >= 13) || (A == 0 && B >= 13) || (A >= 13 && B == 0) || (A==0 && B==0))
            {
                Console.Write("NA");
                return;
            }
            if (A != 0 && A < 13)
            {
                Console.Write("MMYY");
                return;
            }
            if (B != 0 && B < 13)
            {
                Console.Write("YYMM");
                return;
            }
        }

    }

    //var N = int.Parse(Console.ReadLine());
    //var S = Console.ReadLine();
    //var K = Console.ReadLine().Split(' ');
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
  string S;
  cin >> S;
  cout << S.at(0) << S.size() - 2 << S.at(S.size() - 1) << endl;
}

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

#define ll long long
#define ld long double
#define ii pair<int ,int >
#define S second
#define F first
#define PI 3.1415926535897932384626
#define SPEED std::ios_base::sync_with_stdio(false);

int n,d;

bool ok(int x){
    if((2*d+1)*x>=n)return 1;
    return 0;
}

int main(){
    SPEED
    cin>>n>>d;
    int lo=0,hi=n;
    while(lo<hi){
        int mid=(lo+hi)/2;
        if(ok(mid))hi=mid;
        else lo=mid+1;
    }
    cout<<lo;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashMap;
import java.util.Objects;
import java.util.Collection;

public class Main {
	public static void main(String[] args) {
		
		SunukeColoring sc = new SunukeColoring();
		sc.run();
		
	}
}

class SunukeColoring {
	
	int H;
	int W;
	int N;
	Point[] points;
	
	SunukeColoring() {
		Scanner cin = new Scanner(System.in);
		this.H = cin.nextInt();
		this.W = cin.nextInt();
		this.N = cin.nextInt();
		this.points = new Point[N];
		for (int i = 0; i < N; i++) {
			int x = cin.nextInt();
			int y = cin.nextInt();
			points[i] = new Point(x, y);
		}
	}
	
	void run() {
		
		HashMap<Point, Long> map = new HashMap<Point, Long>();
		for (Point point: points) {
			for (int i = -1; i <= 1; i++) {
				for (int j = -1; j <= 1; j++) {
					
					Point target = new Point(point.x + i, point.y + j);
					
					if (target.invalid()) {
						continue;
					}
					
					if (map.containsKey(target)) {
						long count = map.get(target);
						map.put(target, count + 1);
					} else {
						map.put(target, (long)1);
					}
					
				}
			}
		}
		
		Collection<Long> values = map.values();
		long[] ans = new long[10];
		
		long allCount = 0;
		for (long num: values) {
			ans[(int)num]++;
			allCount++;
		}
		
		long all = (long) (H - 2) * (W - 2);
		ans[0] = all - allCount;
		
		for (long a: ans) {
			System.out.println(a);
		}
	}
	
	class Point {
		
		int x;
		int y;
		
		Point(int x, int y) {
			this.x = x;
			this.y = y;
		}
		
		boolean invalid() {
			return x <= 1 || H <= x || y <= 1 || W <= y;
		}
		
		@Override
		public boolean equals(Object obj) {
			if (obj instanceof Point) {
				Point point = (Point) obj;
				return this.x == point.x && this.y == point.y;
			} else {
				return false;
			}
		}
		
		@Override
		public int hashCode() {
			return Objects.hash(x, y);
		}
	}
}


Measured memory_bytes: 135304
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int main(){
  int n;
  while(cin >>n,n){
      int a,b;
      int wide[2] = {0,0}, high[2] = {0,0};
      map<int, pair<int ,int> > field;
      field[0].first = 0;
      field[0].second = 0;
      for(int i = 1; i<n; i++){
	scanf("%d %d",&a,&b);
	int x = field[a].first;
	int y = field[a].second;
	if(b == 0){x--;}
	if(b == 1){y++;}
	if(b == 2){x++;}
	if(b == 3){y--;}
	if(x < wide[0]){wide[0] = x;}
	if(x > wide[1]){wide[1] = x;}
	if(y < high[0]){high[0] = y;}
	if(y > high[1]){high[1] = y;}
	field[i] = make_pair(x,y);
      }
      cout <<wide[1]-wide[0]+1<<" "<<high[1]-high[0]+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    int n,b,f,r,v;
    int  x[4][3][10]={{{}}} ;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b>>f>>r>>v;
        x[b-1][f-1][r-1]+=v;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<10;k++){
                cout<<" ";
                cout<<x[i][j][k];
            }
            cout<<endl;
        }
        if(i<3){
            cout<<"####################"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3104
using System;
using System.Linq;

namespace AtCoder.DP
{
    class EDPC_D
    {
        public static void Main()
        {
            var nw = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            
            var n = nw[0];
            var maxWeight = nw[1];

            var dp = new long[n + 1, maxWeight + 1];

            for (int i = 1; i <= n; i++)
            {
                var wv = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
                var w = wv[0];
                var v = wv[1];
                for (int j = 0; j <= maxWeight; j++)
                {
                    dp[i, j] = dp[i - 1, j];
                    if (j >= w)
                        dp[i, j] = Math.Max(dp[i, j], dp[i - 1, j - w] + v);
                }
            }

            Console.WriteLine(dp[n, maxWeight]);
        }
    }
}


Measured memory_bytes: 90976
from sys import setrecursionlimit
setrecursionlimit(10**9)

N = int(input())
MOD = 10**9 + 7

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

dp1 = [0]*N # 頂点iが白のときに、頂点iを根とする部分木の塗り方の組み合わせ
dp2 = [0]*N # 頂点iが黒のときに、頂点iを根とする部分木の塗り方の組み合わせ


# nodeを白で塗るときに、nodeを根とする部分木の塗り方の組み合わせを求める
def solve1(node, parent): 
  global dp1
  global dp2
  if dp1[node]:
    return dp1[node]
  else:
    children = tree[node]
    if len(children)==0 or \
        len(children)==1 and children[0]==parent: # nodeがリーフのとき
      dp1[node] = 1 # nodeを白に塗る1通りだけ
      return dp1[node]
    
    else:
      dp1[node] = 1
      for child in children:
        if child == parent:
          continue

        dp1[node] *= solve1(child, node) + solve2(child, node)
        dp1[node] %= MOD

      return dp1[node]


# nodeを黒で塗るときに、nodeを根とする部分木の塗り方の組み合わせを求める
def solve2(node, parent):
  global dp1
  global dp2
  if dp2[node]:
    return dp2[node]
  else:
    children = tree[node]
    if len(children)==0 or \
        len(children)==1 and children[0]==parent: # nodeがリーフのとき
      dp2[node] = 1 # nodeを黒に塗る1通りだけ
      return dp2[node]
    
    else:
      dp2[node] = 1
      for child in children:
        if child == parent:
          continue

        dp2[node] *= solve1(child, node)
        dp2[node] %= MOD

      return dp2[node]


print((solve1(0, -1)+solve2(0, -1))%MOD)

Measured memory_bytes: 101300
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	T := nextInt()
	nextInt()
	var total, sec, prev, diff int
	for i := 1; i < N; i++ {
		sec = nextInt()
		diff = sec - prev
		if diff > T {
			total += T
		} else {
			total += diff
		}
		prev = sec
	}

	fmt.Println(total + T)
}
func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		log.Fatal(err)
	}
	return i
}


Measured memory_bytes: 3840
n = int(input())
num = float("inf")
for i in range(1, n):
    rec = 0
    a, b = i, n - i
    while a > 0:
        rec += a % 10
        a //= 10
    while b > 0:
        rec += b % 10
        b //= 10
    num = min(rec, num)

print(num)

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

#define lld long long
#define pii pair<int,int>
#define pb push_back
#define next nextt
#define Inf 1000000000
#define Linf 1000000000000000000LL
#define Mod 1000000007

using namespace std;

lld n,a,b,c,d;

int main(){
	scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
	lld cha = abs(a-b),tmp = 0;
	n--;
	while(n>0 && cha > d){
		n--;
		cha -= d;
		tmp += (d-c);
	}
	if(n%2 == 1){
		if(cha+tmp < c){
			cha = c-(cha+tmp);
		}else{
			cha = 0;
		}
	}
	n /= 2;
	if(cha <= n*(d-c)) puts("YES");
	else puts("NO");

	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
M = 10**9 + 7

def fact(n):
    result = 1
    for i in range(2, n + 1):
        result *= i
        if result >= M:
            result %= M
    return result


def fact2(a, b):
    return (fact(a) * fact(b)) %M


if n == m:
    print(((fact(n)**2)*2) % M)
elif abs(n - m) == 1:
    print(fact2(n, m))
else:
    print(0)


Measured memory_bytes: 3060
m = int(input())
if m <= 2 :
  print('2')
else:
  n = 2*10**5
  primes = set(range(2, n+1))
  for i in range(2, int(n**0.5+1)):
      primes.difference_update(range(i*2, n+1, i))
  primes=list(primes)

  for i in range(len(primes)-1):
    if primes[i] < m and m <= primes[i+1]:
      print(primes[i+1])



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

struct P{
  double x;
  double y;
};

int kock(int,struct P,struct P);

int main(){
  int n;
  struct P p1,p2;

  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;

  scanf("%d",&n);

  printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);

  return 0;
}

int kock(int n,struct P p1,struct P p2){
  struct P s,t,u;

  if(n==0){
    return 0;
  }

  s.x=(2*p1.x+1*p2.x)/3;
  s.y=(2*p1.y+1*p2.y)/3;
  t.x=(1*p1.x+2*p2.x)/3;
  t.y=(1*p1.y+2*p2.y)/3;
  u.x=(t.x-s.x)*cos(M_PI/3)-(t.y-s.y)*sin(M_PI/3)+s.x;
  u.y=(t.x-s.x)*sin(M_PI/3)+(t.y-s.y)*cos(M_PI/3)+s.y;

  kock(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
  kock(n-1,t,p2);
}



Measured memory_bytes: 2140
// B - Greedy Takahashi
#include <stdio.h>
typedef long long ll;

int main(void){
    ll a, b, k;
    scanf("%lld%lld%lld", &a, &b, &k);
    if(k <= a) printf("%lld %lld\n", a-k, b);
    else if(k <= a+b) printf("0 %lld\n", b-(k-a));
    else printf("0 0\n");
    return 0;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


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

    int ans = 0;
    int m_a = 0;
    REP(i,N){
        int a,b;
        cin >> a >> b;

        if(a > m_a) {
            m_a = a;
            ans = a + b;
        }
    }

    pl(ans)

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,a=0,b;
  cin>>n;
  for(int i=1;i<=n;i++){
    for(int j=2;j<=n+1;j++){
      b = pow(i,j);
      if(b<=n){
        a = max(a,b);
      }
    }
  }
  cout<<a<<"\n";
}


Measured memory_bytes: 1020
n = int(input())
a = list(map(int,input().split()))
INF = 114514191981036436433-4
bl = []

for i in range(n):
    bl.append(a[i] - (i+1))
    
bl.sort()
d = bl[0]
c = [bl[i]-d for i in range(n)]

ans = sum(c)
cur = sum(c)

for i in range(1,n):
    e = c[i] - c[i-1]
    cur = cur + i * e - (n-i) * e
    ans = min(cur,ans)
    
print(ans)

Measured memory_bytes: 99668
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <iomanip>

using namespace std;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

vector<pair<ll, ll>> pF;


void prime_fact(ll n){
// 素因数分解
for(ll i = 2; i * i <= n; i ++){
ll cnt = 0;
while(n % i == 0){
cnt ++;
n /= i;
}
pair<ll, ll> f = {i, cnt};
pF.push_back(f);
}
if(n != 1){
pF.push_back({n, 1});
}
}


int main(){
    int D;
    cin >> D;
    if(D == 25){
        cout << "Christmas" << endl;
    }else if(D == 24){
        cout << "Christmas Eve" << endl;
    }else if(D == 23){
        cout << "Christmas Eve Eve" << endl;
    }else if(D == 22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
    return 0;
}


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

int main() {
	long long N; cin >> N;
	int ans = 1;
	while (ans * 2 <= N) {
		ans *= 2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3100
n = int(input())
li = []
ans = True
for i in range(n):
    w = input()
    if len(li) == 0:
        li.append(w)
    else:
        if w in li or w[0] != li[-1][-1]:
            ans = False
        li.append(w)
print("Yes" if ans else "No")


Measured memory_bytes: 9096
import math
minutes = []
for _ in range(5):
    minutes.append(int(input()))
minutes.sort(reverse = True, key = lambda x: x % 10 if x % 10 != 0 else 10)
x = 0
for minute in minutes:
    x = math.ceil(x / 10) * 10
    x += minute
print(x)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int h,w;
char c[311][311];

int dp[311][311];
int g[311][311];

int ans;

int main()
{
    int i,j,k;
    
    cin>>h>>w;
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++)
        {
            cin>>c[i][j];
        }
    }
    
    ans=0;
    for(i=1;i<=w-1;i++)
    {
        memset(dp,0x3f,sizeof(dp));
        memset(g,0,sizeof(g));
        g[0][0]=0;
        g[1][0]=g[0][1]=0;
        
        for(j=1;j<=h;j++)
        {
            for(k=1;k<=h;k++)
            {
                g[j][k]=g[j-1][k-1];
                if(c[j][i]==c[k][i+1])
                {
                    g[j][k]++;
                }
            }
        }
        
        dp[h][h]=0;
        for(j=h;j>=0;j--)
        {
            for(k=h;k>=0;k--)
            {
                if(j>0)
                {
                     dp[j-1][k]=min(dp[j-1][k],dp[j][k]+g[j][k]);
                }
                if(k>0)
                {
                    dp[j][k-1]=min(dp[j][k-1],dp[j][k]+g[j][k]);
                }
            }
        }
        
        ans+=dp[0][0];
        /*
        for(j=0;j<=h;j++)
        {
            for(k=0;k<=h;k++)
            {
               cout<<dp[j][k]<<' ';
            }
            cout<<endl;
        }
        cout<<ans<<endl;
        */
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1152
s = input()
n = len(s)

ans = 0
dif = 0

for i in range(n):
    if s[i] == 'g':
        if dif > 0:
            ans += 1
            dif -= 1
        else:
            dif += 1
    else:
        if dif > 0:
            dif -= 1
        else:
            ans -= 1
            dif += 1
            
print(ans)

Measured memory_bytes: 39536
#define DEBUG 0
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 8/10/2019, 8:49:36 PM
 * Powered by Visual Studio Code
 */
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
using ll = long long;
class mint
{
public:
  static ll MOD;
  ll x;
  mint() : x(0) {}
  mint(ll x) : x(x % MOD) {}
  mint operator-() const { return x ? MOD - x : 0; }
  mint &operator+=(const mint &a)
  {
    if ((x += a.x) >= MOD)
    {
      x -= MOD;
    }
    return *this;
  }
  mint &operator-=(const mint &a) { return *this += -a; }
  mint &operator*=(const mint &a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint &operator/=(const mint &a)
  {
    mint b{a};
    return *this *= b.power(MOD - 2);
  }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
  const mint power(ll N)
  {
    if (N == 0)
    {
      return 1;
    }
    else if (N % 2 == 1)
    {
      return *this * power(N - 1);
    }
    else
    {
      mint half = power(N / 2);
      return half * half;
    }
  }
};
ll mint::MOD = 1e9 + 7;
istream &operator>>(istream &stream, mint &a) { return stream >> a.x; }
ostream &operator<<(ostream &stream, const mint &a) { return stream << a.x; }
class combination
{
public:
  vector<mint> inv, fact, factinv;
  static int MAX_SIZE;
  combination() : inv(MAX_SIZE), fact(MAX_SIZE), factinv(MAX_SIZE)
  {
    inv[1] = 1;
    for (auto i = 2; i < MAX_SIZE; i++)
    {
      inv[i] = (-inv[mint::MOD % i]) * (mint::MOD / i);
    }
    fact[0] = factinv[0] = 1;
    for (auto i = 1; i < MAX_SIZE; i++)
    {
      fact[i] = mint(i) * fact[i - 1];
      factinv[i] = inv[i] * factinv[i - 1];
    }
  }
  mint operator()(int n, int k)
  {
    if (n >= 0 && k >= 0 && n - k >= 0)
    {
      return fact[n] * factinv[k] * factinv[n - k];
    }
    return 0;
  }
};
int combination::MAX_SIZE = 3000010;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// constexpr double epsilon = 1e-10;
// constexpr ll infty = 1000000000000000LL;
// constexpr int dx[4] = {1, 0, -1, 0};
// constexpr int dy[4] = {0, 1, 0, -1};
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}
void No()
{
  cout << "No" << endl;
  exit(0);
}

int main()
{
  ll A, B;
  cin >> A >> B;
  cout << max({A + B, A - B, A * B}) << endl;
}

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

int main() {
  string S; cin >> S;
  vector<int> C(S.size()+1, 0);
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == '<') {
      C.at(i+1) = C.at(i);
      C.at(i+1)++;
    }
  }
  for (int i = S.size()-1; i >= 0; i--) {
    if (S.at(i) == '>') {
      C.at(i) = max(C.at(i), C.at(i+1)+1);
    }
  }
  long long ans = 0;
  for (int i = 0; i < C.size(); i++) ans += C.at(i);
  cout << ans << endl;
}


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

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if(e-a <= k) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  
  return 0;
}


Measured memory_bytes: 256
package main

import (
  "bufio"
  "fmt"
  "math"
  "os"
  "sort"
  "strconv"
  "strings"
)

const (
  InputSize = 500000 // 10^5
)
var (
  rdr = bufio.NewReaderSize(os.Stdin, InputSize)
)

func readLine() string {
  buf := make([]byte, 0, InputSize)
  for {
    l, p, e := rdr.ReadLine()
    if e != nil {
      panic(e)
    }
    buf = append(buf, l...)
    if !p {
      break
    }
  }
  return string(buf)
}


func getStringArray() []string {
  return strings.Split(readLine(), " ")
}


func nextLineValue() int {
  v, _ := strconv.Atoi(readLine())
  return v
}

func nextLineValues() []int {
  return getIntArray(readLine())
}

func getInt(s string) int {
  v, _ := strconv.Atoi(s)
  return v
}

func getIntArray(s string) []int {
  var v []int
  valstr := strings.Split(s, " ")
  for _, c := range valstr {
    va, _ := strconv.Atoi(c)
    v = append(v, va)
  }
  return v
}

func digitTotal(v int) int {
  total := 0
  d := strings.Split(strconv.Itoa(v), "")
  for _, c := range d {
    dv, _ := strconv.Atoi(c)
    total += dv
  }
  return total
}

func sortDesc(v *[]int) {
  sort.Sort(sort.Reverse(sort.IntSlice(*v)))
}

func removeDupIntSlice(values *[]int) []int {
  m := make(map[int]bool)
  uniq := []int{}
  for _, v := range *values {
    if !m[v] {
      uniq = append(uniq, v)
      m[v] = true
    }
  }
  return uniq
}

func removeDupStringSlice(values *[]string) []string {
  m := make(map[string]bool)
  uniq := []string{}
  for _, v := range *values {
    if !m[v] {
      uniq = append(uniq, v)
      m[v] = true
    }
  }
  return uniq
}

func countUniqIntInSlice(values *[]int) map[int]int {
  uniq := make(map[int]int)
  for _, v := range *values {
    if _, ok := uniq[v]; !ok {
      uniq[v] = 1
    } else {
      uniq[v] += 1
    }
  }
  return uniq
}

func countUniqStringInSlice(values *[]string) map[string]int {
  uniq := make(map[string]int)
  for _, v := range *values {
    if _, ok := uniq[v]; !ok {
      uniq[v] = 1
    } else {
      uniq[v] += 1
    }
  }
  return uniq
}


func main() {
  values := nextLineValues()

  a, b := values[0], values[1]

  min_a := math.Ceil(12.5 * float64(a))
  max_a := math.Floor(12.5 * float64(a) + 12.5)
  if max_a == 12.5 * float64(a) + 12.5 {
    max_a -= 1
  }
  min_b := math.Ceil(float64(10 * b))
  max_b := math.Floor(float64(10 * b + 10))
  if max_b == 10 * float64(b) + 10 {
    max_b -= 1
  }

  if min_a > max_b || max_a < min_b {
    fmt.Println("-1")
  } else {
    if min_a >= min_b {
      fmt.Println(min_a)
    } else {
      fmt.Println(min_b)
    }
  }
}


Measured memory_bytes: 640
#define ll long long int
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#include <bits/stdc++.h>
using namespace std;

void solve(){
    int x;
    cin >> x;
    if(x<30){
        cout << "No" << "\n";
    }
    else{
        cout << "Yes" << "\n";
    }
}

int main()
{
    fast;
        solve();
    return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

int **dist;

void Floyd(int);

int main(void)
{
  int i, j, v, e, s, t, d;
  scanf("%d %d", &v, &e);
  dist = (int**)malloc(sizeof(int*) * v);
  for (i = 0; i < v; i++) {
    dist[i] = (int*)malloc(sizeof(int) * v);
    for (j = 0; j < v; j++) {
      dist[i][j] = ((i == j) ? 0 : INT_MAX);
    }
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d %d", &s, &t, &d);
    dist[s][t] = d;
  }
  Floyd(v);
  for (i = 0; i < v; i++) {
    if (dist[i][i] < 0) {
      printf("NEGATIVE CYCLE\n");
      return 0;
    }
  }
  for (i = 0; i < v; i++) {
    for (j = 0; j < v - 1; j++) {
      if (dist[i][j] == INT_MAX) {
        printf("INF ");
      } else {
        printf("%d ", dist[i][j]);
      }
    }
    if (dist[i][j] == INT_MAX) {
      printf("INF\n");
    } else {
      printf("%d\n", dist[i][j]);
    }
    free(dist[i]);
  }
  free(dist);
  return 0;
}

void Floyd(int size)
{
  int k, i, j;
  for (k = 0; k < size; k++) {
    for (i = 0; i < size; i++) {
      if (dist[i][k] == INT_MAX) continue;
      for (j = 0; j < size; j++) {
        if (dist[k][j] == INT_MAX) continue;
        if (dist[i][j] > dist[i][k] + dist[k][j]) {
          dist[i][j] = dist[i][k] + dist[k][j];
        }
      }
    }
  }
}


Measured memory_bytes: 2056
#include <functional>
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

template<typename Monoid>
struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
        sz = 1;
        while(sz < n) sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x) {
        seg[k + sz] = x;
    }

    void build() {
        for(int k = sz - 1; k > 0; k--) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    void update(int k, const Monoid &x) {
        k += sz;
        seg[k] = x;
        while(k >>= 1) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    Monoid query(int a, int b) {
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if(a & 1) L = f(L, seg[a++]);
            if(b & 1) R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const {
        return seg[k + sz];
    }
};

int main()
{
    ll n, k;
    cin >> n >> k;
    ll a[200004];
    ll s[200004];
    P p[200004];
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i] -= k;
        s[i] = a[i];
        if(i > 0) s[i] += s[i - 1];
        if(s[i] >= 0) ans++;
        p[i] = P(s[i], i);
    }
    sort(p, p + n);
    int nth[200004];
    for(int i = 0; i < n; i++) nth[p[i].second] = i;
    SegmentTree<ll> seg(n, [](ll a, ll b){return a + b;}, (ll)0);
    for(int i = 0; i < n; i++) seg.set(i, (ll)0);
    seg.build();
    for(int i = n - 1; i >= 0; i--){
        int insert = lower_bound(p, p + n, P(s[i], -1)) - p;
        ans += seg.query(insert, n);
        seg.update(nth[i], 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 11392
from collections import  Counter
N = int(input())
votes = [input() for i in range(N)]
count = dict(Counter(votes))
max_vote = max(count.values())
res = []
for i in count:
    if count[i] == max_vote:
        res.append(i)
        continue
res.sort()
for i in res:
    print(i)

Measured memory_bytes: 41712
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,x,y,z,l,n,m,a,r,f;
  long long min,max,sum;
  //vector<vector<int>> A(n, vector<int>(m, 0));
  vector<int> B(26, 0);
  string s,g;
  string s1,s2;
  double x1,y1,x2,y2;

  cin >> x1 >> y1 >> x2 >> y2;

  double ac = sqrt(pow((x2-x1), 2.0) + pow((y2-y1), 2.0));
  
  cout << std::fixed << std::setprecision(6) << ac << endl;

}


Measured memory_bytes: 3284
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
#include<queue>
using namespace std;

using ll = long long;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001;
const int MOD = 1000000007;

#define rep(i,n) for (int i = 0; i < (n); ++i)

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


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll a, b, h;
    cin >> a >> b >> h;
    
    cout << (a+b)*h/2 << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
#define SZ(x) ((ll).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}
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(a > b){ a=b; return 1; } return 0; }

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

  ll k, s;
  cin >> k >> s;
  ll ans = 0;
  for(ll i = 0; i <= k; i++){
    for(ll j = 0; j <= k; j++){
      ll z = s - (i + j);
      if(z >= 0 && z <= k){
        //cout << i << ' ' << j << endl;
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384