akhauriyash/Code-Regression huggingface dataset:
import math

N = int(input())
ta = list(map(int, input().split()))
T, A = ta[0], ta[1]

# 繰り返し
for i in range(N - 1):
    tmp_ta = list(map(int, input().split()))
    t, a = tmp_ta[0], tmp_ta[1]
    # print("(t,a):" + str(t) + " " + str(a))
    # T,Aが各々t,aの倍数かつそのような比になればいい.
    # Tが最小 ->　Aも最小になる
    # ダメ.小さい方を揃えないと(3,3) -> (3,2)のような変化になる
    # (2,5) -> (2,4)でも死にそう
    # (2,5) -> (4,8)になるのが良さそう -> なっている
    # (1,2) -> (2,1) は？　(4,2)が答 -> なっている
    # intの範囲超えてintキャストしたら死ぬ,それはそう
    # どっちかを最小にすればいいんじゃないか？
    # まずt基準
    tmpTt = T if T % t == 0 else (T // t + 1) * t
    tmpTa = tmpTt * a // t
    tmpAa = A if A % a == 0 else (A // a + 1) * a
    tmpAt = tmpAa * t // a
    # print(str(tmpAt) + " " + str(tmpAa) + " " + str(tmpTt) + " " + str(tmpTa))
    if tmpTa < A:
        T = tmpAt
        A = tmpAa
    elif tmpAt < T:
        T = tmpTt
        A = tmpTa
    elif (tmpTt + tmpTa) < (tmpAa + tmpAt):
        T = tmpTt
        A = tmpTa
    else:
        T = tmpAt
        A = tmpAa
    # print("(T, A) = (" + str(T) + ", " + str(A) + ")")

print(T + A)


Measured memory_bytes: 39280
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod 1000000007
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class DReplacing {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin>>n;
        ll f[100005]={0};
        ll sum=0,a;
        for (int i=0;i<n;i++){
            cin>>a;
            sum+=a;
            f[a]++;
        }
        int q;
        cin>>q;
        while (q--){
            ll b,c;
            cin>>b>>c;
            sum=sum-f[b]*b+f[b]*c;
            f[c]+=f[b];
            f[b]=0;
            cout<<sum<<endl;
        }
	}
};


int main() {
	DReplacing solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
	int i;
	string s;
	getline(cin,s);
	for(i=0;i<s.size();i++){
		if('a'<=s[i]&&s[i]<='z') s[i]-=32;
		else if('A'<=s[i]&&s[i]<='Z') s[i]+=32;
		cout<<s[i];
	}
	cout<<endl;
	return 0;
}



Measured memory_bytes: 3200
X, K, D = map(int, input().split())
A = abs(X)//D
if K>=A and (K-A)%2==0:
  print(abs(X)%D)
elif K>=A and (K-A)%2==1:
  print(abs(abs(X)%D-D))
else:
  print(abs(X)-K*D)


Measured memory_bytes: 9168
Imports System

Module Module1

    Sub Main(args As String())

        Dim N As Integer = Console.ReadLine()
        Dim tmp As String() = Split(Console.ReadLine(), " ")
        Dim A As Long
        Dim wk As Long = 1
        Dim i As Integer

        Try

            For i = 0 To N - 1
                A = CLng(tmp(i))
                If A = 0 Then
                    Console.WriteLine(0)
                    Exit Sub
                End If
                wk = wk * A
            Next

            If wk > CLng(10 ^ 18) Then
                Console.WriteLine(-1)
                Exit Sub
            End If

            Console.WriteLine(wk)

        Catch ex As Exception

            Do While i <= N - 1
                If CLng(tmp(i)) = 0 Then
                    Console.WriteLine(0)
                    Exit Sub
                End If
                i += 1
            Loop
            Console.WriteLine(-1)

        End Try

    End Sub

End Module



Measured memory_bytes: 151912
from itertools import combinations
from collections import defaultdict

N = int(input())
L = list(map(int, input().split()))
L_ = sorted(L)
d = defaultdict(int)

for l in L_:
    d[l] += 1

n = 0
for i in range(2001):
    n += d[i]
    d[i] += n - d[i]

ans = 0

for a, b in combinations(L_, 2):
    #print(a, b, d[a+b-1], d[abs(a-b)], d[a+b-1] - d[abs(a-b)])
    n =  d[a+b-1] - d[abs(a-b)]
    if abs(a-b) < a:
        ans -= 1
    if abs(a-b) < b:
        ans -= 1
    ans += n
    
print(ans//3)


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

using ll = long long;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

int R;

int main() {
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  cin>>R;
  
  if(R<1200)cout<<"ABC"<<endl;
  else if(R<2800)cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;

  return 0;
}


Measured memory_bytes: 256
n,a,b = map(int, input().split())
X = list(map(int, input().split()))

# 1移動でA　テレポートでB
now = X[0]
ans = 0
for x in X[1:]:
    if abs(now-x)*a < b: ans += abs(now-x)*a
    else: ans += b
    now = x
print(ans)

Measured memory_bytes: 20036
#include <bits/stdc++.h>
#define ll long long
const ll inf=(1LL<<62);
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A> inline A abs(A &a) { return (a < 0 ? -a : a); }
using namespace std;
ll a[1000000][3], dp[1000000][3];
signed main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) { 
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) {
          continue;
        }
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < 3; i++) {
    chmax(ans, dp[n][i]);
  }
  cout << ans << "\n";

  return(0);
}


