akhauriyash/Code-Regression huggingface dataset:
import sys
def side(p1,p2):
  global D
  y1,x1=p1
  y2,x2=p2
  dy=y2-y1
  dx=x2-x1
  for p3 in D[::-1]:
    if p1==p3 or p2==p3:continue
    y3,x3=p3
    if (x3-x1)*dy-dx*(y3-y1)<0:return 0
  else:return 1

while 1:
  n=input()
  if n==0:break
  D=sorted([list(input()) for i in range(n)])
  p=p1=D[0]
  D1=D[:]
  while True:
    for p2 in D1:
      if p1!=p2 and side(p1,p2):break
    p1=p2
    D1.remove(p2)
    if p2==p:break
  print len(D1)

Measured memory_bytes: 4276
fun main(args: Array<String>) {
    val (x, y, z) = readLine()!!.split(" ").map { it.toInt() }
    var l = (mutableListOf(0L) + readLine()!!.split(" ").map { it.toLong() }).toMutableList()
    var l2 = (mutableListOf(0L) + readLine()!!.split(" ").map { it.toLong() }).toMutableList()
    var a = 0
    for (i in 0 until x) {
        l[i + 1] = l[i] + l[i + 1]
    }
    for (i in 0 until y) {
        l2[i + 1] = l2[i] + l2[i + 1]
    }

    for (i in 0..x) {
        if (l[i] > z) continue
        val j = l2.binarySearch(z - l[i])
        if (j < 0) {
            a = Math.max(i - (j + 1) - 1, a)
        } else {
            a = Math.max(i + j, a)
        }
    }
    println(a)
}


Measured memory_bytes: 90960
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long lol;
typedef unsigned long long ull;
typedef __uint128_t bll;
struct FastMod {
	ull b, m;
	FastMod(ull b) : b(b), m(ull((bll(1) << 64) / b)) {}
	ull mod(ull a) {
		ull q = (ull)((bll(m) * a) >> 64);
		ull r = a - q * b; 
		return r >= b ? r - b : r;
	}
};
FastMod F(2);

const int N = 2e2 + 5;
int _w;

int fac[N] , binom[N][N];
int n , k , mod;
inline int pls( int a , int b ) { a += b - mod; return a + ( a >> 31 & mod ); }
inline int mns( int a , int b ) { a -= b; return a + ( a >> 31 & mod ); }
inline void inc( int & a , int b ) { a += b - mod; a += a >> 31 & mod; }
inline void dec( int & a , int b ) { a -= b; a += a >> 31 & mod; }

int _solve( int n , int m , int k ) {
  static int f[N][N];
  memset( f , 0 , sizeof f );
  f[0][0] = 1;
  for( int i = 1 , s ; i <= m ; ++i ) {
    s = 0;
    for( int j = 0 ; j < n ; ++j ) {
      inc( s , f[j][i - 1] );
      if( (m-i+1)+(j-1) <= k && (n-j)+(i-1) <= k ) 
        f[j][i] = s;
      else f[j][i] = 0;
    }
  }
  int res = 0;
  for( int i = 1 ; i <= n ; ++i )
    inc( res , f[i][m] );
  return res;
}

int solve( int n , int k ) {
  if( n == 1 ) return 1;
  int res = 0;
  for( int i = 1 ; i - 1 <= k && i <= n ; ++i ) 
    inc( res , _solve( i , n - i , k ) );
  res = F.mod( (ull)res * fac[n - 1] );
  return res;
}

