akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll x; cin >> x;
	ll now = 100;
	ll ans = 0;
	while(now < x){
		now += now / 100;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3624
import java.util.*;

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

    System.out.println( ( a + b == c || b + c == a || c + a == b ) ? "Yes" : "No"  );
    
  }
}


Measured memory_bytes: 21588
n,m = map(int,input().split())
S = list(map(int,input().split()))
T = list(map(int,input().split()))

DP = [[[0,0] for i in range(m)] for j in range(n)]

mod=10**9+7

if S[0]==T[0]:
    DP[0][0][0]=1
    DP[0][0][1]=1

for i in range(1,n):
    if S[i]==T[0]:
        DP[i][0][0]=1
    DP[i][0][1]=(DP[i-1][0][1]+DP[i][0][0])%mod

for i in range(1,m):
    if S[0]==T[i]:
        DP[0][i][0]=1
    DP[0][i][1]=(DP[0][i-1][1]+DP[0][i][0])%mod

for i in range(1,n):
    for j in range(1,m):
        if S[i]==T[j]:
            DP[i][j][0] = (DP[i-1][j-1][1]+1)%mod
        DP[i][j][1] = (DP[i-1][j][1]+DP[i][j-1][1]-DP[i-1][j-1][1]+DP[i][j][0])%mod


print(DP[-1][-1][1]+1)

Measured memory_bytes: 370528
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long fac[700040], finv[700040], inv[700040];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 700040; i++) {
		fac[i] = fac[i - 1] * i % 1000000007;
		inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
		finv[i] = finv[i - 1] * inv[i] % 1000000007;
	}
}
long long com(long long n, long long k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}

int main() {
	long long x, y;
	long long a, b;
	cin >> x >> y;
	long long ans = 1;
	if ((x + y) % 3 == 0) {
		a = 0, b = 0;
		a = (2 * x - y) / 3;
		b = (2 * y - x) / 3;
	}
	else {
		cout << "0" << endl;
		return 0;
	}
	cominit();
	cout << com(a + b, a) << endl;
	return 0;
}

Measured memory_bytes: 16640
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
_DEC = lambda x: x-1
MIIZ = lambda: list(map(_DEC, MII()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y: return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    n, m = MII()
    pp = MIIZ()
    uf = UnionFind(n)
    for i in range(m):
        x, y = MIIZ()
        uf.union(x, y)
    cnt = 0
    for i, p in enumerate(pp):
        if uf.find(i) == uf.find(p): cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()



Measured memory_bytes: 13940
#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n;
	cin>>n;
	vector<int> ht(n,0);
	for (int i = 0; i < n; ++i)
	{
		cin>>ht[i];
	}
    std::vector<int> cost(n);
    cost[0] = 0;
    cost[1] = abs(ht[0]-ht[1]);
     for (int i = 2; i < n; ++i)
     {
     	cost[i] = min(abs(ht[i]-ht[i-2])+cost[i-2],abs(ht[i]-ht[i-1])+cost[i-1]);
     }
     cout<<cost[n-1];
}
int main()
{  

   
    solve();
    return 0;

 }

Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] newa = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            int tmp = a[i];
            newa[i] = tmp;
        }
        Arrays.sort(a);
        int max = a[n-1];
        int max_2 = a[n-2];
        for (int i = 0; i < n; i++) {
            if(newa[i] == max) {
                System.out.println(max_2);
            } else {
                System.out.println(max);
            }
        }
    }

}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N; cin >> N;
  vector<int> cnt(26, inf);
  rep(i, N) {
    string s; cin >> s;
    vector<int> cnt_local(26, 0);
    for (auto c: s) {
      cnt_local[c - 'a']++;
    }
    rep(i, 26) {
      cnt[i] = min(cnt[i], cnt_local[i]);
    }
  }
  rep(i, 26)
    rep(j, cnt[i])
      cout << char('a' + i);
  cout << endl;
}


Measured memory_bytes: 256
N = gets.to_i

h = Hash.new {0}
max = 0
N.times do
  s = gets.chomp
  h[s] += 1
  if max < h[s]
    max = h[s]
  end
end

ans = []
Hash[h.sort].each do |k, v|
  if v == max
    ans << k
  end
end

ans.each do |a|
  puts a
end


Measured memory_bytes: 51028
#include <stdio.h>
int main(void)
{
  int a,b,c,ct=0;
  scanf("%d%d%d",&a,&b,&c);
  ct++;
  if(a!=b)
  {
    ct++;
  }
  if(a!=c && b!=c)
  {
    ct++;
  }
  printf("%d\n",ct);
  return 0;
}


