akhauriyash/Code-Regression huggingface dataset:
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P) :
 P = sorted(P)
 phU = []
 phU.append(P[0])
 phU.append(P[1])
 for p in P[2:] :
  phU.append(p)
  if isCLKWISE(phU) : continue
  while(True):
   del phU[-2]
   try:
    if isCLKWISE(phU) : break
   except IndexError : break
 phL = []
 phL.append(P[-1])
 phL.append(P[-2])
 for p in P[-3::-1] :
  phL.append(p)
  if isCLKWISE(phL) : continue
  while(True) :
   del phL[-2]
   try:
    if isCLKWISE(phL) : break
   except IndexError : break
 del phL[0]
 del phL[-1]
 ph = phU + phL
 return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])

Measured memory_bytes: 33276
main:: IO ()
main = do
  nc<-getLine
  let n = read nc ::Integer
  print (solver n)

solver::Integer -> Integer
solver x = let turn_56 = (div x 11)*2 in
           let rest    =  mod x 11    in
           if x == 0 then 0 else (turn_56 + if rest == 0 then 0 else if rest <= 6 then 1 else 2)

Measured memory_bytes: 508
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct UnionFind{
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unionSet(int x,int y){
        x=root(x);y=root(y);
        if(x==y)return 0;
        if(data[y]<data[x])swap(x,y);
        data[x]+=data[y],data[y]=x;
        return 1;
    }
    bool findSet(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0 ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};
class KRK{//c++11
	public:
	struct edge{
		int from,to;
		double cost;
	};
	vector<edge>G;
	int n;
	KRK(int size){
		n=size;
	}
	void add_edge(int a,int b,double c){
		edge e={a,b,c};
		G.pb(e);
	}
	double krk(){
		double sum=0;
		sort(all(G),[](edge a,edge b){
			return a.cost>b.cost;
		});
		UnionFind uf(n);
		rep(i,G.size()){
			edge e=G[i];
			if(!uf.findSet(e.from,e.to)){
				sum+=e.cost;
				uf.unionSet(e.from,e.to);
			}
		}
		return sum;
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	KRK krk(n);
	vi x(n),y(n);
	rep(i,n)cin>>x[i]>>y[i];
	double sum=0;
	while(m--){
		int a,b;
		cin>>a>>b;
		a--;b--;
		double cost=hypot(x[a]-x[b],y[a]-y[b]);
		sum+=cost;
		krk.add_edge(a,b,cost);
	}
	cout<<shosu(9)<<sum-krk.krk()<<endl;
}









Measured memory_bytes: 3608
N = int(input())
A_list = [int(e) for e in input().split()]

A_dict = dict()
S = 0

for A in A_list:
    if A not in A_dict:
        A_dict[A] = 0
        
    A_dict[A] += 1
    S += A

Q = int(input())

for i in range(1,Q+1):
    B,C = map(int, input().split())
    
    if B in A_dict:
        if C not in A_dict:
            A_dict[C] = A_dict[B]
        else:
            A_dict[C] += A_dict[B]
            
        S -= B*A_dict[B]
        S += C*A_dict[B]

        A_dict[B] = 0
        
    print(S)

Measured memory_bytes: 20440
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#include<cstdio>
#define curr(P, i) P[(i) % P.size()]
#define next(P, i) P[(i+1) % P.size()]
#define prev(P, i) P[(i+P.size()-1) % P.size()]

using namespace std;

double EPS = 1e-10;
const double PI = acos(-1);

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

};

double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

point intersection_ls(point a1, point a2, point b1, point b2) {
  point b = b2-b1;
  double d1 = abs(cross(b, a1-b1));
  double d2 = abs(cross(b, a2-b1));
  double t = d1 / (d1 + d2);

  return a1 + (a2-a1) * t;
}

int main(void){

  int q;
  cin >> q;
  while(q--){
    point a,b,c,d;
    cin >> a.x >> a.y >> b.x >> b.y;
    cin >> c.x >> c.y >> d.x >> d.y;
    point res=intersection_ls(a,b,c,d);
    printf("%.10f %.10f\n",res.x,res.y);
  }
  return 0;
}

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

int main() {

    int n;
    cin >> n;

    int t[n];

    int sum = 0;

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

    int m;

    cin >> m;

    int p[m],x[m];

    for(int i=0; i<m; i++){
        cin >> p[i] >> x[i];
    }

    for(int i=0; i<m; i++){
        cout << sum-t[p[i]-1]+x[i] << endl;
    }

    return 0;
}

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

N, A, B = MAP()
print(min(A*N, B)) 

Measured memory_bytes: 5200
def main():
    N = int(input())
    MOD = 10**9 + 7

    def Eratosthenes(sup: int) -> set:
        from math import sqrt
        primes = {i for i in range(2, sup+1)}
        for i in range(2, int(sqrt(sup+1))+1):
            if i in primes:
                mul = 2
                while i*mul <= sup:
                    primes.discard(i*mul)
                    mul += 1
        return primes

    ps = Eratosthenes(N)
    ans = 1
    for p in ps:
        cur = 0
        i = 1
        while N//(p**i) > 0:
            cur += N//(p**i)
            i += 1
        ans *= (cur+1)
        ans %= MOD
    print(ans % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38640
import java.util.*;
public class Main{
    public static void main(String[]args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);
    int[] age;
    int n;

    void run(){
	while(sc.hasNext()){
	    n = sc.nextInt();
	    age = new int[7];
	    if(n!=0) solve();
	}
    }

    void solve(){
	while(n>0){
	    n--;
	    int a = sc.nextInt();
	    if(a>=60){
		age[6]++;
	    }
	    else age[a/10]++;
	}
	for(int i=0; i<7; i++)
	    System.out.println(age[i]);
    }
}

Measured memory_bytes: 209264
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func MinInt(A ...int32) int32 {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}

func Solve() {
  S := NextLine()
  N := len(S)
  W := make([][]int, 26)
  for i := range W {
    W[i] = make([]int, N)
  }
  for i, s := range S {
    W[int(s - rune('a'))][i]++
  }
  for i := range W {
    for j := range W[i][1:] {
      W[i][j + 1] += W[i][j]
      W[i][j + 1] %= 2
    }
  }
  P := make([]int, N)
  for i := range P {
    for j := range W {
      P[i] += W[j][i] * 1 << uint(j)
    }
  }
  H := make([]int32, 1 << uint(26))
  for i := range H[1:] {
    H[i + 1] = int32(N)
  }
  for _, p := range P {
    for i := 0; i < 26; i++ {
      q := 1 << uint(i)
      H[p] = MinInt(H[p ^ q] + 1, H[p])
    }
  }
  H[0]++
  Write(H[P[N - 1]])
  return
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 319408
#include<iostream>
using namespace std;
long gcd(long a,long b){return b?gcd(b,a%b):a;}
main()
{
  int N;long s;
  cin>>N>>s;
  for(int i=1;i<N;i++)
  {
    long t;cin>>t;
    s/=gcd(s,t);
    s*=t;
  }
  cout<<s<<endl;
}

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

int main(){
	int n;
	cin >> n;
	string s = to_string(n);
	int size = s.size();
	int ans = 0;
	for(int i = 0; i < size; i++){
		ans += s[i] - '0';
	}
	if(n % ans == 0){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define ll long long int
#define MOD ((int)(1e9) + 7)

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  ll cum = 0;
  for(int i=0; i<n; i++) {
    int tp; cin >> tp;
    cum += min(tp, k-tp);
  }
  cout << 2*cum << '\n';
  return 0;
}


Measured memory_bytes: 384
# Fast IO (only use in integer input)

import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

# Fenwick Tree to Calculate Sum

N,Q = map(int,input().split())

MaxLength = 2 * N
FenwickTree = []

CurLen = MaxLength
while CurLen != 0:
    FenwickTree.append([0] * CurLen)
    CurLen //= 2

Depth = len(FenwickTree)

def addElem(n,index): # add n to an element in index
    for j in range(Depth):
        FenwickTree[j][index] += n
        index //= 2

def firstNSum(n): # Return the sum of the first n elements (0 to n-1)
    nCpy = n
    summ = 0
    depthCur = 0
    while nCpy != 0:
        if nCpy % 2 != 0:
            summ += FenwickTree[depthCur][nCpy - 1]
        nCpy //= 2
        depthCur += 1
    return summ

c = list(map(int,input().split()))
firstLocColor = [-1] * N
ans = [-1] * Q
queries = []
for i in range(Q):
    l,r = map(int,input().split())
    queries.append((l,r,i))
queries.sort(key = lambda x: x[1])
queryIndex = 0
for i in range(N):
    # Update the Fenwick tree to count ith element
    if firstLocColor[c[i] - 1] == -1:
        addElem(1,i)
        firstLocColor[c[i] - 1] = i
    else:
        addElem(-1,firstLocColor[c[i] - 1])
        addElem(1,i)
        firstLocColor[c[i] - 1] = i
    
    # get query
    while queryIndex < Q and queries[queryIndex][1] - 1 <= i:
        if queries[queryIndex][1] - 1 == i:
            ans[queries[queryIndex][2]] = firstNSum(queries[queryIndex][1]) - firstNSum(queries[queryIndex][0] - 1)
        queryIndex += 1

for elem in ans:
    print(elem)

Measured memory_bytes: 226652
#define _USE_MATH_DEFINES

#include <iostream>
#include <iterator>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cassert>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <unordered_set>
#include <climits>
#include <ctime>

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

void solve() {
	ull x, y;
	cin >> x >> y;
	ull answer = 1;
	while ((1ULL << answer) * x <= y)
		++answer;
	cout << answer;
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	solve();

#ifdef LOCAL
	cerr << double(clock()) / CLOCKS_PER_SEC << " sec" << endl;
#endif
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int n,k;
    cin >> n >> k;
    vector<double> p(n);
    for(int i=1; i<=n; i++){
        int score=i;
        int need=0;
        while(k>score){
            score*=2;
            need++;
        }
        p[i-1]=(double)1/n;
        for(int j=0; j<need; j++){
            p[i-1]*=(double)0.5;
        }

    }
    double ans=0.0;
    for(int i=0; i<n; i++){
        ans+=(double)p[i];
    }
    printf("%.12lf",ans);
}



Measured memory_bytes: 1024
*> AtCoder My Practice
       *> author: Leonardone @ NEETSDKASU
       *>
       IDENTIFICATION DIVISION.
       PROGRAM-ID. Answer.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       REPOSITORY.
              FUNCTION ALL INTRINSIC.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
              01 Input-Values.
                     05 n      BINARY-SHORT.
                     05 a      BINARY-SHORT.
              01 Calc-Values.
                     05 ans    PIC XXX.
                     05 tmp    BINARY-SHORT.
       PROCEDURE DIVISION.
       AnswerMain SECTION.
       000-Start.
       
              ACCEPT n.
              ACCEPT a.
              
              MOVE n TO tmp.
              DIVIDE 500 INTO tmp.
              MULTIPLY 500 BY tmp.
              SUBTRACT tmp FROM n.
              MOVE "Yes" TO ans.
              IF a < n THEN
                     MOVE "No" TO ans
              END-IF.
              DISPLAY TRIM(ans).
       END PROGRAM Answer.


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  string s;
  cin>>s;
  if(s[0]==s[2]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

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

long n,k;
const long MAX = 100000;
long T[MAX];

long check (long p){
    long i = 0;
    for (int j = 0; j < k ; ++j) {
        long s = 0;
        while(s + T[i] <= p){
            s += T[i];
            i++;
            if(i == n) return n;
        }
    }
    return i;
}

long solve() {
    long left = 0;
    long right = 100000 * 10000;
    while (left < right) {
        long mid = (left + right) / 2;
        long v = check(mid);
        if (v >= n) right = mid;
        else left = mid + 1;
    }
    return right;
}

int main(){
    cin >> n >> k;
    for (int i = 0; i < n ; ++i)cin >> T[i];
    long ans = solve();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	int dishes[5];
	for (int i = 0; i < 5; i++) cin >> dishes[i];

	int ones_place = dishes[0] % 10;
	for (int i = 1; i < 4; i++) {
		if (dishes[i] % 10 == 0) continue;
		ones_place = min(ones_place, dishes[i] % 10);
	}
	int last_index;
	for (int i = 0; i < 5; i++) {
		if (ones_place == dishes[i] % 10) last_index = i;
	}
	int time = 0;
	for (int i = 0; i < 5; i++) {
		if (i == last_index || dishes[i] % 10 == 0) time += dishes[i];
		else time += dishes[i] + (10 - dishes[i] % 10);
	}
	cout << time << endl;

	return 0;
}

Measured memory_bytes: 3560
N = int(input())
S = input()
rwc = S.count('W')
rec = N-rwc
lwc = 0
lec = 0
if S[0] == 'W':
    rwc -= 1
else:
    rec -= 1
mi = rec
for i in range(1,N):
    if S[i] == 'W':
        rwc -= 1
    else:
        rec -= 1
    if S[i-1] == 'W':
        lwc += 1
    else:
        lec += 1

    muku = lwc + rec
    mi = min(mi,muku)
print(mi)

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

using namespace std;

const string KEY = "keyence";

int solve() {
    string buf;
    cin >> buf;
    if (buf.size() < KEY.size()) {
        return 0;
    }
    size_t i = 0;
    for (; i < KEY.size(); ++i) {
        if (buf[i] != KEY[i]) {
            break;
        }
    }
    size_t j = 0;
    for (; j < KEY.size(); ++j) {
        if (buf[buf.size() - 1 - j] != KEY[KEY.size() - 1 - j]) {
            break;
        }
    }
    if (i + j >= KEY.size() || i == KEY.size() || j == KEY.size()) {
        return 1;
    }
    return 0;
}

int main() {
#ifdef LOCALHOST
    freopen("input", "r", stdin);
#endif
    puts(solve() ? "YES" : "NO");

    return 0;
}


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

class P
{
    static void Main()
    {
        //int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
        string s = Console.ReadLine();
        bool[] b = new bool[26];
        foreach (var c in s)
        {
            if(b[c - 'a'])
            {
                Console.WriteLine("no");
                return;
            }
            b[c - 'a'] = true;
        }
        Console.WriteLine("yes");
    }
}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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




int main() {
    cout<<fixed<<setprecision(10);

    ll h,w;
    cin>>h>>w;
    vint a(h), b(h);
    rep(i,h) {cin>>a[i]>>b[i]; a[i]--; b[i]--;}

    using P = pair<ll,ll>;
    set<P> s;
    multiset<ll> ms;
    rep(i,w) {s.insert(make_pair(i,i)); ms.insert(0);}

    rep(i,h){
        // cout<<s.size()<<endl;
        // if(s.size() == 0) {cout<<-1<<endl; continue;}
        // for(auto p:s) cout<<"("<<p.second<<", "<<p.first<<") "; cout<<endl;
        auto it = s.lower_bound(make_pair(a[i], 0));
        P p;
        bool f = false;
        vector<P> cand;
        while(it != s.end() and it->first <= b[i]){
            f = true;
            p = *it;
            // s.erase(it);
            cand.push_back(p);
            ms.erase(ms.find(it->first - it->second));
            it++;
        }
        for(auto p:cand) s.erase(p);

        if(f){
            if(b[i] != w-1){
                p.first = b[i] + 1;
                s.insert(p);
                ms.insert(p.first - p.second);
            }
        }
        if(ms.size() == 0) cout<<-1<<endl;
        else cout<<*ms.begin() + i + 1<<endl;
    }

    return 0;

}

Measured memory_bytes: 28368
#include<stdio.h>

#define MAX 500
#define INFTY 100000

int main(){
  
  int n;
  int i, j;
  int e, sum;
  int M[MAX][MAX];
  int u, v;
  int minv;
  int d[MAX];
  int p[MAX];
  int vis[MAX];

  scanf("%d", &n);

  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      
      scanf("%d", &e);
      M[i][j] = (e == -1)?INFTY:e;

    }
  }

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

    d[i] = INFTY;
    p[i] = -1;
    vis[i] = 0;
    
  }

  d[0] = 0;

  while(1){
    
    minv = INFTY;
    u = -1;

    for ( i = 0; i < n; i++ ){
      if ( minv > d[i] && !vis[i] ){

	u = i;
	minv = d[i];
	
      }
    }
    
    if ( u == -1 ) break;

    vis[u] = 1;
    
    for ( v = 0; v < n; v++ ){
      if ( !vis[v] && M[u][v] != INFTY ){
	if ( d[v] > M[u][v] ){

	  d[v] =  M[u][v];
	  p[v] = u;

	}
      }
    }
  }

  sum = 0;

  for ( i = 0; i < n; i++ ){
    if ( p[i] != -1 ) {
      sum += M[i][p[i]];
    }
  }

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

  return 0;
}

Measured memory_bytes: 800
#include <bits/stdc++.h>
#define MAX 100008
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
#define forn(a,b,c) for(int a=b;a<c;a++)
#define ford(a,b,c) for(int a=b;a>=c;a--)
int n,m, ans = 0, dist[MAX];
vector<vi> AdjList;
void dfs(int u)
{
    if(dist[u] == -1)
    {
        int rez = 0;
        forn(i,0,(int)AdjList[u].size())
        {
            int v = AdjList[u][i];
            if(dist[v] == -1)
                dfs(v);
            rez = max(rez, dist[v] + 1);
        }
        dist[u] = rez;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    AdjList.assign(n, vi());
    forn(i,0,m)
    {
        int x,y;
        cin >> x >> y;
        x--; y--;
        AdjList[x].push_back(y);
    }
    forn(i,0,n)
        dist[i] = -1;
    forn(i,0,n)
    {
        if(dist[i] == -1)
            dfs(i);
        ans = max(ans, dist[i]);
    }
    cout << ans;
    return 0;
}


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

class A {
    static void Main(string[] args) {
        var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int A = st[0];
        int B = st[1];
        int C = st[2];

        if (st.Distinct().ToList().Count() == 2) {
            Console.WriteLine("Yes");
        } else {
            Console.WriteLine("No");
        }



    }
}

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

int main()
{
	__int128_t x;
	{
		int64_t n;
		cin >> n;
		x = n;
	}

	__int128_t now = 100;
	int64_t y = 0;

	while (now < x)
	{
		now = 101 * now / 100;
		y++;
	}

	cout << y << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n;
    cin>>n;
    cout<<(n+1)/2<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
    int n,a,b,ans,a1,b1,k;
    cin>>n>>a>>b;
    if(a>b){swap(a,b);}
    a1=a,b1=b;
    if(a%2==b%2){ans=(b-a)/2;
        cout<<ans;return 0;
    }
    else{
       ans=a-1;b=b-a+1;
       a=1;
       ans++;b--;
       ans+=(b-1)/2;
       a=a1,b=b1;
       k=n-b;
       a+=k;k++;a++;
       k+=(n-a)/2;
       
       ans=min(ans,k);
    }cout<<ans;
    return 0;}

Measured memory_bytes: 256
#include <stdio.h>

long long int checks[1000000];

int main() {
    long long int N, res = 0;
    scanf("%lld", &N);

    int pos = 0;
    long long int x = 1, sum = 0;
    while (pos < 1000000) {
        sum += x;
        x++;
        checks[pos++] = sum;
    }

    for (long long int i = 2; i * i <= N; i++) {
        if (N % i != 0) continue;

        long long int acc = 0;
        while(N % i == 0) {
            acc++;
            N /= i;
        }

        for (pos = 0; pos < 1000000; pos++) {
            if (acc < checks[pos]) {
                res += pos;
                break;
            }
        }
    }

    if (N != 1) res++;

    printf("%lld\n", res);
}


Measured memory_bytes: 9980
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

const int MAX = 510000;
// const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

llong POW(llong a, llong b){
  if(b == 0) return 1;
  else{
    if(b%2 == 0) return POW(a * a % MOD9, b / 2) % MOD9;
    else return a * POW(a * a % MOD9, b / 2) % MOD9;
  }
}

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD9;
        inv[i] = MOD9 - inv[MOD9%i] * (MOD9 / i) % MOD9;
        finv[i] = finv[i - 1] * inv[i] % MOD9;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD9) % MOD9;
}

int main(){
  COMinit();
  llong ans = 0;
  llong N, M, K;
  cin >> N >> M >> K;
  for(llong i=0; i<=K; ++i){
    ans += M * POW(M-1, N-1-i) % MOD9 * COM(N-1, i) % MOD9;
  }
  if(ans < 0) ans += MOD9;
  cout << ans%MOD9 << endl;
}


Measured memory_bytes: 15556
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  long long a[100009],b[100009],c[100009];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n;i++){
    c[i]=a[i]-b[i];
  }
  sort(c,c+n);
  long long cnt=0,sum=0;
  for(int i=0;i<n;i++){
    if(c[i]<0){
      cnt++;
      sum+=-c[i];
    }
  }
  for(int i=n-1;i>=0;i--){
    if(c[i]>0&&sum>0){
      sum-=c[i];
      cnt++;
    }
  }
  if(sum>0)cout<<-1<<endl;
  else{
    cout<<cnt<<endl;
  }
  return(0);
}