Measured memory_bytes: 8248
#include <stdio.h>

int main(void) {
  int H, W, i, j;

  for (; scanf("%d %d", &H, &W); ) {
    if (H == W && H == 0) {
      break;
    }

    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        putchar('#');
      }

      putchar('\n');
    }

    putchar('\n');
  }

  return 0;
}

Measured memory_bytes: 572
import math
def combi(n,r):
    if r > n:return 0
    return math.factorial(n) // (math.factorial(n - r)*(math.factorial(r)))


def solve(i,k,smaller):
    #一番最後の桁まで調べたら終了
    if i == N:
        if k == 0:return 1
        else: return 0

    #途中であっても0以外の数字を使い切ったら終了
    if k == 0:return 1

    #Nより小さいことが確定すれば残りの桁数（N-i）のうち
    #k個所に0以外の数字（9**k通り）を使い，それ以外の桁の数字は0なので
    #C(n-i,n-i-k)=C(n-i,k)個所に0をはめる
    if smaller: return combi(N-i, k)*(9**k)
    else:
        #i桁目が0なら，smallerであるといえない
        if S[i] == '0':return solve(i+1,k,False)
        else:
            zero = solve(i+1, k, True)
            aida = solve(i+1, k-1, True) * (int(S[i])-1)
            icchi = solve(i+1, k-1, False)
            return zero + aida + icchi

#0出ない数字がちょうどＫ個であるようなN以下の整数を探索
S = input()
N = len(S)
K = int(input())
print((solve(0,K,False)))

Measured memory_bytes: 3188
using System;
using System.IO;
using System.Linq;

namespace Graph_I
{
    class Connected_Components
    {
        static int[] connectTree;
        static int[] height;

        public static int Root(int x)
        {
            if (connectTree[x] == x) return x;
            else return connectTree[x] = Root(connectTree[x]);
        }

        public static void Connect(int x, int y)
        {
            x = Root(x);
            y = Root(y);

            if (x == y) return;

            if (height[x] < height[y])
                connectTree[x] = y;
            else
            {
                connectTree[y] = x;
                if (height[x] == height[y]) height[x]++;
            }
        }

        public static bool IsConnected(int x, int y) { return Root(x) == Root(y); }

        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var n = nm[0];
            var m = nm[1];

            connectTree = new int[n];
            height = new int[n];
            for (int i = 0; i < connectTree.Length; i++) connectTree[i] = i;

            for (int i = 0; i < m; i++)
            {
                var st = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
                var s = st[0];
                var t = st[1];
                Connect(s, t);
            }

            var q = int.Parse(Console.ReadLine());

            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            for (int i = 0; i < q; i++)
            {
                var st = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
                Console.WriteLine(IsConnected(st[0], st[1]) ? "yes" : "no");
            }
            Console.Out.Flush();