int main( void ) {
  _w = scanf("%d%d%d",&n,&k,&mod);
  F = FastMod( mod );
  fac[0] = fac[1] = 1;
  for( int i = 0 ; i <= n ; ++i ) {
    binom[i][0] = 1;
    for( int j = 1 ; j <= i ; ++j )
      binom[i][j] = pls( binom[i - 1][j] , binom[i - 1][j - 1] );
  }
  for( int i = 2 ; i <= n ; ++i )
    fac[i] = F.mod( (ull)fac[i - 1] * i );
  int ans = 0;
  for( int i = 0 ; i <= k ; ++i )
    ans = F.mod( F.mod( (ull)binom[n][i] * fac[i] ) * solve( n - i , k - i ) + ans );
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 2152
import sys 
import numpy as np
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M, K = map(int, readline().split())
A = list(map(int,readline().split()))
B = list(map(int,readline().split()))
A_cum = [0] + list(np.cumsum(A))
B_cum = [0] + list(np.cumsum(B))
A_count = bisect.bisect_right(A_cum,K)
ans = 0
for a in range(A_count):
    t = K-A_cum[a]
    b = bisect.bisect_right(B_cum,t)
    b -=1
    ans = max(ans, a+b)
print(ans)

Measured memory_bytes: 61108
# AOJ 1518: Last One
# Python3 2018.7.13 bal4u

ans = 0;
for i in range(int(input())):
	p = input().split();
	if len(p) == 1: ms = []
	else: ms = list(p[1])
	s = 0
	for m in ms:
		if m.isdigit(): s += int(m)
		elif m.isupper(): s += ord(m)-ord('A')+10
		else: s += ord(m)-ord('a')+36
	ans ^= s
print("win" if ans else "lose")


Measured memory_bytes: 5620
n = gets.to_i
h = gets.split.map(&:to_i)
f = 1
max = 0
(h.length-1).times do |i|
  max = h[i] if max < h[i]
  if h[i]-h[i+1] >= 2 || max-h[i+1] >= 2 then
    print 'No'
    f = 0
    break
  end  
end
 
print 'Yes' if f == 1

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

const int L = 128;

int main() {
    string alphabet;
    for (int i = 0; i < 26; i++) alphabet.push_back('a' + i);
    for (int i = 0; i < 26; i++) alphabet.push_back('A' + i);
    for (int i = 0; i < 10; i++) alphabet.push_back('0' + i);
    auto query = [&](string s) {
        cout << "? " << s << endl; fflush(stdout);
        int x; cin >> x; return x;
    };
    vector<string> ans;
    int len = 0;
    for (char c : alphabet) {
        int tmp = L - query(string(L, c));
        len += tmp;
        if (tmp) ans.push_back(string(tmp, c));
    }
    auto chk = [&](string s) {
        return query(s) == len - s.length();
    };
    while (ans.size() > 1) {
        stable_sort(ans.begin(), ans.end(), [&](string x, string y) {
            return x.size() ^ y.size() ? x.size() < y.size() : x < y;
        });
        string s1 = ans[0], s2 = ans[1], s3;
        ans.erase(ans.begin()), ans.erase(ans.begin());
        int pos1 = 0, pos2 = 0;
        while (pos1 < s1.length() && pos2 < s2.length()) {
            string tmp = s3; tmp.push_back(s1[pos1]);
            for (int i = pos2; i < s2.length(); i++) tmp.push_back(s2[i]);
            if (chk(tmp)) s3.push_back(s1[pos1++]);
            else s3.push_back(s2[pos2++]);
        }
        while (pos1 < s1.length()) s3.push_back(s1[pos1++]);
        while (pos2 < s2.length()) s3.push_back(s2[pos2++]);
        ans.push_back(s3);
    }
    cout << "! " << ans[0] << endl; fflush(stdout);
    return 0;
}

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

using namespace std;
const int white = 0, gray = 1, black = 2, INF = -1;
using ll = long long;
const int SIZE = 1e5;
int n, color[SIZE], d[SIZE];
vector<int> G[SIZE];
vector<int> ans(SIZE);

void init(){
    for (int i = 0; i < n; i++)
    {
        color[i] = white;
        d[i] = INF;
    }
}

void bfs(int v){
    queue<int> q;
    q.push(v);
    d[v] = 0;
    int u;
    while (!q.empty())
    {
        u = q.front(); q.pop();
        for (auto &&i : G[u])
        {
            if (color[i] == white)
            {
                d[i] = d[u] + 1;
                q.push(i);
                color[i] = gray;
                ans[i] = u;
            }
        }
    color[u] = black;
    }
}
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int m; cin >> n >> m;
    rep(i, m){
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    bfs(0);
    cout << "Yes" << endl;
    rep(i, n-1)cout << ans[i+1]+1 << endl;
}

Measured memory_bytes: 11068
#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000

int main(){
  char buf[100010];

  fgets(buf,sizeof(buf),stdin);

  int N=strlen(buf);
  N--;
  int count=0;

  srep(i,1,N){
    if(buf[i-1]==buf[i]){
      if(buf[i-1]=='0'){
        buf[i]='1';
      }
      else{
        buf[i]='0';
      }
      count++;
    }
  }

  printf("%d\n", count);

  return 0;

}


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

int main(){
int N , A , B;
double X;
cin >> N;

X = N / 1.08;
A = ceil(X);
B = floor(A * 1.08);

if(B == N){
    cout << A << endl;
}
else{
    cout << ":(" << endl;
}

}

Measured memory_bytes: 256
import java.util.Scanner;

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

    int[][] a = new int[3][3];
    boolean[][] s = new boolean[3][3];
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        a[i][j] = scanner.nextInt();
      }
    }
    int N = scanner.nextInt();
    for (int i = 0; i < N; i++) {
      int b = scanner.nextInt();
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          if (a[j][k] == b) s[j][k] = true;
        }
      }
    }
    if (bingo(s)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  private static boolean bingo(boolean[][] s) {
    for (int i = 0; i < 3; i++) if (s[i][0] && s[i][1] && s[i][2]) return true;
    for (int i = 0; i < 3; i++) if (s[0][i] && s[1][i] && s[2][i]) return true;
    if (s[0][0] && s[1][1] && s[2][2]) return true;
    if (s[0][2] && s[1][1] && s[2][0]) return true;
    return false;
  }
}


Measured memory_bytes: 23764
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   boolean flg = false;
   for(int i = 1;i<=9;i++){
     for(int k = 1;k<=9;k++){
       if(A == i*k) {
         flg =true;
         break;
       }
     }
     if(flg) break;
   }
   if(flg)System.out.println("Yes");
   else System.out.println("No");
 }
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if ((a == b && a != c) || (a == c && b != c) || (b == c && a != b)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3592
import heapq

mod = 998244353

n = int(input())
robot = [tuple(map(int, input().split())) for _ in range(n)]
robot.sort(reverse=True)
parent = list(range(n))

root = []
for i in range(n):
  x, d = robot[i]
  while root:
    r = heapq.heappop(root)
    if r[0] < x + d:
      parent[r[1]] = i
    else:
      heapq.heappush(root, r)
      break
  heapq.heappush(root, (x, i))
  
count = 1
dp = [1] * n
for i in range(n):
  p = parent[i]
  if p == i:
    count = count * (dp[i] + 1) % mod
  else:
    dp[p] = dp[p] * (dp[i] + 1) % mod
print(count)

Measured memory_bytes: 47916
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

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

  vector<int> cnt(n + 1);
  rep(i, n - 1) {
    int a;
    cin >> a;
    cnt[a]++;
  }

  rep(i, n) {
    cout << cnt[i + 1] << endl;
  }
}