Measured memory_bytes: 128
n = int(input())
A = [int(i) for i in input().split()]
ans = sum([int(i) for i in input().split()])
C = [int(i) for i in input().split()]
for i in range(1,n):
    if A[i] - A[i-1] == 1:
        ans += C[A[i-1]-1]
print(ans)

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

N = int(input())

C_list = [0] * (N-1)
S_list = [0] * (N-1)
F_list = [0] * (N-1)
for i in range(N-1):
    C_list[i], S_list[i], F_list[i] = map(int, input().split())

# 出発駅の数でループ
for i in range(N-1):
    # 次の行の出力のために初期化
    ans = 0
    # ある出発駅から最終駅までのループ
    for j in range(i, N-1):
        # 開始時の待ち時間
        if j == i:
            ans += S_list[j]
        # 次の駅に着いた時、その駅の開始時待ちがまだある場合
        elif ans < S_list[j]:
            ans = S_list[j]
        # 次の駅への移動時間
        ans += C_list[j]
        # 次の出発前の待ち時間(最終駅に着いた時以外)
        if j != N-2:
            if ans % F_list[j+1] != 0:
                ans += F_list[j+1] - ans % F_list[j+1]
    print(ans)
# 出発駅 = 最終駅の出力
print(0)

Measured memory_bytes: 3188
--import Control.Monad


-- helpers
isHammingNum :: Int -> Bool
isHammingNum 1 = True
isHammingNum target
    | mod target 2 == 0     = isHammingNum $ div target 2
    | mod target 3 == 0     = isHammingNum $ div target 3
    | mod target 5 == 0     = isHammingNum $ div target 5
    | otherwise             = False

allHammingNum start end = filter isHammingNum [start .. end]

countHammingNum start end = show $ sum [1 | x <- allHammingNum start end]


-- IO
main = do
    input_ <- getLine
    {-
    when (input_ /= "0") $ do
        let nums = words input_
        putStrLn $ countHammingNum (read (head nums) :: Int) (read (last nums) :: Int)
        main
    -}

    if (input_ == "0")
        then return ()
        else do
            let nums = words input_
            putStrLn $ countHammingNum (read (head nums) :: Int) (read (last nums) :: Int)
            main

Measured memory_bytes: 4272
import Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Data.List (find)

main :: IO ()
main = do
  [a, b] <- map read <$> words <$> getLine
  n <- readLn
  solve a b <$> replicateM n (map read <$> words <$> getLine) >>= print

solve :: Int -> Int -> [[Int]] -> Int
solve a b = maybe 0 (const 1) . find f
  where f [s, f] = min b f - max a s > 0



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