            Console.ReadLine();
        }
    }
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var read = "";
            while (!string.IsNullOrEmpty(read = Console.ReadLine()))
            {
                var data = read.Split().Select(s => int.Parse(s)).ToArray();

                if (data[0] == 0 && data[1] == 0) break;

                for (var i = 0; i < data[0]; i++)
                {
                    for (var j = 0; j < data[1]; j++)
                    {
                        if (i == 0 || i == data[0] - 1 || j == 0 || j == data[1] - 1)
                        {
                            Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}



Measured memory_bytes: 16312
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    int k; cin >> k;
    map<int,int> mp;
    rep(i,n) {
        int a; cin >> a;
        ++mp[a];
    }
    vector<int> v;
    for(const auto p: mp) {
        v.push_back(p.second);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for(int i = 0; i < (int)v.size()-k; ++i) {
        ans += v[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10748
s=input()
i=0 #文字の判定
while i==0:
  if len(s)==0:
    print("YES")
    exit()

  if s[0:5]=="dream":
    if s[0:7]=="dreamer":
      if s[5:11]=="eraser":
        s=s[11:]
      elif s[5:10]=="erase":
        s=s[10:]
      else:
        s=s[7:]
    else:
      s=s[5:]
  elif s[0:5]=="erase":
    if s[0:6]=="eraser":
      s=s[6:]
    else:
      s=s[5:]
  else:
    i+=1
print("NO")

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main()
{
char s;
int i;
char arr[26]={'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'};
cin>>s;
for (i=0;i<26;i++)
   if(s==arr[i])
cout <<arr[i+1];

    return 0;
}

Measured memory_bytes: 256
INF = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))
rui = [0] * (N + 1)
for i in range(N):
    rui[i + 1] = A[i] + rui[i]

ans = 0
for i in range(N - 1):
    ans += (rui[N] - rui[i + 1]) * A[i]
    ans %= INF
print(ans % INF)


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

int main (){
    int N ;
    cin >> N ;
    int count = 0 ;
    vector<int> A(9) ;
    rep(i,N){
        int m ;
        cin >> m ;
        if( 1 <= m && m <= 399 ) A[0]++ ;
        if( 400 <= m && m <= 799 ) A[1]++ ;
        if( 800 <= m && m <= 1199 ) A[2]++ ;
        if( 1200 <= m && m <= 1599 ) A[3]++ ;
        if( 1600 <= m && m <= 1999 ) A[4]++ ;
        if( 2000 <= m && m <= 2399 ) A[5]++ ;
        if( 2400 <= m && m <= 2799 ) A[6]++ ;
        if( 2800 <= m && m <= 3199 ) A[7]++ ;
        if( 3200 <= m ) A[8]++ ;
    }
    rep(i,8){
        if( A[i] > 0 ) count++ ;
    }
    if(count == 0 ){
        cout << 1  << ' ' <<  A[8] << endl;
        return 0 ;
    }
    cout << count << ' ' << count + A[8] << endl;
    } 

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

int main() {

	int N = 0;
	cin >> N;

	vector<vector<int>> val(N, vector<int>(N));

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			val[i][j] = -1;
		}
		val[i][i] = 0;
	}

	int x = 0;
	int y = 0;

	int A = 0;

	for (int i = 0; i < N; i++) {
		cin >> A;
		for (int j = 0; j < A; j++) {
			cin >> x;
			cin >> y;
			x -= 1;

			val[i][x] = y;
		}
	}

	vector<int> ans;
	int dum = 0;
	int num = 0;
	int sum = 0;
	int d = 0;
	int r = 0;

	for (int k = 0; k < (int)pow(2, N); k++) {
		num = k;
		for (int l = N - 1; l >= 0; l--) {
			val[l][l] = num / (int)pow(2, l);
			num = num - val[l][l] * (int)pow(2, l);
		}
		dum = 0;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (val[j][j] == 1) {
					if (i != j && val[j][i] >= 0) {
						r = val[j][j] ^ 1;
						d = val[j][i] ^ r;
						if (d != val[i][i]) {
							dum += 1;
						}
					}
				}
			}
		}
		if (dum == 0) {
			sum = 0;
			for (int i = 0; i < N; i++) {
				sum += val[i][i];
			}
			ans.push_back(sum);
		}
	}

	int ansval = 0;

	if (ans.size() != 0) {
		ansval = *max_element(ans.begin(), ans.end());
	}
	else {
		ansval = 0;
	}
	
	cout << ansval << endl;

	return 0;
}




Measured memory_bytes: 512
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>

using namespace std;
typedef long long ll;