Measured memory_bytes: 4052
#include <cstdio>
#include <vector>

using namespace std;

struct Dice {
    int face[6];
    const int dir[5][6]={
        {1, 5, 2, 3, 0, 4},
        {3, 1, 0, 5, 4, 2},
        {4, 0, 2, 3, 5, 1},
        {2, 1, 5, 0, 4, 3},
        {0, 2, 4, 1, 3, 5}
    };
    const char dchars[6]="NESWY";
    int encode[256]={};
    Dice(int f[6]) {
        for (size_t i=0; i<6; ++i)
            face[i] = f[i];

        for (size_t i=0; i<5; ++i)
            encode[dchars[i]+0] = i;
    }
    void roll(char d) {
        int tmp[6]={};
        for (size_t i=0; i<6; ++i)
            tmp[i] = face[i];

        for (size_t i=0; i<6; ++i)
            face[i] = tmp[dir[encode[d+0]][i]];
    }
    void yaw() {
        roll('Y');
    }
    void flip() {
        roll('N'), roll('N');
    }
    int top() {
        return face[0];
    }
    int front() {
        return face[1];
    }
    int right() {
        return face[2];
    }
    int back() {
        return face[3];
    }
    int left() {
        return face[4];
    }
    int bottom() {
        return face[5];
    }
    bool operator==(const Dice d2) {
        for (size_t i=0; i<6; ++i)
            if (face[i] != d2.face[i])
                return false;

        return true;
    }
    bool equals(Dice d2) {
        for (int i=0; i<4; ++i) {
            for (int j=0; j<4; ++j) {
                d2.yaw();
                if (*this == d2) return true;
            }
            d2.roll('N');
        }
        d2.roll('E');
        for (int j=0; j<4; ++j) {
            d2.yaw();
            if (*this == d2) return true;
        }
        d2.flip();
        for (int j=0; j<4; ++j) {
            d2.yaw();
            if (*this == d2) return true;
        }

        return false;
    }
};

int main() {
    size_t n;
    scanf("%zu", &n);

    vector<Dice> d;
    for (size_t i=0; i<n; ++i) {
        int f[6];
        for (size_t j=0; j<6; ++j)
            scanf("%d", &f[j]);

        d.push_back(Dice(f));
        for (size_t j=0; j<i; ++j)
            if (d[i].equals(d[j]))
                return !printf("No\n");
    }

    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 2780
import Control.Applicative
import Control.Monad
import Data.List
import Data.Bool (bool)

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n getLine >>= putStrLn

solve :: [String] -> String
solve = maybe "NO" (bool "NO" "YES" . (== 0)) . foldl' f (Just 0)
  where
    f Nothing _ = Nothing
    f (Just x) "A" = Just (x + 1)
    f (Just x) "Un"
      | x > 0 = Just (x - 1)
      | otherwise = Nothing



Measured memory_bytes: 3768
#include <stdio.h>

int main(){
	int a, b;
	char op;

	while (1){
		scanf("%d %c %d", &a, &op, &b);

		if (op == '?'){
			return 0;
		}
		if (op == '+'){
			printf("%d\n", a + b);
		}
		if (op == '-'){
			printf("%d\n", a - b);
		}
		if (op == '*'){
			printf("%d\n", a * b);
		}
		if (op == '/'){
			printf("%d\n", a / b);
		}
	}
}

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

int res = -1e9;
int n;
vector <int> v;
vector <int> c;

void dfs(int idx,int x,int y)
{
	if(idx==n)
	{
		res = max(res,x-y);
		return;
	}
	else
	{
		dfs(idx+1,x+v[idx],y+c[idx]);
		dfs(idx+1,x,y);
	}
}

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

	int t;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}

	for(int i=0;i<n;i++)
	{
		cin >> t;
		c.push_back(t);
	}

	dfs(0,0,0);

	cout << res << '\n';

	return 0;
}

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