int main() {
  int N,t,f;
  cin >> N;
  t = N;
  for(int i=0;i<9;i++){
    f+=t%10;
    t/=10;
    if(t==0){
      break;
    }
  }
  //cout << f << endl;
  if(N%f==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
n,k = map(int,input().split())
A = list(map(int,input().split()))
dp = [-1] * (n+1)
B = []
f = 1
c = 0
ans = n
bal = 0
while dp[f-1] == -1:
    dp[f-1] =c
    B.append(f)
    f = A[f-1]
    c +=1
t = B.index(f)
if k>t:
    k -= t
    B = B[B.index(f):]
    k%=len(B)
    print(B[k])
else:
    print(B[k])

Measured memory_bytes: 32236
#define _CRT_SECURE_NO_WARNINGS
#define REL
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

ll h, a[100000], s;
int n;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("threesum.in", "r", stdin);
	//freopen("threesum.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> h >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		s += a[i];
	}
	if (s >= h)
		cout << "Yes";
	else
		cout << "No";


	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;

const int NIL = -1;
const int MAX = 20001;

vector<int> G[100001];
int color[100001];
int tt = 0;

void dfs(int u, int n)
{
	color[u] = tt;
	for (int i = 0; i < G[u].size(); i++) {
		int v = G[u][i];
		if (color[v] == 0)
			dfs(v, n);
	}
}

int main(void)
{
	int n, m, s, t, q;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	for (int i = 0; i < n; i++) {
		if (color[i] == 0) {
			tt++;
			dfs(i, n);
		}
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> s >> t;
		if (color[s] == color[t])
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
	return 0;
}


Measured memory_bytes: 12132
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
    char s[150];
    cin>>s+1;
    int f1=1,f2=1,f3=1;
    int len = strlen(s+1);
    for(int i=1;i<=len;i++)
    {
        if(s[i]!=s[len-i+1]) f1=0;
    }
    int t=(len-1)/2;
    for(int i=1;i<=t;i++) if(s[i]!=s[t-i+1]) f2=0;
    t = (len+3)/2;
    for(int i=t;i<=len;i++) if(s[i]!=s[len-i+1]) f3=0;
    if(f1&&f2&&f3) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;    
#define int long long        
#define endl "\n"
#define deb(x) cout<<#x<<" "<<x<<endl
#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar) for(int pen=0;pen<sizeof(ar)/8;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rt return 0;
#define mod 1000000007
const int N= 8*1e5+ 10;
int st[N]={0};
void update(int ss, int se, int i, int diff, int si)  
{  
    // Base Case: If the input index lies outside the range of  
    // this segment  
    if (i < ss || i > se)  
        return;  
  
    // If the input index is in range of this node, then update  
    // the value of the node and its children  
    st[si] = st[si] + diff;  
    if (se != ss)  
    {  
        int mid = (ss+se)/2;  
        update(ss, mid, i, diff, 2*si);  
        update(mid+1, se, i, diff, 2*si + 1);  
    }  
}  
int get_sum(int ss, int se, int qs, int qe, int si)  
{  
    // If segment of this node is a part of given range, then return  
    // the sum of the segment  
    if (qs <= ss && qe >= se)  
        return st[si];  
  
    // If segment of this node is outside the given range  
    if (se < qs || ss > qe)  
        return 0;  
  
    // If a part of this segment overlaps with the given range  
    int mid = (ss+se)/2;
    return get_sum(ss, mid, qs, qe, 2*si) +  
        get_sum(mid+1, se, qs, qe, 2*si+1);  
} 
signed main()
{
    int n,w;
    cin>>n>>w;
    int wt[n],val[n];
    for(int i=0;i<n;i++){
        cin>>wt[i]>>val[i];
    }
    int dp[n][w+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<=w;j++){
            dp[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<=w;j++)
        {
            if(j==0){
                dp[i][j]=0;
                continue;
            }
            if(i==0){
                if(wt[i]<=j){
                    dp[i][j]=val[i];
                }
                else
                {
                    dp[i][j]=0;
                }
                continue;
            }
            if(wt[i]<=j){
                dp[i][j] = max ( val[i] + dp[i-1][ j-wt[i] ], dp[i-1][j]);
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[n-1][w]<<endl;
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
#define N 5010
bitset<N> dp; int num[N];
int main() {
    int n, k; scanf("%d%d", &n, &k);
    for (int i = 1;i <= n;i++) scanf("%d", &num[i]);
    sort(num + 1, num + n + 1, [=](int i, int j){return i > j;});
    dp[0] = 1; int ans = 0;
    for (int i = 1;i <= n;i++) {
        int flag = 0;
        for (int j = k - 1;j >= max(0, k - num[i]);j--) 
            if (dp[j]) {flag = 1; ans = 0; break;}
        if (num[i] < k) dp |= dp << num[i];
        if (!flag) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

const int INF=(1<<30);

int main(){
  int h,n;
  cin >> h >> n;
  vector<int> a(n),b(n);
  REP(i,n){
    cin >> a[i] >> b[i];
  }

  int dp[h+1];
  REP(i,h+1)dp[i]=INF;
  dp[0]=0;

  REP(i,h){
    if(dp[i]==INF)continue;
    REP(j,n){
      if(i+a[j]>h){
        if(dp[h] > dp[i]+b[j]){
          dp[h] = dp[i]+b[j];
        }
      }else{
        if(dp[i+a[j]] > dp[i]+b[j]){
          dp[i+a[j]] = dp[i]+b[j];
        }
      }

    }

  }
  // REP(i,h+1){
  //   printf("%d: %d\n",i,dp[i]);
  // }
  cout << dp[h] << endl;
}



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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N,X,value=0,cnt=0;
  cin>>N>>X;
  int m[N];
  for (int i=0;i<N;i++){
    cin>>m[i];
    value+=m[i];
    cnt++;
  }
  sort(m,m+N);
  cout<<cnt+(X-value)/m[0];
}

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

using namespace std;

typedef long long LL;

#define MAX_N 100005
#define MAX_M 100005
#define MAX_K 305

int N, M, K;
LL A[MAX_N];

void input()
{
  cin >> N >> M >> K;
  for (size_t i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
}

LL dp[MAX_N][MAX_K];
deque<pair<LL, int>> numList;

void init()
{
  numList.clear();
}

void pushList(LL val, int num)
{
  pair<LL, int> a = make_pair(val, num);
  while(numList.size()){
    if(numList[numList.size()-1] < a){
      numList.pop_back();
    }
    else{
      break;
    }
  }
  numList.push_back(a);
}

LL getList(int minNum){
  while(numList.size()){
    if(numList[0].second < minNum){
      numList.pop_front();
    }
    else{
      return numList[0].first;
    }
  }
  return -1;
}

LL solve()
{
  memset(dp, -1, sizeof(dp));
  for (size_t i = 0; i < N; i++) {
    dp[i][1] = A[i];
  }

  for (int k = 1; k < K; k++) {
    init();
    for (int n = 0; n < N; n++) {
      if(getList(max(0, n-M)) >= 0){
        LL tmp = getList(max(0, n-M)) + (LL)(k+1)*A[n];
        dp[n][k+1] = max(dp[n][k+1], tmp);
      }
      pushList(dp[n][k], n);
    }
  }

  LL ret = 0;
  for (size_t i = 0; i < N; i++) {
    ret = max(ret, dp[i][K]);
  }

  return ret;
}

signed main()
{
  input();

  cout << solve() << endl;

  return 0;
}


Measured memory_bytes: 239360
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define bg begin()
#define ed end()
#define fi first()
#define se second()
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int,int>;
using vpint = vector<pint>;
template <typename T>
T sq(T x){
  return x * x;
}
ll mod = 1e9 + 7;

signed main (){
int N,K;  
cin >> N >> K;
vint p(N);
rep(i,N){
 cin >> p.at(i);
}
sort(all(p));
int ans = 0;
rep(i,K){
ans += p.at(i);

}


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


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

long long int f(long long int a,long long int b){
    //long long int x = a*b;
    /*
    long long int temp = max(a,b);
    b = min(a,b);
    a = temp;
    */
    if(a<b){
        long long int temp = a;
        a = b;
        b = temp;
    }
    long long int r = a%b,A = a,B = b;

    while(r != 0){
        A = B;
        B = r;
        r = A%B;
    }
    return (a/B)*b;
}

int main(){

    int n;
    cin >> n;
    long long int t[n];
    for(int i = 0;i<n;i++) cin >> t[i];
    long long int ans = 0;
    if(n == 1){
        ans = t[0];
    }
    else{
        ans = f(t[0],t[1]);
        if(n != 2){
            for(int i = 1;i<n;i++){
                ans = f(ans,t[i]);
            }
        }
    }
   
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
A = []
b = []
for i in range(3):
    A.extend(list(map(int, input().split())))
N = int(input())
for i in range(N):
    num = int(input())
    if num in A:
        idx = A.index(num)
        A[idx] = 0
        if A.count(0) >= 3:
            if (A[0] == A[3] and A[0] == A[6]
              or A[1] == A[4] and A[1] == A[7]
              or A[2] == A[5] and A[2] == A[8]
              or A[0] == A[1] and A[0] == A[2]
              or A[3] == A[4] and A[3] == A[5]
              or A[6] == A[7] and A[6] == A[8]
              or A[0] == A[4] and A[0] == A[8]
              or A[2] == A[4] and A[2] == A[6]):
                print("Yes")
                exit()
print("No")


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

int main(){
  long long a,b;
  int k;
  cin>>a >>b >>k;
  for(int i=0;i<k;i++){
    if(i%2==0){
      if(a%2!=0){
        a--;
      }
      b+=a/2;
      a/=2;
    }else{
      if(b%2!=0){
        b--;
      }
      a+=b/2;
      b/=2;
    }
  }
  cout<<a<<" "<<b<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>
#include <set>
using namespace std;

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

#define max_n 100

long long N;
vector<int> A[1000];

int main() {

	cin >> N;

	rep(i, N) {
		rep(j, N-1) {
			int k;
			cin >> k;
			A[i].push_back(k-1);

		}
	}

	queue<int> Possible;

	rep(i,N)Possible.push(i);

	bool ChangedA[1000] = {false};
	int firstqueue = 0;

	int day = 0;
	while (firstqueue!=-1)
	{
		rep(i,N)ChangedA[i] = false;
		firstqueue = -1;
		day++;		

		while (!Possible.empty())
		{
			int P = Possible.front();
			if(firstqueue==P)break;
			
			Possible.pop();

			if (A[P].size() <= 0)continue;
			int T = A[P][0];			
			if(A[T][0]==P&&ChangedA[T]==false&& ChangedA[P] == false){
				ChangedA[P] = true; ChangedA[T] = true;
				A[P].erase(A[P].begin());
				A[T].erase(A[T].begin());
				Possible.push(P);
				Possible.push(T);
				if (firstqueue < 0)firstqueue = P;
			}
		}
	
	}
	bool finish = true;
	rep(i, N)if (A[i].size() > 0)finish = false;

	if(finish)cout << day-1 <<endl;
	else cout << "-1" << endl;

	return 0;	
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define LOCAL 0
#define lli long long int
const lli mod=1e9+7;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int INF=0x3f3f3f3f;
#define Pa pair<int,int>
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define ld long double
#define printli(n) printf("%lld\n",n)
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}

int main() {
    int x=0,y=0,t=0,tt,a,b;
    int n;
    si(n);
    
    for(int i=0;i<n;i++){
        si(tt);si(a);si(b);
        int tm=abs(a-x)+abs(b-y);
        if(tm>tt-t){
            cout<<"No\n";
            return 0;
        }
        else if((tt-t-tm)%2==1){
            cout<<"No\n";
            return 0;
        }
        x=a,y=b,t=tt;
    }
    cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    long a, b, c, d;
    scan(a, b, c, d);

    auto ans = (b - a + 1) - (f(b, c, d) - f(a - 1, c, d));
    writeln(ans);
}

long f(long x, long c, long d) {
    auto ans = x / c + x / d - x / lcm(c, d);
    return ans;
}

long lcm(long c, long d) {
    return c / gcd(c, d) * d;
}










void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
import bisect
from numpy import cumsum
order = 5
q = int(input())
lr = [[int(item) for item in input().split()] for _ in range(q)]

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

sosu = sieve(10**order)
like2017 = [0] * (10**order+1)
for s in sosu:
    if s % 4 == 1 or s==3:
        index = bisect.bisect_left(sosu, (s + 1) // 2)
        if sosu[index] == (s + 1) // 2:
            like2017[s] = 1
cs = cumsum(like2017)

for l, r in lr:
    print(cs[r] - cs[l-1])

Measured memory_bytes: 33296
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
using namespace std;

struct Edge {
	int from, to, cost;
};

vector<char>negative;

int N, M;

vector<Edge>E;
vector<long long>cost;
void bellman_ford(int s) {
	cost.resize(N, 1e18);
	cost[s] = 0;

	for (int loop = 0; loop < N; loop++) {
		for (int j = 0; j < M; j++) {
				Edge e = E[j];
				if (cost[e.from] != 1e18 && cost[e.to] > cost[e.from] + e.cost) {
					cost[e.to] = cost[e.from] + e.cost;
					if (loop == N - 1)negative[e.to] = true;
				}
			}
		}
}

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

	for (int i = 0; i < M; i++) {
		int a, b, c; cin >> a >> b >> c;
		a--; b--;
		E.push_back(Edge({ a, b,-c }));
	}
	negative.resize(N, false);
	bellman_ford(0);

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			Edge e = E[j];
			if (negative[e.from])negative[e.to] = true;
		}
	}

	if (negative[N-1])cout << "inf" << endl;
	else cout << -cost[N-1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int H, W, k, l;
	
	while(1){
		scanf("%d %d", &H, &W);
		
		if(H==0 && W==0) break;
		
		for(l=0;l<H;l++){
			
			if(l==0 || l==(H-1)){
			for(k=0;k<W;k++) printf("#");
			}
			else {
				printf("#");
				for(k=0;k<(W-2);k++) printf(".");
				printf("#");
				
			}
		
		printf("\n");
		}
		
		printf("\n");
		
	}
	
	return 0;
}

Measured memory_bytes: 572
import java.util.Scanner;

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

      int result = a * b;

      if(result % 2 == 0){
        System.out.println("Even");
      }else{
        System.out.println("Odd");
      }
      sc.close();
    }
    
}


Measured memory_bytes: 23892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] wa = new int[n + 1];
		boolean[] ac = new boolean[n + 1];
		for(int i = 0; i < n + 1; i++) {
			wa[i] = 0;
			ac[i] = true;
		}
		for(int i = 0; i < m; i++) {
			int p = sc.nextInt();
			String s = sc.next();
			if(s.equals("AC")) {
				ac[p] = false;
			} else if(ac[p]) {
				wa[p]++;
			}
		}
		int ansac = 0;
		int answa = 0;
		for(int i = 1; i < n + 1; i++) {
			if(ac[i] == false) {
				ansac++;
				answa += wa[i];
			}
		}
		System.out.println(ansac + " " + answa);
	}

}


Measured memory_bytes: 62644
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=2e5;
const int inf=1e9;
int main(){
	int x,y,z; cin>>x>>y>>z;
	cout<<(x - y - 2 * z) / (y + z) + 1<<endl;
}

Measured memory_bytes: 3564
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n,m = iim()
l =[]
for _ in range(n):
    l.append(iil())

l.sort()

num = 0
val = 0
for item in l:
    cst = item[0]
    cnt = item[1]
    if num + cnt < m:
        val += cst*cnt
        num += cnt
    else:
        val += cst*(m-num)
        break
print(val)
#100000000000000
#100000000000000


Measured memory_bytes: 27764
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <utility>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <math.h>
#include <stdio.h>

using namespace std;

#define REP(i,n,m) for( long long int i = (n); i < (m); i++ )
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort( ALL(v) );
#define LAST(v) v[v.size()-1]
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define IIN(a) int a; cin >> a;
#define LIN(a) ll a; cin >> a;
#define SIN(a) string a; cin >> a;
#define EPS (1e-10)
#define INF 1000000000000LL

int MOD=1000000007;
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
//I ASCII code: '0' = 48; 'A' = 65; 'a' = 97


ll func(ll a){
  ll ch = a + 1;
  if( ch%4==0 )return 0;
  else if ( ch%4==1 ) return a;
  else if( ch%4==2 ) return 1;
  else return a^1 ;
}
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    LIN(a)
    LIN(b)
    ll ans = 0;

  
    ans = func(a - 1)^func(b);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ii;
typedef pair<long long, pair<int, int>> iii;
typedef pair<ii, ii> iiii;

const double PI = acos(-1.0), EPS = 1e-6;
const int N = 200005, M = 100005, mod = 998244353 , mxLog = 20;

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(6), cout << fixed;

    int n;
    long long k;
    cin >> n >> k;
    vector<long long> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    vector<int> ones(64);
    for (int i = 0; i < n; ++i) {
        long long tmp = v[i];
        int j = 0;
        while (tmp) {
            ones[j] += (tmp & 1);
            tmp >>= 1;
            ++j;
        }
    }

    vector<long long> cum(64);
    for (int i = 0; i < 64; ++i) {
        cum[i] = max(ones[i], n - ones[i]) * (1LL << i);
        if (i > 0)
            cum[i] += cum[i - 1];
    }

    long long ans = 0;
    long long tmp = 0;
    for (int i = 63; ~i; --i) {
        if ((1LL << i) & k) {
            if (i > 0)
                ans = max(ans, ones[i] * (1LL << i) + tmp + cum[i - 1]);
            tmp += (n - ones[i]) * (1LL << i);
        } else {
            tmp += ones[i] * (1LL << i);
        }
    }

    ans = max(ans, tmp);
    cout << ans << '\n';


    return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		long n=sc.nextLong();
		long s=sc.nextLong();
		long sum=Long.MAX_VALUE;
		long sq=root(n);

		for(long i=2; i<=sq; i++) {	//k　進数で表す　2 < n < sqrt(n)　までを調べると桁数が3いじょうになる
			if(ketawa(n,i)==s) {
				sum=Math.min(sum,i);
			}
		}
		for(long i=sq; i>=1; i--) {
			long b=(n-s+i)/i;
			if(b>=2 && s==ketawa(n,b)) {
				sum=Math.min(sum, b);
			}
		}
		if(s==n) {
			sum=Math.min(sum,n+1);
		}
		if(sum<Long.MAX_VALUE) {
			pl(sum);
		}
		else {
			pl(-1);
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public double nextFloat() {
			return Float.parseFloat(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	public static void exit() {
		System.exit(0);
	}
	static long root(long a) {

		int ketasu=0;
		long tmp=a;
		while(tmp>0) {
			ketasu++;
			tmp/=10;
		}
		int constant=(ketasu+1)/2;	//よく使うので定数化
		if(ketasu>=1) {
			long[] suuji=new long[constant];
			tmp=a;
			for(int i=0; i<constant; i++) {
				suuji[constant-1-i]=a%100;
				a/=100;
			}
			long ans=0;
			long kai=0;
			long mae=0;
			if(constant<=1) {
				for(int i=10; i>=0; i--) {
					if(suuji[0]>=i*i) {
						return i;
					}
				}
			}
			else {
				for(int i=0; i<constant; i++) {
					mae+=kai*2;
					for(int j=9; j>=0; j--) {
						if((mae*10+j)*j<=suuji[i]) {
							ans=ans*10+j;
							mae*=10;
							kai=j;
							if(i+1<constant) {
								suuji[i+1]+=(suuji[i]-(mae+j)*j)*100;
							}
							break;
						}
					}
				}
			}
			return ans;
		}
		else {
			return 0;
		}
	}
	public static long ketawa(long a, long tei) {
		long sum=0;
		while(a>0) {
			sum+=a%tei;
			a/=tei;
		}
		return sum;
	}
}


Measured memory_bytes: 23124
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

int N;
i64 c[505];
i64 s[505];
i64 f[505];

i64 slv(int p)
{
  i64 t = 0;
  for (; p < N-1; ++p) {
    i64 leaveTime = max(s[p], (t + f[p] - 1) / f[p] * f[p]);
    t = leaveTime + c[p];
  }
  return t;
}

signed main()
{
  cin >> N;
  for (int i = 0; i < N-1; ++i) {
    cin >> c[i] >> s[i] >> f[i];
  }

  for (int i = 0; i < N; ++i) {
    cout << slv(i) << endl;
  }
  return 0;
}



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

int main() {
    string S, T, rotated;
    cin >> S >> T;
    int length_S = S.length();
    rotated = S;
    bool is_true = false;
    for (int i=0;i<length_S;i++)
    {
        rotated[0] = S[length_S - 1];
        for (int j=0;j<length_S ;j++) {
            rotated[j + 1] = S[j];
        }
        if (rotated == T)
        {
            is_true = true;
            break;
        }
        S = rotated;
    }
    if(is_true) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
function main(input) {
  const inArray = input.trim().split(/\s|\n/);
  const pre = parseInt(inArray[0].slice(0, 2));
  const sre = parseInt(inArray[0].slice(2, 4));
  const isYear = (s) => (s >= 0) && (s <= 99);
  const isMonth = (s) => (s >= 1) && (s <= 12);
  if (isYear(pre) && isMonth(sre)) {
    if (isYear(sre) && isMonth(pre)) {
      console.log('AMBIGUOUS');
    } else {
      console.log('YYMM');
    }
  } else {
    if (isYear(sre) && isMonth(pre)) {
      console.log('MMYY');
    } else {
      console.log('NA');
    }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
void output(int x){
	if(x==0)return;
	if(x%2==0){
		output(x/(-2));
		putchar('0');
	}else{
		output((x-1)/(-2));
		putchar('1');
	}
}
int main(){
	int n;
	scanf("%d",&n);
	if(n==0)puts("0");else{
		output(n);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class C {
    public static void main(String...args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int[] x = new int[N + 1];
        final int[] y = new int[N + 1];
        final int[] t = new int[N + 1];
        for(int i = 1; i <= N; i++) {
            t[i] = sc.nextInt();
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }
        for(int i = 1; i <= N; i++) {
            final int dist = Math.abs(x[i] - x[i - 1]) + Math.abs(y[i] - y[i - 1]);
            if(dist > t[i] - t[i - 1] || (dist - t[i] + t[i - 1]) % 2 != 0) {
                System.err.println(dist + " " + i);
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}
public class Main {
    public static void main(String... args) {
        C.main(args);
    }
}

Measured memory_bytes: 92040
a, b, c, d = map(int, input().split())

turn = 0
state = [[a, b], [c, d]]

while state[0][0] > 0 and state[1][0] > 0:
    opp = 1 - turn
    state[opp][0] = state[opp][0] - state[turn][1]
    turn = opp

if state[0][0] <= 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 61816
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1e9;
const long long LONG_INF = 1e18;
const long long MOD = 1e9 + 7;

using namespace std;

int main()
{

    int n, k;
    cin >> n >> k;
    vector<int> dp(n, INT_INF);
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    dp[0] = 0;

    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j <= i + k; j++)
        {
            if (j >= n)
            {
                break;
            }
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }

    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
  	int N, d[100], i, j, sum=0;
  
  	scanf("%d", &N);
  
  	for(i=0; i<N; i++){
      	scanf("%d", &d[i]);
    }
  
  	for(i=0; i<N; i++){
      	for(j=i+1; j<N; j++){
          	sum += d[i] * d[j];
        }
    }
  
  	printf("%d", sum);
  
  	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

template<class T>
struct Vec2
{
	Vec2(){}
	Vec2(T _x, T _y) : x(_x), y(_y) {}

	Vec2 operator+(const Vec2& rhs) const { return Vec2(x + rhs.x, y + rhs.y); }
	Vec2 operator-(const Vec2& rhs) const { return Vec2(x - rhs.x, y - rhs.y); }
	Vec2 operator*(T s) const { return Vec2(x*s, y*s); }
	T dot(const Vec2& rhs) const { return x*rhs.x + y*rhs.y; }
	T cross(const Vec2& rhs) const { return x*rhs.y - y*rhs.x; }
	double length() const { return sqrt(1.0*x*x + 1.0*y*y); }
	bool operator<(const Vec2& rhs) const
	{
		if (x != rhs.x) return x < rhs.x;
		return y < rhs.y;
	}

	T x;
	T y;
};

int main()
{
	typedef Vec2<double> Vec2;

	double x1, y1, x2, y2, r;
	cin >> x1 >> y1 >> x2 >> y2 >> r;
	Vec2 P(x1, y1), C(x2, y2);
	Vec2 D = P - C;
	double dc = D.length();
	D = D*(1.0 / dc);
	double t = acos(r/dc);
	Vec2 m = D*r*cos(t) + C;
	double h = dc * r * sin(t) / dc;
	Vec2 int1 = m + Vec2(D.y, -D.x) * h;
	Vec2 int2 = m + Vec2(-D.y, D.x) * h;
	if (int2 < int1) {
		swap(int1, int2);
	}
	printf("%.10lf %.10lf\n%.10lf %.10lf\n", int1.x, int1.y, int2.x, int2.y);
	return 0;
}


Measured memory_bytes: 3520
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a;
	map<int,int>c;
	cin>>n;
	while(n--){
		cin>>a;
		if(!c[a])c[a]=1;
		else return puts("NO"),0;
	}
	return puts("YES"),0;
}

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

const int INF=INT_MAX/2;

int main(){
  int N; cin>>N;
  int a[N],mi=INF,ma=-INF,mi_ind=0,ma_ind=0;
  rep(i,N){
    cin>>a[i];
    if(a[i]<mi){
      mi=a[i];
      mi_ind=i;
    }
    if(a[i]>ma){
      ma=a[i];
      ma_ind=i;
    }
  }
  if(mi>=0&&ma>=0){
    cout<<N<<endl;
    cout<<ma_ind+1<<" "<<1<<endl;
    rep(i,N-1) cout<<i+1<<" "<<i+2<<endl;
  }else if(ma>=0){
    if(ma>=abs(mi)){
      cout<<2*N-1<<endl;
      rep(i,N){
        if(i==ma_ind) continue;
        cout<<ma_ind+1<<" "<<i+1<<endl;
      }
      cout<<ma_ind+1<<" "<<ma_ind+1<<endl;
      rep(i,N-1) cout<<i+1<<" "<<i+2<<endl;
    }else{
      cout<<2*N-1<<endl;
      rep(i,N){
        if(i==mi_ind) continue;
        cout<<mi_ind+1<<" "<<i+1<<endl;
      }
      cout<<mi_ind+1<<" "<<mi_ind+1<<endl;
      for(int i=N-1;i>0;i--) cout<<i+1<<" "<<i<<endl;
    }
  }else{
    cout<<N<<endl;
    cout<<mi_ind+1<<" "<<N<<endl;
    for(int i=N-1;i>0;i--) cout<<i+1<<" "<<i<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 10000
#define NIL -1

typedef struct { int parent, left, right;} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u,int d) {
  if(u == NIL) return;
  D[u] = d;
  setDepth(T[u].left, d+1);
  setDepth(T[u].right,d+1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if(T[u].left != NIL)
    h1 = setHeight(T[u].left) + 1;
  if(T[u].right != NIL)
    h2 = setHeight(T[u].right) + 1;
  return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u) {
  if( T[u].parent == NIL ) return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u) {
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  int deg = 0;
  if(T[u].left  != NIL) deg++;
  if(T[u].right != NIL) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  
  if(T[u].parent == NIL) {
    printf("root\n");
  } else if(T[u].left == NIL && T[u].right == NIL) {
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

int main(void) {
  int v, l, r, root = 0;
  scanf("%d",&n);
  for(int i=0;i<n;i++) T[i].parent = NIL;
  for(int i=0;i<n;i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].left  = l;
    T[v].right = r;
    if(l != NIL) T[l].parent = v;
    if(r != NIL) T[r].parent = v;
  }
  
  for(int i=0; i<n; i++)
  if(T[i].parent == NIL) root = i;
  
  setDepth(root,0);
  setHeight(root);
  
  for(int i=0;i<n;i++) print(i);
  
  return 0;
}




Measured memory_bytes: 2108
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a == 1 or b == 1) {
    cout << 1;
    return 0;
  }
  double c = a;
  double d = b;
  ll e = ceil(c*d / 2);
  cout << e;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> vec;
vec.at(i)
vector<vector<int>> vec(10, vector<int>(10));
sort(all(vec));
sort(all(vec), greater<int>());
    //配列の内容表示
dout << "====vecの内容====\n";
for (int i = 0; i < N; i++) dout << vec[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
a = int(input())
count = 0
b = a / 100
reserch_1 = b // 1
if (reserch_1 == 1):
    a = a - 100
    count = count + 1

c = a /10
reserch_2 = c // 1
if (reserch_2 == 1):
    a = a - 10
    count =count + 1

reserch_3 = a // 1
if(reserch_3 == 1):
    count =count + 1
print(count)
    

Measured memory_bytes: 9108
#include<stdio.h>
main()
{
	int N,K,X,Y=0;
	1<=N,K<=10000,1<=Y<X<=10000;
	scanf("%d%d%d%d",&N,&K,&X,&Y);
	if(N<=K){
		printf("%d",X*N);
	}else{
		printf("%d",X*K+(N-K)*Y);
	}
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

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

    int r, d, x, y;
    int i;
    cin >> r >> d >> x;
    for (i = 0; i < 10; ++i) {
      if (i == 0) {
        y = r * x - d;
      } else {
        y = r * y - d;
      }
      cout << y << '\n';
    }

    return 0;
}


Measured memory_bytes: 256