int gcd(int a, int b)
{
	int c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	bool ans = false;
	if (A[N - 1] >= K) {
		int G = A[0];
		for (int i = 0; i < N; i++) {
			auto mm = minmax(G, A[i]);
			G = gcd(mm.second, mm.first);
		}
		for (int i = 0; i < N; i++) {
			int k = abs(K - A[i]);
			if (k % G == 0) {
				ans = true;
				break;
			}
		}
	}
	cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
using tpl = tuple<char, int>;
typedef pair<int,int> pii;
typedef long long ll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

const int mod = 1000000007;

int N;
char field[2][60];
int dp[2*60][4][4];



int rec(int pos, int uc, int dc){
    if(dp[pos][uc][dc] >= 0) 
        return dp[pos][uc][dc];
    ll res = 0;
    if(pos == N * 2){
        res = 1;
    }
    else{
        const int y = pos % 2;
        const int x = pos / 2;
        // 横に塗る場合
        if(x + 1 < N && field[y][x + 1] == field[y][x]){
            for(int i = 0; i < 3; i++){
                if(y == 0 && uc == i) continue;
                if(y == 1 && (dc == i || uc == i)) continue;
                if(y == 0) res = (res + rec(pos + 1, i, dc)) % mod;
                if(y == 1) res = (res + rec(pos + 1, uc, i)) % mod;
            }
        }
        // 縦に塗る場合
        else if(y + 1 < 2 && field[y + 1][x] == field[y][x]){
            for(int i = 0; i < 3; i++){
                if(uc == i || dc == i) continue;
                res = (res + rec(pos + 1, i, i)) % mod;
            }
        }
        // 塗らない場合
        else{
            res = (res + rec(pos + 1, uc, dc)) % mod;
        }
    }
    return dp[pos][uc][dc] = res;
}

int main(){
    cin >> N;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++){
            cin >> field[i][j];
        }
    }

    memset(dp, -1, sizeof(dp));
    // 左から順番に上、下、上、下と配置していく
    cout << rec(0, 3, 3) << endl;

    return 0;
}


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

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

  int count = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == 'x') {
      count++;
    }
  }
    if(count >= 8) {
  cout << "NO" << endl;
}
 else {
  cout << "YES" << endl;
}

}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();

		int a1 = a+b;
		int a2 = a - b;
		int a3 = a * b;

		if(a1 >= a2 && a1 >= a3){
			System.out.println(a1);
		}else

		if(a2 >= a1 && a2 >= a3){
			System.out.println(a2);
		}else

		if(a3 >= a1 && a3 >= a2){
			System.out.println(a3);
		}


	}
}

Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

int main() {
    ll n, k, s; cin >> n >> k >> s;
    ll tmp;
    if(s==1) {
        tmp = 2;
    } else {
        tmp = s-(ll)1;
    }
    if(k==0) {
        for(int i=0; i<n; i++) {
            if(i==n-1) {
                cout << tmp << endl;
            } else {
                cout << tmp << " ";
            }
        }
    } else if(k>0&k<n) {
        for(int i=0; i<k; i++) {
            cout << s << " ";   
        }
        for(int i=k; i<n; i++) {
            if(i==n-1) {
                cout << tmp << endl;
            } else {
                cout << tmp << " ";
            }
        }
    } else {
        for(int i=0; i<n; i++) {
            if(i==n-1) {
                cout << s << endl;
            } else {
                cout << s << " ";
            }   
        }
    }
    return 0;
}

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }
UINT luin() { UINT x; scanf("%llu", &x); return x;}


int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    INT N = lin();
    std::vector<INT> vecA;
    for (INT i = 0; i < N; ++i) {
        vecA.push_back(lin());
    }

    INT nAns = 0;
    std::map<INT, INT> mapY;
    for (INT i = 1; i < N; ++i) {
        INT Xi = (i + 1) - vecA[i];

        INT Yi_1 = i + vecA[i-1];
        auto it = mapY.find(Yi_1);
        if (it == mapY.end()) {
            mapY.insert(make_pair(Yi_1, 1));
        }
        else {
            ++(*it).second;
        }

        auto it2 = mapY.find(Xi);
        if (it2 != mapY.end()) {
            nAns += it2->second;
        }
    }

    printf("%lld", nAns);

    return 0;
}







Measured memory_bytes: 17124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

    int x,a;
    cin >> x >> a;
    if(x<a)cout << 0 <<endl;
    else cout << 10 << endl;
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop

N, M = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(M)]
LR.sort(key=lambda a: (a[0], -a[0]))

R = 10**18
ans = 0
for l, r in LR:
    if R <= l:
        ans += 1
        R = 10**18
    R = min(R, r)

print(ans + 1)


Measured memory_bytes: 27856
import java.util.*;