Measured memory_bytes: 2560
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def main():
    a = input()

    if ascii_lowercase.count(a) > 0:
        return "a"

    if ascii_uppercase.count(a) > 0:
        return "A"

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9060
g = [[] for _ in range(4)]
for _ in range(3):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  g[a].append(b)
  g[b].append(a)
  
for i in range(4):
  if len(g[i]) != 1 and len(g[i]) != 2:
    print('NO')
    exit()
else:
  print('YES')

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

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

    if ((a * b) % 2 == 0) {
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;

    if ((S[0] == 'a' || S[1] == 'a' || S[2] == 'a' ) && (S[0] == 'b' || S[1] == 'b' || S[2] == 'b') && (S[0] == 'c' || S[1] == 'c' || S[2] == 'c')){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

int main(void){
  int n, temp;
  cin >> n;
  int ans = 1e+9;
  int count;
  for(int i = 0; i < n; i++){
    cin >> temp;
    count = 0;
    while(temp % 2 == 0){
      count++;
      temp /= 2;
    }
    ans = min(ans, count);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
enum = enumerate
inf = 1001001001

import collections
import random

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def dist(x1,y1,x2,y2):
	return abs(x1-x2)+abs(y1-y2)

#vD = [chr(ord("a")+i) for i in range(26)]

def ran():
	vRan = [random.randint(1, 10),
	        random.randint(0, 10),
	        random.randint(1, 100)]
	return vRan

def bye(res):
	sT = "No Yes".split()
	print(sT[res])
	#exit(0)

def sol_n(a,b,c):
	res = 0
	cnt = 0
	while cnt<c:
		res += 1
		cnt += a
		if res%7==0:
			cnt += b
	return res


def sol(a,b,c):
	#a,b,c = linput()
	### 3 6 9 12 15
	### 1 2 3 4  5
	
	res = 0
	L = -(-a//c)
	R = (b//c)
	res = R-L+1
	
	return res

def deb():
	#vI = linput()
	vI = ran()
	#print(vI)
	I = sol_n(*vI)
	J = sol(*vI)
	if 1:#I!=J:
		print(vI, I, J)

def main():
	vI = linput()
	print(sol(*vI))

if __name__ == "__main__":
	#for _ in "*"*1000:
	#	deb()
	main()


Measured memory_bytes: 9752
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline
##import numpy as np
#sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
##def power(x, y):
##    if(y == 0):return 1
##    temp = power(x, int(y / 2))%mo
##    if (y % 2 == 0):return (temp * temp)%mo 
##    else:
##        if(y > 0):return (x * temp * temp)%mo 
##        else:return ((temp * temp)//x )%mo
##
##for _ in range(inin()):
r,c,k=cin()
dc=dd(int)
dr=dd(int)
mat=[]
for i in range(r):
    s=sin().strip()
    dr[i]=s.count('#')
    mat.append(list(s))
total=sum(list(dr.values()))
for i in range(c):
    co=0
    for j in range(r):
        if(mat[j][i]=='#'):
            co+=1
    dc[i]=co
ans=0
lr=lr=[o for o in range(r)]
lc=[o for o in range(c)]
for i in range(0,r+1):
    sur=0
    
##    print("LR==",lr)
    rowp=list(itertools.combinations(lr,i))
##    print("ROWPER==",rowp)
##    print(len(rowp))
    for perrow in rowp:
        sur=0
        for indexr in perrow:
            sur+=dr[indexr]
        for j in range(0,c+1):
            suc=0
            colp=list(itertools.combinations(lc,j))
            for percol in colp:
                suc=0
                for indexc in percol:
                    co=0
                    for ro in range(r):
                        if(mat[ro][indexc]=='#' and (ro not in perrow)):
                            co+=1
                    suc+=co
                if(total-sur-suc==k):
##                    print("No of ro=",i,"SUMR",sur,"ROWPERM=",perrow,"   ","NO OF COL",j,"SUMC",suc,"COLPERM",percol)
                    ans+=1
                        
                    
print(ans)
    
        
    

        


    


    
    
    
    
    
    
    
    
        
    
    
    
    
    
    
        
        
    
    
    
    


    





##
        
    
    
    
    
    
    
        
        
    
    
    
    


    





##def msb(n):n|=n>>1;n|=n>>2;n|=n>>4;n|=n>>8;n|=n>>16;n|=n>>32;n|=n>>64;return n-(n>>1) #2 ki power
##def pref(a,n,f):             
##    pre=[0]*n
##    if(f==0):         ##from beginning
##        pre[0]=a[0]
##        for i in range(1,n):
##            pre[i]=a[i]+pre[i-1]
##    else:              ##from end
##        pre[-1]=a[-1]
##        for i in range(n-2,-1,-1):
##            pre[i]=pre[i+1]+a[i]
##    return pre
##maxint=10**24 
##def kadane(a,size): 
##    max_so_far = -maxint - 1
##    max_ending_here = 0
##       
##    for i in range(0, size): 
##        max_ending_here = max_ending_here + a[i] 
##        if (max_so_far < max_ending_here): 
##            max_so_far = max_ending_here 
##  
##        if max_ending_here < 0: 
##            max_ending_here = 0   
##    return max_so_far


Measured memory_bytes: 9484
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

const ll INF = 1e17;
const ll MOD = 1e9+7;

int main() {
    // input, ready
    int N,R;
    cin >> N >> R;

    if (N>=10) cout << R << endl;
    else cout << R + 100 * (10-N) << endl;

    return 0;
}


Measured memory_bytes: 256
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

x , n = map(int , input().split())
if n == 0:
	print(x)
	exit()
arr = list(map(int , input().split()))
ans = 10**10
m = max(arr) + 1
mi = 10**10
for i in range(-100 , 105):
	if i not in arr:
		if mi > abs(x-i):
			#print(abs(x-i),i)
			ans = i
			mi = abs(x-i)
		if mi == abs(x-i):
			ans = min(ans , i)
print(ans)




Measured memory_bytes: 9488
#include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
#include <sstream>
#include<vector>
using namespace std;


int main(){
	int n;
	while(cin>>n)
	{
		if(n==0)break;
		multimap < int,int,greater<int> > mp;
		while(n--)
		{
			int num,kyo1,kyo2;
			cin>>num>>kyo1>>kyo2;
			mp.insert( make_pair( kyo1+kyo2, num) );
		}
		multimap<int , int , greater<int> > :: iterator it = mp.begin();
		cout<<(*it).second<<" "<<(*it).first<<endl;
	}
	return 0;
}

Measured memory_bytes: 1660
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
char x, y;
cin>> x >> y;

if(x<y)
cout<< '<' <<endl;
else if(x==y)
cout<< '=' <<endl;
else
cout<< '>' <<endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#define N 102
#define int long long
using namespace std;
int f[N][N][N * 3],n,w[N],v[N],ans,W;
main()
{
	memset(f,0,sizeof(f));
	scanf("%lld %lld",&n,&W);
	for (int i = 1;i <= n; ++i)
		scanf("%lld %lld",&w[i],&v[i]);
	for (int i = 1;i <= n; ++i)
		for (int k = 0;k <= i; ++k)
			for (int o = 0;o <= i * 3; ++o)
				{
					f[i][k][o] = f[i - 1][k][o];
					if (k > 0&&o >= w[i] - w[1])
						f[i][k][o] = max(f[i][k][o],f[i - 1][k - 1][o - (w[i] - w[1])] + v[i]);
				}
	ans = 0;
	for (int i = 0;i <= n; ++i)
		for (int j = 0;j <= 3 * n; ++j)
			if (i * w[1] + j <= W) 
			ans = max(ans,f[n][i][j]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 25088
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	long x = sc.nextLong();
      	long y = sc.nextLong();
      	if(x%y==0){
      		System.out.println(-1);
    	}else{
     		System.out.println(x);
    	}  	
    }
}

Measured memory_bytes: 35684
#include <stdio.h>

int main(){
  char s[40] = "";
  if(scanf("%s",s) < 0){
    printf("ERROR\n");
    return 1;
  }
  if(s[0] == s[1]){
    if(s[2] == s[3] && s[0] != s[2]){
      printf("Yes");
      return 0;
    }
  }else if(s[0] == s[2]){
    if(s[1] == s[3] && s[0] != s[1]){
      printf("Yes");
      return 0;
    }
  }else if(s[0] == s[3]) {
    if(s[1] == s[2] && s[0] != s[1]){
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N; cin >> N;
  vector<int> v(N);
  rep(i, N) cin >> v[i];

  sort(all(v));

  double ans = (double)v[0];
  for (int i = 1; i < N; i++) {
    ans = (double)(ans + v[i]) / 2.0;
  }

  printf("%.10f\n", ans);

  return 0;
}


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

using namespace std;
long long mini=1e10;
int n=12,m=1e5+1;

void solve(vector<long long int> a,vector<vector<int>> v, long long sum,int j,vector<int> vv,long long req)
{
    if(j==a.size()) return;
    int p=v.size(),q=v[0].size();
   // cout<<p<<" "<<q<<"\n";
  // int flag=0;
    for(int i=j;i<a.size();i++)
    {
        vector<int> temp=vv;
        temp.push_back(a[i]);
       // sum+=v[temp[i]][0];
       sum=0;
        for(int k=0;k<temp.size();k++)
        {
           // cout<<temp[k]<<" ";
            sum+=v[temp[k]][0];
        }
        //cout<<"\n";
        //cout<<sum<<"\n";
        int count=0,flag=0;
        for(int l=1;l<q;l++)
        {
            count=0;
            for(int k=0;k<temp.size();k++)
            {
                count+=v[temp[k]][l];
            }
            if(count<req)
            {
                flag=1;
                break;
            }
        }
        if(flag==0)
        {
            //cout<<sum<<"\n";
            mini=min(mini,sum);
        }
        solve(a,v,sum,i+1,temp,req);
    }
    
}

int main() {
    
    long long int i,j,k,flag=0;
    cin>>n>>m>>k;
    vector<vector<int> > v(n,vector<int> (m+1, 0)); 
    
    vector<long long int> a(n);
    
    for(i=0;i<n;i++)
    {
        a[i]=i;
        cin>>v[i][0];
        for(j=1;j<=m;j++)
        {
            cin>>v[i][j];
        }
    }
    
    long long sum=0;
    for(j=1;j<=m;j++)
    {
        sum=0;
        for(i=0;i<n;i++)
        {
            sum+=v[i][j];
        }
        if(sum<k)
        {
            flag=1;
            break;
        }
    }
    
    if(flag==1)
    {
        cout<<"-1";
        return 0;
    }
    
    sum=0;
    vector<int> temp;
    solve(a,v,sum,0,temp,k);
    cout<<mini; 
    
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1; i < B; i++) {
		if (A * i % B == C) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)

A = []
current = "R"
cnt = 1
for i in range(1, N):
    if S[i] == current:
        cnt += 1
    else:
        A.append(cnt)
        current = S[i]
        cnt = 1
else:
    A.append(cnt)

B = []
for i, a in enumerate(A):
    if i % 2 == 0:
        B.extend(list(range(a - 1, -1, -1)))
    else:
        B.extend(list(range(a)))

V = []
for i, b in enumerate(B):
    if b == 0:
        V.append(i)

P = [0] * N
vi = 0
current = "R"
for i in range(N):
    if S[i] == current:
        P[i] = V[vi]
    else:
        current = S[i]
        vi += 1
        P[i] = V[vi]

C = [0] * N
for i in range(N):
    if S[i] == "R":
        if B[i] % 2 == 0:
            C[P[i]] += 1
        else:
            C[P[i] + 1] += 1
    else:
        if B[i] % 2 == 0:
            C[P[i]] += 1
        else:
            C[P[i] - 1] += 1

print(*C)


Measured memory_bytes: 12664
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define pb push_back
#define MOD 1e9+7
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template<class T>inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<class T>inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

int main()
{
	int n; cin >> n;
	vector<int>x(n), y(n);
	map<pair<int, int>, int> m;
	rep(i, n)cin >> x[i] >> y[i];
	rep(i, n)for (int j = i + 1; j < n; j++)
	{
		int x_d = x[i] - x[j];
		int y_d = y[i] - y[j];
		if (x_d < 0)
		{
			x_d *= -1;
			y_d *= -1;
		}
		else if (x_d == 0 && y_d < 0)
		{
			y_d *= -1;
		}
		auto p = make_pair(x_d, y_d);
		m[p]++;
	}
	int ma_pair = 0;
	for (auto e:m)
	{
		if (e.second > ma_pair)ma_pair = e.second;
		cer(e.first.first << " " << e.first.second << " " << e.second);
	}
	int ans = n - ma_pair;
	co(ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

#define pi (acos(-1))

int main()
{
    int a,b,x;
    scanf("%d%d%d",&a,&b,&x);
    double A=a,B=b,X=x,ans;
    if(X<A*A*B/2.0)ans=atan(A*B*B/2.0/X)/pi*180;
    else ans=atan(2*(A*A*B-X)/A/A/A)/pi*180;
    printf("%.10f",ans);
    return 0;
}

Measured memory_bytes: 256
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    //int t = 1; cin >> t; while(t--)
    {
        int n, m;
        string s;
        cin >> s;
        if(s.size() % 2)
                return cout << "No", 0;

        for(int i = 0; i < s.size(); i++) {
            if(i % 2 && s[i] != 'i')
                return cout << "No", 0;
            if(i % 2 == 0 && s[i] != 'h')

                return cout << "No", 0;
        }

        cout << "Yes";
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int d,n;
    cin>>d>>n;
    if(n==100)
        cout<<(long long)(101*pow(100,d))<<endl;
    else
        cout<<(long long)(n*pow(100,d))<<endl;
    return(0);
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define el '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define all(x) x.begin(),x.end()
#define int long long
int inf = 1e18;

int32_t main()
{
    fastIO
    int t=1;
    //cin>>t;

    while(t--)
    {
       int n;
       cin>>n;
       string s;
       cin>>s;
       char arr[]  ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
       for(int i=0;i<s.size();++i)
       {
           for(int j=0;j<26;++j)
           {
               if(s[i]==arr[j])
               {
                   s[i]=  arr[(j+n)%26];
                   break;
               }
           }
       }
       cout<<s;
    }
    return 0;
}
// always test the corner cases ALWAYS;


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int N,i,min=101;
	int s[100];
	int point=0;
	
	scanf("%d",&N);
	
	i=0;
	
	while(i<N){
		scanf("%d",&s[i]);
		i++;
	}       
	
	for(i=0;i<N;i++){
		point+=s[i];
	}
	
	if(point%10==0){
		for(i=0;i<N;i++){
			if(s[i]%10!=0 && min>s[i]){
				min=s[i];
			}
		}
		if(min!=101){
			point=point-min;
		}else{
			point=0;
		}
	}
	
	printf("%d\n",point);
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <locale>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
    string s;
    int alp[26] = {};

    while (getline(cin, s))
    {
        rep(i, s.length())
        {
            int num = (int)(tolower(s[i]) - 'a');
            if (num > 25 || num < 0)
                continue;
            alp[num]++;
        }
    }
    int a = (int)'a';
    rep(i, 26)
    {
        cout << (char)(i + a) << " : " << alp[i] << endl;
    }
}


Measured memory_bytes: 3200
n = int(input())
if (n//10**(len(str(n))-1)+1)*10**(len(str(n))-1)-1 > n:
  mx = (n//10**(len(str(n))-1))*10**(len(str(n))-1)-1
else:
  mx = (n//10**(len(str(n))-1)+1)*10**(len(str(n))-1)-1
print(sum(list(map(int,str(mx)))))

Measured memory_bytes: 9204
n,k = map(int,input().split())
L = list(map(int,input().split()))

def A(x):
    cnt = 0
    for i in range(n):
        if L[i]%x == 0:
            cnt +=L[i]//x-1
        else:
            cnt +=L[i]//x
    return cnt <= k

lower = 0
upper = max(L)

while upper - lower > 1:
    mid = (lower + upper)//2
    if A(mid):
        upper = mid
    else:
        lower = mid

print(upper)

Measured memory_bytes: 30912
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    bool w[5][5][4]={};
    
    char a;
    
    rep(i,5){
        rep(j,4){
            cin>>a;
            w[i  ][j  ][0] = a-'0';
            w[i  ][j+1][2] = a-'0';
        }
        if(i==4)continue;
        
        rep(j,5){
            cin>>a;
            w[i  ][j  ][1] = a-'0';
            w[i+1][j  ][3] = a-'0';
        }
    }
    
    assert(w[0][0][0]);
    
    int py = 0, px = 0;
    int dir = 0;
    
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, 1, 0, -1};
    
    string ans = "";
    string ch[] = {"R", "D", "L", "U"};
    do{
        for(int i=-1;i<=2;i++){
            int nd = ( dir+i+4 )%4;
            if( w[py][px][nd] ){
                ans += ch[nd];
                py += dy[nd];
                px += dx[nd];
                dir = nd;
                break;
            }
        }
    }while( py!=0 || px!=0 );
    
    cout<<ans<<endl;
}

Measured memory_bytes: 3056