int main() {
    int H, W;
    while (cin >> H >> W, H | W) {
        string s(W, '#');
        for (int i = 0; i < H; i++) {
            cout << s << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
ll mod=1e9+7,K[200001];
ll inv(ll a){
    ll n=mod-2,ans=1;
    while(n>0){
        if(n&1) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
ll nCm(ll n,ll m){
    return K[n]*inv(K[m])%mod*inv(K[n-m])%mod;
}
int main(){
    ll n,a,b,c;
    cin>>n>>a>>b>>c;
    ll Pa=0,Pb=0,P,A[200001],B[200001],AB[200001];
    K[0]=1;A[0]=1;B[0]=1;AB[0]=1;
    rep(i,200000) K[i+1]=K[i]*(i+1)%mod,A[i+1]=A[i]*a%mod,B[i+1]=B[i]*b%mod,AB[i+1]=AB[i]*(a+b)%mod;
    rep(i,n) Pa=(Pa+nCm(n+i-1,i)%mod*A[n]%mod*B[i]%mod*AB[n-i]%mod*(n+i)%mod)%mod;
    rep(i,n) Pb=(Pb+nCm(n+i-1,i)%mod*B[n]%mod*A[i]%mod*AB[n-i]%mod*(n+i)%mod)%mod;
    P=(Pa+Pb)%mod;
    P=P*100%mod*inv(100-c)%mod;
    cout<<P*inv(AB[2*n])%mod<<"\n";
}

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

using namespace std;

int main(){
    string S;
    cin >> S;
    int K;
    cin >> K;
    int n = S.length();
    long dp[n+1][2][K+1];
    for(int i=0; i<n+1; i++){
        for(int s=0; s<2; s++){
            for(int j=0; j<K+1; j++){
                dp[i][s][j] = 0;
            }
        }
    }
    dp[0][0][0] = 1;
    for(int i=1; i<n+1; i++){
        int n = S[i-1] - '0';
        for(int j=0; j<K+1; j++){
            for(int s=0; s<2; s++){
                for(int x=0; x<=(s? 9 : n); x++){
                    if(j!=0)  dp[i][s || x < n][j] += dp[i-1][s][x==0 ? j : j-1];
                    else      dp[i][s || x < n][0] += (x == 0 ? dp[i-1][s][0] : 0) ;
                }
            }
        }
    }
    cout << dp[n][1][K] + dp[n][0][K] << endl;
    return 0;
}


Measured memory_bytes: 256
import math
import sys

def is_prime(x):
    if x == 1: return 0
    elif x == 2: return 1
    elif x % 2 == 0: return 0

    n = 3
    while n <= math.sqrt(x):
        if x % n == 0:
            return 0
        n += 2
    return 1

n = int(raw_input())
count = 0
for i in range(n):
    x = int(raw_input())
    count += is_prime(x)

print count


Measured memory_bytes: 4868
use std::io::Read;

fn main() {
    let mut line = String::new();
    std::io::stdin().read_to_string(&mut line).unwrap();
    let mut it = line.split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: usize = it.next().unwrap().parse().unwrap();
    let h: Vec<i64> = it.by_ref().take(n).map(|a|a.parse().unwrap()).collect();
    let mut g: Vec<Vec<usize>> = vec![Default::default(); n];

    for _ in 0..m {
        let a: usize = it.next().unwrap().parse().unwrap();
        let b: usize = it.next().unwrap().parse().unwrap();
        g[a - 1].push(b - 1);
        g[b - 1].push(a - 1);
    }
    let mut ans = 0;
    for i in 0..n {
        let mut ok = true;
        for &vec in &g[i] {
            if h[i] <= h[vec] {
                ok = false;
                break;
            }
        }
        if ok {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 10616
#include <iostream>
using namespace std;
int main(void)
{
  int i = 1;
  while (1)
  {
    int x;
    cin >> x;

    if (x == 0)
    {
      break;
    }
    cout << "Case" <<" " <<i << ": " << x << endl;
    i++;
  }

  return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

string S;
ll BC[200010] = {};
int main(){
    cin >> S;
    int N = S.size();
    if(N<=2){
        cout << 0 << endl;
        return 0;
    }
    ll bc = 0;
    ll ans = 0;
    int i = N-2;
    while(i>=0){
        if(S[i]=='A'){
            if(S[i+1]!='C'){
                ans += bc;
                i--;
            }else{
                bc = 0;
                i--;
            }
        }else if(S[i]=='B'){
            if(S[i+1]=='C'){
                bc++;
                i--;
            }else{
                bc = 0;
                i--;
            }
        }else{
            if(S[i+1]=='C'){
                bc = 0;
            }
            i--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
#include <iostream>
 #include<stdio.h>
 #include<math.h>
 #include<string.h>
using namespace std;

int main() {
   long long int t,n,i,j,k,l,a,b,c,d,ans=0;
   //  int a[100001];
     char s[100001];
     vector<int> v;
     scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    ans=max(a*c,max(a*d,max(b*c,b*d)));
    printf("%lld",ans);
	
	return 0;
}


Measured memory_bytes: 3824
#include <stdio.h>
#include <stdlib.h>
 
struct node{
  struct node *par;
  struct node *left;
  struct node *right;
  int key;
};
typedef struct node* NodePointer;
 
void init(void);
NodePointer makenode(int);
void insert(int,NodePointer);
void preorder(NodePointer);
void inorder(NodePointer);
NodePointer find(int,NodePointer);
void delete_node(NodePointer); 
NodePointer tree_successor(NodePointer);
NodePointer tree_minimum(NodePointer);

NodePointer head, tail;
 
int main(){
  char str[7];
  int n,k;
  NodePointer x;
 
  init();
  scanf("%d" ,&n);
  while(n--){
    scanf("%s" ,str);
 
    if(str[0] == 'i'){
      scanf("%d" ,&k);
      insert(k, head);
    }else if(str[0] == 'p'){
      inorder(head->right);
      puts("");
      preorder(head->right);
      puts("");
    }else if(str[0] == 'f'){
      scanf("%d" ,&k);
      if(find(k,head->right) != NULL){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }else{
      scanf("%d" ,&k);
      x = find(k,head->right);
      delete_node(x);
    }
  }
 
  return 0;
}
 
void init(){
  head = makenode(-1);
  tail = makenode(-1);
  head->par = head;;
  head->right = tail;
  head->left = tail;
}
 
NodePointer makenode(int k){
  NodePointer x;
 
  x = malloc(sizeof(struct node));
  x->key = k;
  x->left = x->right = tail;
 
  return x;
}
 
void insert(int k, NodePointer p){
  if(k < p->key){
    if(p->left == tail){
      p->left = makenode(k);
      p->left->par = p;
    }else{
      insert(k,p->left);
    }
  }else{
    if(p->right == tail){
      p->right = makenode(k);
      p->right->par = p;
    }else{
      insert(k,p->right);
    }
  }
}
 
void preorder(NodePointer node){
  if(node != tail){
    printf(" %d", node->key);
    preorder(node->left);
    preorder(node->right);
  }
}
 
void inorder(NodePointer node){
  if(node != tail){
    inorder(node->left);
    printf(" %d", node->key);
    inorder(node->right);
  }
}
 
NodePointer find(int k,NodePointer node){
  if(node == tail){
    return NULL;
  }
 
  if(node->key == k){
    return node;
  }else if(node->key < k){
    return find(k,node->right);
  }else{
    return find(k,node->left);
  }
}

void delete_node(NodePointer node){
  NodePointer x,y;
  if(node->left == tail || node->right == tail){
    y = node;
  }else{
    y = tree_successor(node);
  }

  if(node->left != tail){
    x = y->left;
  }else{
    x = y->right;
  }

  if(x != tail){
    x->par = y->par;
  }
  if(y->par == tail){
    node->par = x;
  }else if(y == y->par->left){
    y->par->left = x;
  }else{
    y->par->right = x;
  }

  if(y != node){
    node->key = y->key;
  }
}

NodePointer tree_successor(NodePointer x){
  NodePointer y;

  if(x->right != tail){
    return tree_minimum(x->right);
  }

  y = x->par;
  while(y != tail && x == y->right){
    x = y;
    y = y->par;
  }

  return y;
}

NodePointer tree_minimum(NodePointer x){
  while(x->left != tail){
    x = x->left;
  }
  return x;
}

Measured memory_bytes: 19360
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
void small_size(void);
void middle_size(void);
void big_size(void);
void solve(void);

int x,y,size;
int paper[14][14]={0};

int main(){

  while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){
    switch(size){
    case 1:
      small_size();
      break;
    case 2:
      small_size();
      middle_size();
      break;
    case 3:
      small_size();
      middle_size();
      big_size();
      break;
    }

  }

  solve();

  return 0;
}

void small_size(){

  paper[y+2][x+2]++;
  paper[y+1][x+2]++;
  paper[y+2][x+1]++;
  paper[y+2][x+3]++;
  paper[y+3][x+2]++;

}
void middle_size(){

  paper[y+1][x+1]++;
  paper[y+3][x+1]++;
  paper[y+1][x+3]++;
  paper[y+3][x+3]++;

}

void big_size(){

  paper[y+2][x]++;
  paper[y][x+2]++;
  paper[y+2][x+4]++;
  paper[y+4][x+2]++;

}

void solve(){

  int i,j;
  int zero_cnt=0;
  int max=0;

  for(i=2;i<12;i++){
    for(j=2;j<12;j++){

      if(paper[i][j]==0){
	zero_cnt++;
      }

      if(max<paper[i][j]){
	max=paper[i][j];
      }
    }
  }

  printf("%d\n%d\n",zero_cnt,max);

}

Measured memory_bytes: 1188
#include <vector>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <set>
#include <map>
using namespace std;
typedef long long ll;


int main() {
  ll n, p;
  cin >> n >> p;
  map<ll, int> m;
  for (ll i = 2; i * i <= p; i++) {
    while (p % i == 0) {
      m[i]++;
      p /= i;
    }
  }
  ll ans = 1;
  for (auto e: m) {
    ll a = e.second / n;
    while (a--) {
      ans = ans * e.first;
    }
  }

  if (n == 1) ans = ans * p;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main
import(
	"fmt"
	"bufio"
	"os"
)

func main(){
	stdin:=bufio.NewReader(os.Stdin)
	var x,y int
	x=1
	y=1
	for ;x!=0||y!=0;{
		fmt.Fscan(stdin,&x,&y)
		if x!=0||y!=0{
			if(x>y){
				temp:=x
				x=y
				y=temp
			}
			fmt.Printf("%d %d\n",x,y)
		}
	}
}


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

int n;
int a[105][2] = {0};

int solve();

int main() {
  cin >> n;
  for(int j = 0; j < 2; ++j)
    for(int i = 0; i < n; ++i) cin >> a[i][j];
  cout << solve() << endl;
  return 0;
}

int solve() {
  int ans = 0;
  for(int j = 0; j < 2; ++j)
    for(int i = 1; i < n; ++i) a[i][j] += a[i - 1][j];
  for(int i = 0; i < n; ++i) {
    int now = a[n - 1][1] + a[i][0];
    if(i != 0) now -= a[i - 1][1];
    ans = max(ans, now);
  }
  return ans;
}

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

int par[100002];  // 親
int Rank[100002]; // 木の深さ
int size[100002]; // 木の要素数
int ans;

void init(int n){
	for(int i=0; i<n; i++){
		par[i] = i;
		Rank[i] = 0;
		size[i] = 1;
	}
}

int find(int x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(Rank[x] < Rank[y]){
		par[x] = y;
		size[y] += size[x];
		ans--;
	}else{
		par[y] = x;
		size[x] += size[y];
		if(Rank[x] == Rank[y]) Rank[x]++;
		ans--;
	}
}

bool same(int x, int y){
	return find(x) == find(y);
}

int main(){
	int N, M;
	cin >> N >> M;
	init(N);
	ans = N;
	for(int i=0; i<M; i++){
		int x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		unite(x, y);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
	int Alice, Bob;
	cin >> Alice >> Bob;

	if (Alice == 1)Alice = 14;
	if (Bob == 1)Bob = 14;

	if (Alice > Bob)cout << "Alice" << endl;
	else if (Alice < Bob) cout << "Bob" << endl;
	else cout << "Draw" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    int A = scanner.nextInt();
		    int B = scanner.nextInt();
		    int C = scanner.nextInt();
		    
		    if(B -A == C - B ) 
		    {
		    	System.out.println("YES");
		    }
		    else
		    {
		    	System.out.println("NO");
		    }
		    scanner.close(); }
		  }

Measured memory_bytes: 21844
import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b,x=map(int, readline().rstrip().split())
    if a%x==0:
        f=a
    else:
        f=a-a%x+x
        if f > b:
            print(0)
            return
    if b%x==0:
        t=b
    else:
        t=b-b%x
        if t<a:
            print(0)
            return
    print((t-f)//x+1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

Measured memory_bytes: 5624
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

struct rng {
    struct A {
        int n;
        const bool operator!=(A r) { return n != r.n; }
        A& operator++() { n++; return *this; }
        int operator*() { return n; }
    };
    int l, r;
    rng(int r) : l(0), r(max(0, r)) {}
    rng(int l, int r) : l(l), r(max(l, r)) {}
    A begin() { return A{l}; }
    A end() { return A{r}; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
    ll n, m;
    cin >> n >> m;
    ll z = 1900 * m + 100 * (n-m);
    for (int i: rng(m)) z *= 2;
    cout << z << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll a[100010], b[100010], c[100010];
int main(){
  int n;
  while(cin>>n){
    for(int i=0; i<n; ++i){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a, a+n);
    sort(b, b+n);
    reverse(b, b+n);
    for(int i=0; i<n; ++i){
        if(i%2){
            c[i]=a[i/2];
        }
        else{
            c[i]=b[i/2];
        }
    }
    ll ans=0;
    for(int i=0; i+1<n; ++i){
        ans+=abs(c[i]-c[i+1]);
    }
    ll tmp1=n-2, tmp2=n-1, tmp=ans, tmp3=0;
    for(int i=0; i<n; ++i){
        tmp=tmp-abs(c[tmp1]-c[tmp2])+abs(c[tmp2]-c[tmp3]);
        ans=max(ans, tmp);
        tmp1=(tmp1-1+n)%n;
        tmp2=(tmp2-1+n)%n;
        tmp3=(tmp3-1+n)%n;
    }
    for(int i=0; i<n; ++i){
        if(i%2==0){
            c[i]=a[i/2];
        }
        else{
            c[i]=b[i/2];
        }
    }
    ll ans1=0;
    for(int i=0; i+1<n; ++i){
        ans1+=abs(c[i]-c[i+1]);
    }
    tmp1=n-2, tmp2=n-1, tmp=ans1, tmp3=0;
    for(int i=0; i<n; ++i){
        tmp=tmp-abs(c[tmp1]-c[tmp2])+abs(c[tmp2]-c[tmp3]);
        ans1=max(ans1, tmp);
        tmp1=(tmp1-1+n)%n;
        tmp2=(tmp2-1+n)%n;
        tmp3=(tmp3-1+n)%n;
    }
    ans=max(ans, ans1);
    cout<<ans<<endl;
  }
  return 0;
}




Measured memory_bytes: 2560
#include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;


    bool compare_first(pair<ll,ll >a,pair<ll,ll >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }


    ll min(ll a,ll b)
    {
        if(a>b)return b;
        return a;
    }


    int main() {
      ios::sync_with_stdio(false);



int a,b,h;
cin>>a>>b>>h;

cout<<(a+b)*h/2<<endl;








return 0;
    }


/*

 }
 */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};

using namespace std;

int main(){
    int n;
    cin >> n;
    double ans = 0;
    rep(i,n){
        double a;
        cin >> a;
        ans += 1/a;
    }
    printf("%.10f",1/ans);
    
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    int count;
    if(n%x==0)
    {
        count=n/x;
    }
    else{
        count=n/x;
        count++;
    }
    
    cout<<count*t;

    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n==111)cout<<999;
	if(n==119)cout<<991;
	if(n==191)cout<<919;
	if(n==911)cout<<199;
	if(n==991)cout<<119;
	if(n==199)cout<<911;
	if(n==919)cout<<191;
	if(n==999)cout<<111;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
# N <= 10^5
# a = 10^9
A = Counter([int(x) for x in input().split()])

r = 0
for x, c in A.items():
    if x == c:
        continue
    elif x < c:
        r += c - x
    elif x > c:
        r += c
print(r)





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

#define REP(i, a, n) for(int i=a; i<n; i++) //(i, 0, n)でi=0~n-1までn回
#define REPn(i, a, n) for(int i=a; i<=n; i++) //(i, 1, n)でi=1~nまでn回
#define sorts(v) sort(v.begin(), v.end());
#define sortg(v) sort(v.begin(), v.end(), greater<>());
#define rev(v) reverse(v.begin(), v.end()); //逆順に並べ替え

int main() {
  int n, cnt=1, h=0;
  cin >> n;
  vector<int> v(n);
  REP(i, 0, n) cin >> v.at(i);
  REP(i, 0, n-1){
    h = max(h, v[i]);
    if(h<=v.at(i+1))cnt++;
  }
  cout << cnt << endl;
}

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

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	bool IsPossibleK = false;

	int num_black = 0;
	for (int j = 0 ; j <= M; j++)
		for (int i = 0; i <= N; i++) {
			num_black = i * M + j * N - 2 * i * j;
			if (num_black == K) {
				IsPossibleK = true;
				break;
			}
		}
	if (IsPossibleK) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int a[15000];
int main()
{
	int S, min = 99999999, max = -99999999;
	long long int sum = 0;
	scanf(" %d", &S);
	for (int i = 0; i < S; ++i)
	{
		scanf(" %d", &a[i]);
	}
	for (int i = 0; i < S; ++i)
	{
		sum += a[i];
		if (max < a[i]) {
			max = a[i];
		}
		if (min > a[i]) {
			min = a[i];
		}
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
 
#define N 200
#define BLACK 2
#define WHITE 0
#define GRAY  1
 
int n = 0;
int z = 0;
int G[N][N];
int d[N];
int f[N];
int color[N];

void DFSvisit(int);
void DFS();
   
main(){
  int i,j,s,v,r;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      G[i][j] = 0;
    }
  }
  for(i = 0; i < n; i++){
    scanf("%d%d", &v,&r);
    for(j = 0; j < r; j++){
      scanf("%d",&s);
      G[i][s - 1] = 1;
    }
  }
  DFS();
  for(i = 0; i < n; i++){
    printf("%d %d %d\n",i+1, d[i], f[i]);
  }
  return 0;
}

void DFSvisit(int u){
  int t;
  color[u] = GRAY;
  d[u] = ++z;
  for(t = 0; t < n; t++){
    if(G[u][t] == 1 && color[t] == WHITE){
      DFSvisit(t);
    }
  }
  color[u] = BLACK;
  f[u] = ++z;
}

void DFS(){
  int u,z = 0;
  for(u = 0; u < n; u++){
    color[u] = WHITE;
  }
  for(u = 0; u < n; u++){
    if(color[u] == WHITE){
      DFSvisit(u);
     }
  }
}  

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

using namespace std;

int main()
{
	int t;
	t=1;
	while(t--)
	{
	
	
      long long int n,i,j,k,sum,a[300000];
      
      cin>>n;
      
      
      for(i=0;i<n;i++)
      cin>>a[i];
	  
	  k=0;
	  sum=0;
	  k=a[0];
	  for(i=1;i<n;i++)
	  {
	  	k=max(k,a[i]);
	  	if(a[i]<k)
	  	{
	  		sum=sum+k-a[i];
	  		
		  }
	  	
      }
	  
	  
	  cout<<sum<<"\n"; 
	
	}



}


Measured memory_bytes: 5196
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}




int main() {
	ll W, H, N,an=0;
	cin >> W >> H >> N;
	vector<vector<int>> vec(W, vector<int>(H));
	rep(i, W) {
		rep(j, H) {
			vec.at(i).at(j) = 1;
		}
	}
	rep(k, N) {
		ll X, Y, A;
		cin >> X >> Y >> A;
		if (A == 1) {
			rep(j, H) {
				rep(i, X) {
					vec.at(i).at(j) = 0;
				}
			}
		}
		if (A == 2) {
			rep(j, H) {
				for (ll i = X; i < W; i++) {
					vec.at(i).at(j) = 0;
				}
			}
		}
		if (A == 3) {
			rep(j, Y) {
				rep(i, W) {
					vec.at(i).at(j) = 0;
				}
			}
		}
		if (A == 4) {
			rep(i, W) {
				for (ll j = Y; j < H; j++) {
					vec.at(i).at(j) = 0;
				}
			}
		}

		






	}


	rep(i, W) {
		rep(j, H) {
			an += vec.at(i).at(j);

		}
		
	}
	
	
	cout << an << endl;
	
	}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const ll MOD = 1e9+7;
const int INF = 1001001001;
// const ll INF = 1000000000000000000LL;
 
 //使い方
 int main() {
     ll n,m;
     cin >> n >> m;
     ll ans = 1;
     for(int i=m/n;i>1;i--){
         if(m%i!=0) continue;
         if(i*n<=m){
             ans = i;
             break;
         }
     }
     cout << ans << endl;
     return 0;
 }

Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define repr(i, a, n) for (ll i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  string a, b;
  cin >> a >> b;
  int x = stoi(a + b);
  rep(i, 1, 10000) {
    if (i * i == x) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // CとC++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean ans = IntStream.range(1,10).anyMatch(i -> N % i == 0 && N / i <= 9);
        System.out.println(ans ? "Yes" : "No");
    }
}

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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

int n, m;
vector<int> g[MAXN];
int dp[MAXN];

bool read() {
    if (!(cin >> n >> m))
        return false;

    forn (i, m) {
        int u, v;
        cin >> u >> v;
        g[u - 1].pb(v - 1);
    }

    return true;
}

void dfs(int v) {
    dp[v] = 1;
    
    for (auto to : g[v]) {
        if (dp[to] == 0)
            dfs(to);

        dp[v] = max(dp[v], 1 + dp[to]);
    }
}

void solve() {
    forn (i, n)
        if (dp[i] == 0)
            dfs(i);

    cout << *max_element(dp, dp + n) - 1 << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 31104
fun main(args: Array<String>) {
    val (n, m) = readIntegerList()
    if (n == m) {
        println("Yes")
    } else {
        println("No")
    }
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 37872
#include <iostream>

 

using namespace std;

 

int main()
{
    int a ,b, temp, i;
    for(i=1; i<=3000; i++)
    {
        cin >> a >> b;
        if(a==0 && b==0)
            break;
            
        if(a > b)
        {
            a = a+b;
            b = a-b;
            a = a-b;
        }
        cout << a << " " << b << endl;
    }
}


Measured memory_bytes: 3052
import sys
input = sys.stdin.readline
n = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))

B = [[-1] * n for i in range(4)]

B[0][0] = T[0]
B[1][0] = T[0]+1

for i in range(1, n):
    if T[i] == T[i-1]:
        B[0][i] = 1
        B[1][i] = T[i] + 1
    elif T[i] > T[i-1]:
        B[0][i] = T[i]
        B[1][i] = T[i] + 1

B[2][n-1] = A[-1]
B[3][n-1] = A[-1]+1

for i in range(n-2, -1, -1):
    if A[i] == A[i+1]:
        B[2][i] = 1
        B[3][i] = A[i] + 1
    elif A[i] > A[i+1]:
        B[2][i] = A[i]
        B[3][i] = A[i] + 1

# print(B)

ans = 1
mod = 10**9+7
for i in range(n):
    ans = (ans * max(0, min(B[1][i], B[3][i]) - max(B[0][i], B[2][i]))) % mod
print(ans)

Measured memory_bytes: 75876
/*
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  for (int tn = 1;; tn++) {
    int x;
    cin >> x;
    if (x == 0) break;

    printf("Case %d: %d\n", tn, x);
  }
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,m;
    cin>>n>>m;
    Vec a(n);
    rep(i,n){
        cin>>a[i];
    }
    m *= 2;
    ll x = a[0];
    REP(i,1,n){
        ll g = __gcd(x,a[i]);
        x *= a[i];
        x /= g;
        if(x>m){
            cout<<0<<endl;
            return 0;
        }
    }

    ll gc = a[0];
    REP(i,1,n){
        gc = __gcd(gc,a[i]);
    }

    rep(i,n){
        ll tmp;
        tmp = x/a[i];
        if(tmp %2==0){
            cout<<0<<endl;
            return 0;
        }
    }

    ll ans= m/x;
    ans = (ans+1)/2;

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


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

int main()
{
    int x, y, z, k, s, c = 0;
    cin >> k >> s;
    for (x = 0; x <= k; x++) {
        for (y = 0; (x + y) <= s && y <= k; y++) {
            z = s - (x + y);
            if (z <= k) {
                c++;
            }
        }
    }
    cout << c << '\n';
  	return 0;
}


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

using namespace std;

int gcd(int a,int b);

int main(){
    int a,b;
    cin>>a>>b;
    int answer = gcd(a,b);
    cout<<answer<<endl;
}

int gcd(int a,int b){
    if(a >= b){
        if (a%b==0) {
            return b;
        }
        return gcd(a%b , b);
    }
    else{
        if (b%a==0) {
            return a;
        }
        return gcd(a,b%a);
    }
}

Measured memory_bytes: 1164
h,w,k=map(int,input().split())
ans = 0
def get(sta):
    ret = set()
    for i in range(6):
        if sta & 1:
            ret.add(i)
        sta //= 2
    return ret
grd=[input() for i in range(h)]
for i in range(2**h):
    hs=get(i)
    for j in range(2**w):
        ws=get(j)
        chk = 0
        for a in range(h):
            for b in range(w):
                if a in hs or b in ws or grd[a][b]==".":continue
                chk += 1
        if chk == k:
            ans += 1
print(ans)

Measured memory_bytes: 9196
#include<iostream>

int main(){

	int n;
	std::cin >> n;

	for (int i = 0; i < n; i++){

		float x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		if (((y2 - y1) / (x2 - x1)) == ((y4 - y3) / (x4 - x3)))std::cout << "YES" << std::endl;
		else std::cout << "NO" << std::endl;
	}

	return 0;
}

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

// Inserted snippets: euclid, io, modint, opt, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
ll euclid(ll a, ll b, ll &x, ll &y) {
	if (b) { ll d = euclid(b, a % b, y, x);
		return y -= a/b * x, d; }
	return x = 1, y = 0, a;
}
template<int MOD>
struct Mod {
	ll x;
	Mod() : x(0) {}
	Mod(ll xx) : x(xx) {}
	Mod operator+(Mod b) { return Mod((x + b.x) % MOD); }
	Mod operator-(Mod b) { return Mod((x - b.x + MOD) % MOD); }
	Mod operator*(Mod b) { return Mod((x * b.x) % MOD); }
	Mod operator/(Mod b) { return *this * invert(b); }
	Mod invert(Mod a) {
		ll x, y, g = euclid(a.x, MOD, x, y);
		assert(g == 1); return Mod((x + MOD) % MOD);
	}
	Mod operator^(ll e) {
		if (!e) return Mod(1);
		Mod r = *this ^ (e / 2); r = r * r;
		return e&1 ? *this * r : r;
	}
};
#pragma gcc optimize("Ofast")
#pragma gcc target("avx2")
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	Mod<10001> a, b;
	read(a.x, b.x);
	die((a*b).x);
}


Measured memory_bytes: 3580