public class Main {
    private static final String EOF = "END OF INPUT";

    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            String str;
            while(!(str = scn.nextLine()).equals(EOF)) {
                String[] ary = str.split(" ");
                for(String elm : ary) {
                    System.out.print(elm.length());
                }
                System.out.println();
            }
        }
    }
}

Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
#define R(i,n) for(int i = 0; i < (n); i++)

signed main(){
    int n,a=1e9,c[2][20];
    cin>>n;
    R(i,n)cin>>c[0][i];
    R(i,n)cin>>c[1][i];
    vector<vector<int>> dp(1<<n,vector<int>(51,1e9));
    dp[0][0]=0;
    R(B,1<<n){
        int now=0,d[n];
        R(i,n)if(!(B&1<<i))d[i]=now++;
        int cnt=n-now;
        R(i,n){
            int k=abs(i-cnt);
            R(j,c[k%2][i]+1) dp[B|1<<i][c[k%2][i]]=min(dp[B|1<<i][c[k%2][i]],dp[B][j]+d[i]);
        }
    }
    R(i,51)a=min(a,dp[(1<<n)-1][i]);
    cout<<(a==1e9?-1:a);
}

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

const long MOD = 1e9 + 7;
const string c[4] = {"A", "G", "C", "T"};
const vector<string> ng3 = {"AGC", "GAC", "ACG"};
const vector<string> ng4 = {"AGGC", "ACGC", "ATGC", "AGAC", "AGGC", "AGTC"};

struct Matrix64{
	long m[64][64];
	Matrix64() {fill(m[0], m[64], 0);}
	long& at(int i, int j) {return m[i][j];}
	const long& at(int i, int j) const {return m[i][j];}
	Matrix64 operator*(const Matrix64& other) const{
		Matrix64 out;
		for (int i = 0; i < 64; ++i){
			for (int j = 0; j < 64; ++j){
				out.at(i, j) = 0;
				for (int k = 0; k < 64; ++k){
					(out.at(i, j) += this->at(i, k)*other.at(k, j)) %= MOD;
				}
			}
		}
		return out;
	}
	Matrix64& operator=(const Matrix64& other){
		for (int i = 0; i < 64; ++i){
			for (int j = 0; j < 64; ++j){
				m[i][j] = other.at(i, j);
			}
		}
		return *this;
	}
};

Matrix64 matrixPow(const Matrix64& A, int n){
	if (n == 1){return A;}
	else if (n == 2){return A*A;}
	else if (n % 2 == 0){return matrixPow(matrixPow(A, n/2), 2);}
	else{return matrixPow(A, n-1)*A;}
}

int n;
long dp[4*4*4];
Matrix64 a;
long ans;
string s1, s2;
vector<string>::const_iterator p;

void quad2dec(long n, long& a1, long& a4, long& a16){
	a16 = n / 16; n %= 16;
	a4 = n / 4; n %= 4;
	a1 = n;
}

string quad2str(long n){
	long i, j, k;
	quad2dec(n, i, j, k);
	return (c[i] + c[j] + c[k]);
}

int main(){
	cin >> n;
	fill(dp, dp+64, 0);

	for (int i = 0; i < 4*4*4; ++i){
		s1 = quad2str(i);
		for (int j = 0; j < 4*4*4; ++j){
			s2 = quad2str(j);
			if (s1.substr(1, 2) == s2.substr(0, 2)){
				p = find(ng3.begin(), ng3.end(), s1.substr(1, 2) + s2.substr(2, 1));
				if (p != ng3.end()) continue;
				p = find(ng3.begin(), ng3.end(), s1);
				if (p != ng3.end()) continue;
				p = find(ng3.begin(), ng3.end(), s2);
				if (p != ng3.end()) continue;
				p = find(ng4.begin(), ng4.end(), s1 + s2.substr(2, 1));
				if (p != ng4.end()) continue;
				a.at(i, j)++;
			}
		}
	}

	for (int i = 0; i < 4*4*4; ++i){
		p = find(ng3.begin(), ng3.end(), quad2str(i));
		dp[i] = (p == ng3.end()) ? 1 : 0;
	}

	ans = 0;
	if (n == 3){
		for (int i = 0; i < 64; ++i){(ans += dp[i]) %= MOD;}
	}
	else {
		a = matrixPow(a, n - 3);
		for (int i = 0; i < 64; ++i){
			for (int j = 0; j < 64; ++j){
				(ans += a.at(i, j)*dp[j]) %= MOD;
			}
		}
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	string s;
	cin >> s;
	s+='X';

	int ans=0;
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='A' or s[i]=='T' or s[i]=='C' or s[i]=='G')
			cnt++;
		else
		{
			ans=max(ans,cnt);
			cnt=0;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif

int main_A() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int N = 3;
    vi A(N); REP(i, N) cin >> A[i];
    sort(A.begin(), A.end());

    int ans = 0;
    FOR(i, 1, N) ans += A[i] - A[i - 1];
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.141592653589793238462643383279

int main(){
    double a, b, c, x;
    double angle;
    scanf("%lf %lf %lf", &a, &b, &x);
    c = (2 * x) / (a * b);
    if (c <= a){
        angle = b / c;
    }
    else{
        c = (2 * (a * a * b - x)) / (a * a);
        angle = c / a;
    }
    printf("%.10lf", atan(angle) / PI * 180);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c,d,x,y=0,n;
  char s[100];
  cin>>a;
  if(a<1200)
    cout<<"ABC"<<endl;
  else
    cout<<"ARC"<<endl;
  return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const ll INF = LLONG_MAX/3;

/*-----Library-----*/

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
//コンビネーション
/*
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
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 % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
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] % MOD) % MOD;
}
 */
/*-----Library-----*/
const int MOD=1234567;
signed main(){
	cout<<"square1001"<<endl;
}



Measured memory_bytes: 3012
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

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

int N,K;


int main() {

	scanf("%d%d", &N,&K);


	if (K == 1) printf("0\n");
	else printf("%d\n", N - K);

	return 0;
}


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

const int N = 500000;

char s[N];
int dp[N + 1][3];

void update(int& x, int a)
{
    x = std::max(x, a);
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("D.in", "r", stdin);
#endif
    int n;
    scanf("%d", &n);
    scanf("%s", s);
    memset(dp, -1, sizeof(dp));
    dp[0][0] = 0;
    for (int i = 0; i < n; ++ i) {
        for (int j = 0; j < 3; ++ j) {
            if (dp[i][j] == -1) {
                continue;
            }
            if (s[i] == '0') {
                if (j != 2) {
                    update(dp[i + 1][0], dp[i][j]);
                }
            } else {
                if (j != 2) {
                    update(dp[i + 1][0], dp[i][j]);
                }
                if (j == 0) {
                    update(dp[i + 1][2], dp[i][j] + 1);
                }
                if (j == 1) {
                    update(dp[i + 1][1], dp[i][j] + 1);
                }
                if (j == 2) {
                    update(dp[i + 1][2], dp[i][j] + 1);
                }
                if (i + 2 < n && s[i + 1] == '0' && s[i + 2] == '1') {
                    if (j == 2) {
                        update(dp[i + 3][0], dp[i][j] + 1);
                    } else {
                        update(dp[i + 3][1], dp[i][j] + 1);
                    }
                }
            }
        }
    }
    printf("%d\n", std::max(dp[n][0], dp[n][1]));
}

Measured memory_bytes: 6904
use std::cmp::min;

const INF: usize = 1 << 60;
const X: usize = 6001;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let mut graph = vec![vec![]; n];
    for i in 1..n {
        let p = sc.read::<usize>() - 1;
        graph[p].push(i);
    }

    let x: Vec<usize> = sc.vec(n);
    let (a, _) = dfs(0, &graph, &x);
    if a != INF {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}

fn dfs(v: usize, graph: &Vec<Vec<usize>>, x: &Vec<usize>) -> (usize, usize) {
    if graph[v].is_empty() {
        return (0, x[v]);
    }

    let mut dp = vec![INF; X];
    dp[0] = 0;
    for &child in graph[v].iter() {
        let mut next = vec![INF; X];
        let (a, b) = dfs(child, graph, x);
        for cur in 0..X {
            if cur + a < X {
                next[cur + a] = min(next[cur + a], dp[cur] + b);
            }
            if cur + b < X {
                next[cur + b] = min(next[cur + b], dp[cur] + a);
            }
        }
        dp = next;
    }

    let mut ans = INF;
    for i in 0..X {
        if dp[i] <= x[v] {
            ans = min(ans, i);
        }
        if i <= x[v] {
            ans = min(ans, dp[i]);
        }
    }
    (ans, x[v])
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 55796
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int>vp[n];
    for(int i=0;i<m;i++)
    {
        int f,s;
        cin>>f>>s;
        f--;s--;
        vp[f].push_back(s);
        vp[s].push_back(f);
    }
    vector<int>count(n,0);
    for(int i=0;i<n;i++)
    {
        count[i]=vp[i].size();
    }
    queue<int>q;
    vector<bool>visited(n,false);
    for(int i=0;i<count.size();i++)
    {
        if(count[i]==1)
        {
            q.push(i);
        }
    }
    while(!q.empty())
    {
        int element=q.front();
        q.pop();    
        visited[element]=true;
        count[element]=0;
        for(int i=0;i<vp[element].size();i++)
        {
            if(!visited[vp[element][i]])
            {
                if(count[vp[element][i]]==2){
                    q.push(vp[element][i]);
                }
                else
                {
                    count[vp[element][i]]--;
                }
            }
        }
    }
    int finalcount=0;
    for(int i=0;i<n;i++)
    {
        finalcount+=count[i];
    }
    cout<<m-finalcount/2;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

struct Node {
  int id;
  Node* parent = nullptr;
  Node* left = nullptr;
  Node* right = nullptr;
  int depth;
  int height;

  int calcHeight() {
    int leftHeight = left ? left->calcHeight() : -1;
    int rightHeight = right ? right->calcHeight() : -1;
    height = max(leftHeight, rightHeight) + 1;
    return height;
  }

  void calcDepth() {
    depth = parent ? parent->depth + 1 : 0;
    if (left) left->calcDepth();
    if (right) right->calcDepth();
  }

  int degree() {
    int d = 0;
    if (left) ++d;
    if (right) ++d;
    return d;
  }

  Node* sibling() {
    if (!parent) {
      return nullptr;
    }
    if (parent->left == this) {
      return parent->right;
    } else {
      return parent->left;
    }
  }

  void walkPreorder() {
    cout << " " << id;
    if (left) left->walkPreorder();
    if (right) right->walkPreorder();
  }

  void walkInorder() {
    if (left) left->walkInorder();
    cout << " " << id;
    if (right) right->walkInorder();
  }

  void walkPostorder() {
    if (left) left->walkPostorder();
    if (right) right->walkPostorder();
    cout << " " << id;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int nodeCount;
  cin >> nodeCount;
  vector<Node> nodes(nodeCount);

  for (int i = 0; i < nodeCount; ++i) {
    int id, left, right;
    cin >> id >> left >> right;
    nodes[id].id = id;
    if (left >= 0) nodes[id].left = &nodes[left];
    if (right >= 0) nodes[id].right = &nodes[right];
    nodes[left].parent = &nodes[id];
    nodes[right].parent = &nodes[id];
  }
  Node* root = nullptr;
  for (int i = 0; i < nodeCount; ++i) {
    if (nodes[i].parent == nullptr) {
      root = &nodes[i];
      break;
    }
  }

  cout << "Preorder" << endl;
  root->walkPreorder();
  cout << endl;

  cout << "Inorder" << endl;
  root->walkInorder();
  cout << endl;

  cout << "Postorder" << endl;
  root->walkPostorder();
  cout << endl;
}



Measured memory_bytes: 3148
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;
using System.Numerics;

public class Program
{
    public void Solve()
    {
        int S = Reader.Int(), N = Reader.Int();
        var A = Reader.IntArray(N);
        int max = A.Max();
        int other = S - max;
        if (max <= other) Console.WriteLine(0);
        else Console.WriteLine(Math.Max(0, max - other - 1));
    }

}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

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

#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 100100;
const long long mod = 1e9 + 7;
const long long block = 500;

using namespace std;

int n;
int k;

void solve()
{
        cin >> n >> k;
        int mx = 0, g = 0;
        for(int i = 1; i <= n; i++){
                int x;
                cin >> x;
                mx = max(mx, x);
                g = __gcd(g, x);
        }
        if(k <= mx && k % g == 0){
                cout << "POSSIBLE" << "\n";
        }
        else{
                cout << "IMPOSSIBLE" << "\n";
        }
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("landscape.in");
        //fout("landscape.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


Measured memory_bytes: 256
from math import ceil, sqrt

n = int(input())

p_map= {}
for i in range(2, ceil(sqrt(n))+1):
    while n % i == 0:
        n /= i
        if i not in p_map:
            p_map[i] = 1
        else:
            p_map[i] += 1
if n > 2:
    p_map[n] = 1

res = 0
for i, v in p_map.items():
    prev = 0
    for i in range(1, 41):
        current = prev+1
        if v < current:
            break
        v -= current
        res += 1
        prev = current
print(res)




Measured memory_bytes: 9272
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef unsigned long long int ulli;
typedef long long int lli;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

struct city
{
    char name[100];
    int p;
    int num;
    city* next;

    city()
    {
        next = nullptr;
    }
};

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

    int N;
    cin >> N;

    city *first;
    city *cities = new city[N]();
    first = nullptr;
    for (int i = 0; i < N; ++i)
    {
        cin >> cities[i].name >> cities[i].p;
        cities[i].num = i + 1;
        city **now = &first;

        while (*now != nullptr && strcmp((*now)->name, cities[i].name) < 0)
        {
            now = &(*now)->next;
        }
        if (*now == nullptr)
        {
            *now = &cities[i];
            cities[i].next = nullptr;
        }
        else if (strcmp((*now)->name, cities[i].name) > 0)
        {
            cities[i].next = *now;
            *now = &cities[i];
        }
        else
        {
            while (*now != nullptr && strcmp((*now)->name, cities[i].name) == 0 && (*now)->p > cities[i].p)
            {
                now = &(*now)->next;
            }
            if (*now == nullptr)
            {
                *now = &cities[i];
                cities[i].next = nullptr;
            }
            else
            {
                cities[i].next = *now;
                *now = &cities[i];
            }
        }
    }

    city *now = first;
    while (now != nullptr)
    {
        cout << now->num << "\n";
        now = now->next;
    }

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n; cin >> n;
  if(n) cout << 0;
  else cout << 1;
  return 0;
}

Measured memory_bytes: 3544
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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


l = lcm(*A)
#print(l)

ans = 0.0
for i in range(N):
    ans += float(l) / float(A[i])

ans = l/ans
if ans%1 == 0:
    ans = int(ans)

print(ans)



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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
//typedef long long int;
const ll M = 1000000007;
ll A, B, C, D, N, L, K, P, Q, R, W, X, Y, Z;
string S, T;

signed main(){
	std::cin >> N;
	int a[N];
	int flag=0;
	int z=0;
	if(N%3!=0)flag++;
	REP(i,N){std::cin >> a[i];}
	REP(i,N){if(a[i]!=0)z++;}
	sort(a, a+N);
	A=a[0];
	B=a[N/3];
	C=a[N*2/3];
	REP(i,N/3){if(a[i]!=A)flag++;}
	for(int i=N/3;i<N*2/3;i++){if(a[i]!=B)flag++;}
	for(int i=N*2/3;i<N;i++){if(a[i]!=C)flag++;}
	if((A ^ B) == C&&flag==0)std::cout << "Yes" << std::endl;
	else if(z==0)std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define n 300000
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
struct edge{
	int to, weight;
};
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
vector<edge> V[n + 50];
int a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;

void solve()
{
	cin >> a >> b;
	if(a > 9 || a < 1 || b > 9 || b < 1)
	{
		cout << "-1";
		return; 
	} 
	cout << a * b;
}

Measured memory_bytes: 8704
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int n, m, ans = 1;
    cin >> n >> m;
    vector<pair<int, int>> request;
    for(int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        request.push_back(pair<int, int>(b, a));
    }

    sort(request.begin(), request.end());
    pair<int, int> p;
    int b_min = request[0].first;
    for(int i=0; i<m; i++){
        pair<int, int> p = request[i];
        if(p.second >= b_min){
          b_min = p.first;
          ans++;
        }
    }

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


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

int main() {
  int A, ans = 0;
  cin >> A;
  while(ans == 0){
    if((A != 2) && (A % 2 == 0)){
      A++;
      continue;
    }  
    ans = A;
    int check = 3;
    while(check * check <= A){
      if(A % check == 0){
        ans = 0;
        break;
      }  
      check += 2;
    }  
    A++;
  }  
  cout << ans << endl;
  return 0;
}

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

class Program
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Array.Reverse(d);
        for(int i = 0; i < n ; i++)
        {
            if(i == n - 1)
            {
                Console.WriteLine(d[i]);
            }else
            {
                Console.Write(d[i] + " ");
            }
        }
    }
}


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

#define ff              first
#define ss              second
//#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int, int>
#define mci             map<char,int>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(i,x,y)  for(int i=x;i<y;i++)
#define repr(i,x,y) for(int i=x;i>=y;i--)

using namespace std;
 
int main()
{
    int N;
    cin>>N;
   if(N>=30)
    cout<<"Yes\n";
     else
        cout<<"No\n";
    return 0;
    }


Measured memory_bytes: 3576