akhauriyash/Code-Regression huggingface dataset:
var input = function(){
  return input= require('fs').readFileSync('/dev/stdin', 'utf8').split("\n").map(Number);
  };

var increment = function(x)
{
  return x+1;
}

var out = function(counter,x)
{
  console.log("Case " + increment(counter) + ": " + x );
  return x;
}

var Arr=input()
.forEach(function(element,index)
{
  if (element != 0)
  {
    out(index,element);
  }
}
);

Measured memory_bytes: 13200
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
    
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        int X1;cin>>X1;
        double X=(X1*(3.14159))/180;
        int ans=0;
        double x=0,y=0;
        while(1){
            x=x+cos(X*(ans+1));
            y=y+cos(90-X*(ans+1));
            ans++;
            if((abs(x))<=(1e-3)&&(abs(y))<=(1e-3))break;
            // if(x==0&&y==0)break;
            // dbg(x,y);
            // if(ans>=10){
            //     break;
            // }
        }
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

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


int main()
{
	int n, m;
	cin >> n >> m;
	int mini = 1;
	int maxi = 100000;
	bool flag = true;
	for (int i = 0; i < m; i++) {
		int l_in, r_in;
		cin >> l_in >> r_in;
		if (l_in > maxi || r_in < mini) {
			flag = false;
			break;
		} else {
			mini = max(mini, l_in);
			maxi = min(maxi, r_in);
		}
	}

	int ans = 0;
	if (flag == true) {
		ans = maxi - mini + 1;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

        String a = sc.next();
        String b = sc.next();
        String c = sc.next();

        a = a.toUpperCase();
        b = b.toUpperCase();
        c = c.toUpperCase();

        System.out.print(a.charAt(0));
        System.out.print(b.charAt(0));
        System.out.print(c.charAt(0));
    }
}

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

int main()
{
	int N;
	int a[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
    a[N] = 0;
	sort(a, a + N, greater<int>());
	int sum = 0;
	for (int i = 0; i < N; i += 2) {
		sum += a[i] - a[i + 1];
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
w = input()

hash = {}

for x in range(len(w)):
    hash[w[x]] = 0

for x in range(len(w)):
    hash[w[x]] += 1

beautiful = True
for v in hash.values():
    if v % 2 != 0:
        beautiful = False
if beautiful:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
n, m = map(int, input().split())
a = list(map(int, input().split()))
bitween = [0 for i in range(2 * m + 10)]
edge = [[] for i in range(m + 1)]

ans = 0
for i in range(n - 1):
	l, r = a[i], a[i + 1]
	if l >= r:
		r += m
	bitween[l + 2] += 1
	bitween[r + 1] -= 1

	edge[a[i + 1]].append(i)

for i in range(2 * m + 1):
	bitween[i + 1] += bitween[i]

ans = 0
for i in range(n - 1): # x = 1
	ans += min((a[i + 1] - a[i] + m) % m, (a[i + 1] - 1 + m) % m + 1)
prv = ans
for i in range(2, m + 1): # x >= 2
	crt = prv - bitween[i] - bitween[i + m]
	for j in edge[i - 1]:
		crt -= min((a[j + 1] - a[j] + m) % m, (a[j + 1] - (i - 1) + m) % m + 1)
		crt += min((a[j + 1] - a[j] + m) % m, (a[j + 1] - i + m) % m + 1 )
	ans = min(ans, crt)
	prv = crt
print(ans)


Measured memory_bytes: 28708
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t X;
  cin >> X;
  int64_t ans = 0;
  int64_t money =100;
  while(true){
    if(money >= X){
      break;
    }
    ans++;
    money += money/100;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
from queue import Queue
K = int(input())
q = Queue()
for i in range(1, 10):
    q.put(i)

for i in range(K):
    x = q.get()
    right = x % 10
    for j in range(max(0, right-1), min(right+2, 10)):
        q.put(x*10 + j)

print(x)

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

int main(){
  int A,B,C,D,count=0;
  cin >> A >> B;
  C=A;
  while(C<=B){
    D=C;
    int C1,C2,C3,C4,C5;
    C1=C%10,C/=10;
    C2=C%10,C/=10;
    C3=C%10,C/=10;
    C4=C%10,C/=10;
    C5=C%10,C/=10;
    C=D;
    if(C1==C5 && C2==C4){
      count++;
    }
    C++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef pair<int,int> P;
int n,m;
int l[200001],r[200001],d[200001];
long long int dist[100001];
bool used[100001];
struct Edge{int to,cost;};
vector<Edge> G[100001];
bool f=true;
void dfs(int v){
 
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    Edge e=G[v][i];
    if(!used[e.to]){
      dist[e.to]=dist[v]+e.cost;
      dfs(e.to);
    }
    /*
    else {
      if(dist[e.to]-dist[v]!=e.cost)f=false;
    }
    */
  }
}
int main(){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> l[i] >> r[i] >> d[i];
    l[i]--;r[i]--;
    Edge e;
    e.to=r[i];
    e.cost=d[i];
    G[l[i]].push_back(e);
    e.to=l[i];
    e.cost=-d[i];
    G[r[i]].push_back(e);
  }
  for(int i=0;i<n;i++){
    if(!used[i])dfs(i);
  }
  
  for(int i=0;i<m;i++){
    if(dist[r[i]]-dist[l[i]]!=d[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  

  /*
  if(f)cout << "Yes" << endl;
  else cout << "No" << endl;
  */
  return 0;
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

H = INT()

k = cnt = 0
while H > 0:
    H //= 2
    cnt += 2**k
    k += 1
print(cnt)


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

int main(){
    int N,M;
    cin >> N >> M;
    
    vector<pair<int,int>> hasi;
    rep(i,M){
        int x,y; cin >> x >> y;
        hasi.push_back(pair(y,x));
    }
    
    sort(hasi.begin(),hasi.end());
    
    int now = hasi[0].first;
    int ans = 1;
    for(int i=1; i<M; i++){
        int a,b;
        a = hasi[i].first;
        b = hasi[i].second;
        if(b>=now){
            now = a;
            ans ++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4320
# -*- coding: utf-8 -*-
"""
B - Palindrome-philia
https://atcoder.jp/contests/abc147/tasks/abc147_b

"""
import sys


def solve(S):
    l, r = 0, len(S) - 1
    ans = 0
    while l < r:
        ans += (S[l] != S[r])
        l += 1
        r -= 1
    return ans


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

#define ll long long

using namespace std;


string s;
int r;
int n;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>s;
    for (int i=0; i<s.size()-2; i++){
        if(s[i]=='A' && s[i+1]=='B' &&s[i+2]=='C')
            r+=1;
    }
    cout<<r;




    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {

	char S[10];
	scanf("%s",S);

	if (S[0] == 'S') {
		printf("Cloudy\n");
	}
	else if (S[0] == 'R') {
		printf("Sunny\n");
	}
	else {
		printf("Rainy\n");
	}

	return 0;
}

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

int main() {
	int N;
	cin >> N;
	double sum = 0;
	for (int i = 0; i < N; i ++) {
		string str;
		double x;
		cin >> x >> str;
		if (str == "JPY") {
			sum += x;
		}
		else {
			sum += x * 380000.0;
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int ans[4]={0,0,0,0};
	int d[3];
	while(1){
		for(int i=0;i<3;i++)cin>>d[i];
		sort(d,d+3);
		if(d[0]+d[1]<=d[2])break;
		else if(d[0]*d[0]+d[1]*d[1]==d[2]*d[2])ans[1]++;
		else if(d[0]*d[0]+d[1]*d[1]>d[2]*d[2])ans[2]++;
		else ans[3]++;
		ans[0]++;
	}
	
	cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<" "<<ans[3]<<endl;
	return 0;
}


Measured memory_bytes: 1180
#include <stdio.h>
#include <vector>
#include <queue>

struct str{
	int x0;
	int y0;
	int dist;
	int count;
	int type;
};
bool operator<(str a, str b)
{
	if(a.dist==b.dist) a.count<b.count;
	return a.dist>b.dist;
}
std::priority_queue<str> Q;

std::vector<int> check[1000010],check2[5][1000010];
std::vector<char> x[1000010];
char y[1000010];


int direX[5]={0,1,0,-1},direY[5]={1,0,-1,0};

int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int s1,t1,s2,t2;
	scanf("%d%d%d%d",&s1,&t1,&s2,&t2);
	
	for(int i=0;i<=a+1;i++) for(int j=0;j<=b+1;j++) x[i].push_back('@');
	for(int i=0;i<=a+1;i++) for(int j=0;j<=b+1;j++) check[i].push_back(0);
	for(int i=0;i<=a+1;i++) for(int j=0;j<=b+1;j++) for(int k=0;k<=4;k++) check2[k][i].push_back(0);
	
	for(int i=1;i<=a;i++)
	{
		scanf("%s", y+1);
		for(int j=1;j<=b;j++) x[i][j] = y[j];
	}
	
	Q.push({s1,t1,1,0,4});
	while(!Q.empty())
	{
		int x0 = Q.top().x0;
		int y0 = Q.top().y0;
		int dist = Q.top().dist;
		int count = Q.top().count;
		int type = Q.top().type;
		Q.pop();
		if(x[x0][y0]=='@') continue;
		
		if(check[x0][y0]>0)
		{
			if(check[x0][y0]==dist && check2[type][x0][y0]==0 && count>0)
			{
				check2[type][x0][y0] = 1;
				Q.push({x0+direX[type],y0+direY[type],dist,count-1,type});
			}
			continue;
		}
		check[x0][y0] = dist;
		check2[type][x0][y0] = 1;
		if(count>0) Q.push({x0+direX[type],y0+direY[type],dist,count-1,type});
		else Q.push({x0+direX[type],y0+direY[type],dist+1,c-1,type});
		for(int i=0;i<4;i++)
		{
			if(i==type) continue;
			Q.push({x0+direX[i],y0+direY[i],dist+1,c-1,i});
		}
	}
	if(check[s2][t2]==0) printf("-1");
	else printf("%d",check[s2][t2]-1);
}

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

#define pb(x) push_back(x);
#define all(v) v.begin(),v.end()

using ll = long long int;
using ul = unsigned long long int;
using vi = vector<int>;
ll max(ll x,ll y){
    if(x>y)
        return x;
    else
        return y;
}
ll min(ll x,ll y){
    if(x>y)
        return y;
    else
        return x;
}

bool check(string s){
    bool a = true,b=true,c=true;
        if(s.find("b")==std::string::npos)b=false;
        if(s.find("a")==std::string::npos)a=false;
        if(s.find("c")==std::string::npos)c=false;
    if(a==true && b==true && c==true)
        return true;
    else
        return false;
}


int main(){
    string s;
    cin>>s;
    if(check(s)==true){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}



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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef map<int,int> mapii;
typedef map<int,bool> mapib;
typedef map<char,int> mapci;
typedef priority_queue<int> pr;

#define small 1e-9
#define big5 1000000005
#define big7 1000000007
#define big 100000
#define pi 3.1415926

#define inp(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define cum(arr,n,cumm) cumm[0]=arr[0];for(int i=1;i<n;i++)cumm[i]=cumm[i-1]+arr[i];
#define bsdk ios_base::sync_with_stdio(false);cin.tie(NULL);
#define disp(arr) for(auto i:arr)cout<<i<<" ";cout<<"\n"
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define yess cout<<"Yes\n"
#define noo cout<<"No\n"
#define m1 cout<<"-1\n"
#define nl <<endl
#define hs cout<<"#"

#define fori(a, b, c) for (a = (b); (a) <= (c); ++(a))
#define ford(a, b, c) for (a = (b); (a) >= (c); --(a))
#define rep(i,n) fori(i,0,n-1)
#define repi(i,n) fori(i,1,n-1)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define ub upper_bound
#define lb lower_bound
#define allv(v) v.begin(), v.end()
#define sorti(v) sort(allv(v))
/*bool isprime[big+1];
vector<int> primes;
void makesieve()
{
    ll i,j;
    rep(i,big+1)
        isprime[i]=false;
    isprime[2]=true;
    for(i=3;i<=big;i+=2)
        isprime[i]=true;
    for(i=3;i<=big;i+=2)
    {
        if(isprime[i])
            for(j=i*i;j<=big;j+=i)
            isprime[j]=false;
    }
    rep(i,big+1)
    {
        if(isprime[i])
            primes.pb(i);
    }
}
vpi fact(ll n)
{
    ll i=0;
    vpi pf;
    ll c;
    while(primes[i]*primes[i]<=n)
    {
        if(n%primes[i]==0)
        {
            c=0;
            while(n%primes[i]==0)
                {
                    n=n/primes[i];
                    c++;
                }
            pf.pb(mp(primes[i],c));
        }
        i++;
    }
    if(n!=1)
        pf.pb(mp(n,1));
    return pf;
}
ll poww(ll n,ll m){
    if(m==0)return 1;
    if(m==1)return n;
    ll ans = poww(n,m/2);
    if(m%2==1) return (ans*ans)*n;
    else return (ans*ans);
}*/

void solve()
{
    int n;
    cin>>n;
    int a=(n/1000);
    if(n%1000!=0)
        a++;
    cout<<1000*a-n;
}
int main()
{
    bsdk
    int t;
    //cin>>t;
    t=1;
    //makesieve();
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 3684
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[][] points = new int[N][3];
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 3; j++) {
        points[i][j] = scanner.nextInt();
      }
    }

    for (int cx = 0; cx <= 100; cx++) {
      for (int cy = 0; cy <= 100; cy++) {
        int H = -1;
        int H_MAX = Integer.MAX_VALUE;
        boolean found = true;
        for (int i = 0; i < N; i++) {
          int[] pt = points[i];
          int x = pt[0] - cx;
          int y = pt[1] - cy;
          int h = pt[2];
          final int hh = h + Math.abs(x) + Math.abs(y);
          if (h == 0) {
            H_MAX = Math.min(hh, H_MAX);
          } else {
            if (H < 0) {
              H = hh;
            } else if (H != hh) {
              found = false;
              break;
            }
          }
        }
        if (found && H <= H_MAX) {
          System.out.printf("%d %d %d\n", cx, cy, H);
          return;
        }
      }
    }
  }
}


Measured memory_bytes: 23124
KK, NN = ARGF.gets.chomp.split.collect {|el| el.to_i}
AA = ARGF.gets.chomp.split.collect {|el| el.to_i}

admax = KK + AA[0] - AA[-1]
adl= [admax]

(NN - 1).times do |idx|
  ad = AA[idx + 1] - AA[idx]
  admax = (admax < ad) ? ad : admax
  #adl << ad
end

puts KK - admax
#puts KK - adl.max



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

using namespace std;

void rwFile() {
    freopen("INP.inp", "r", stdin);
    freopen("OUT.out", "w", stdout);
}

void solveA() {
    int k, x;
    cin >> k >> x;
    if (k * 500 >= x) cout << "Yes";
    else cout << "No";
}

void solveB() {
    int n; cin >> n;
    string s; cin >> s;
    int res = 0;
    for (int i = 0; i + 2 < n; i++) {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') res++;
    }
    cout << res;
}

void solveC() {
    int n; cin >> n;
    int p[n], q[n];
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n;i ++) cin >> q[i];
    int arr[n];
    int lim = 1;
    for (int i = 1; i <= n; i++) lim *= i;
    for (int i = 0; i < n; i++) arr[i] = i + 1;
    int a = 0, b = 0;
    for (int i = 0; i < lim; i++) {
        int isA = 1, isB = 1;
        for (int j = 0; j < n; j++) {
            if (arr[j] != q[j]) isB = 0;
            if (arr[j] != p[j]) isA = 0;
        }
        if (isA) a = i;
        if (isB) b = i;
        next_permutation(arr, arr + n);
    }
    cout << abs(a - b);
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int find2(long long x) {
    int res = 0;
    while (x % 2 == 0) {
        res++;
        x /= 2;
    }
    return res;
}

void solveD() {
    long long n, m; cin >> n >> m;
    long long arr[n];
    if (n == 1) {
        int x; cin >> x;
        if (x % 2 == 1) cout << 0;
        else {
            x /= 2;
            int res = m / x - m / (2 * x); //(m - x) / (2 * x) + 1;
            cout << ((res < 0) ? 0 : res);
        }
        return;
    }
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        arr[i] /= 2;
    }
    int two = find2(arr[0]);
    for (int i = 1; i < n; i++) {
        if (find2(arr[i]) != two) {
            cout << 0;
            return;
        }
    }
    long long arrLcm = 1LL;
    for (int i = 0; i < n; i++) arrLcm = lcm(arrLcm, arr[i]);
    long long res = (m + arrLcm) / (2 * arrLcm);
    cout << ((res < 0) ? 0 : res);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    //rwFile();
    ///solveA();
    ///solveB();
    ///solveC();
    solveD();
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,k;
	long long i;
	scanf("%lld %lld %lld",&a,&b,&k);
	if(1<=a&&a<=b&&b<=(int)powf(10,9)&&k<=100)
	{
		if(b-a<=k)
		  for(i=a;i<=b;i++)
		     printf("%lld\n",i);
		else
		{   
			for(i=a;i<=a+k-1;i++)
			  printf("%lld\n",i);
			if(a+k-1==b-k+1)
				for(i=b-k+2;i<=b;i++)
			  		printf("%lld\n",i);  
			else
			  for(i=b-k+1;i<=b;i++)
			     printf("%lld\n",i);  		
		}
	}
	return 0;  
}


Measured memory_bytes: 384
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int x,y,z;
    x = 1;
    y = 1;
    while (x!=0 || y!=0){
        scanf("%d %d",&x,&y);
        if(x!=0 || y!=0){
            if(x>y){
                z = x;
                x = y;
                y = z;
                printf("%d %d\n",x,y);
            }else{
                printf("%d %d\n",x,y);
            }
        }else{
        }
    }
    return 0;
}



Measured memory_bytes: 2028
N = int(input())
xyh = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: -x[2])

from itertools import product
for cx, cy in product(range(101), repeat=2):
    H = None
    for x, y, h in xyh:
        if H is None:
            H = h + abs(x-cx) + abs(y-cy)
        else:
            if h != max(H - abs(x-cx) - abs(y-cy), 0):
                break
    else:
        print(cx, cy, H)
        exit()

Measured memory_bytes: 40304
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int m = scan.nextInt();

    ArrayList<String> a = new ArrayList<String>();
    ArrayList<String> b = new ArrayList<String>();

    for (int i=0;i<n;i++){
      String c = scan.next();
      a.add(c);
    }

    for (int j=0;j<m;j++){
      String d = scan.next();
      b.add(d);
    }

    ArrayList<ArrayList<String>> g = new ArrayList<ArrayList<String>>();

    for (int k=0;k<m;k++){
      String check = b.get(k);
      ArrayList<String> f = find(check,a);
      g.add(f);
    }

    ArrayList<String> h = g.get(0);

    if (h.size() == 0){
      System.out.println("No");
      return;
    }

    for (String q : h){

      String [] ff = q.split("a");
      int line = Integer.parseInt(ff[0]);
      int loc = Integer.parseInt(ff[1]);
      boolean find = true;

      for (int j=1;j<m;j++){
        int next = line+j;
        if (next >= n ){
          find = false;
          break;
        }
        String next1 = next+"a"+loc;
        ArrayList<String> mm = g.get(j);

        boolean contains = false;

        for (String aa: mm){
          if (aa.equals(next1)){
            contains = true;
            break;
          }
        }

        if (contains == false){
          find = false;
          break;
        }

      }

      if (find == true){
        System.out.println("Yes");
        return;
      }
    }

    System.out.println("No");


  }

  static ArrayList<String> find(String a, ArrayList<String> b){
    ArrayList<String> ret = new ArrayList<String>();

    int g = b.size();
    int l = a.length();
    for (int i=0;i<g;i++){
      String m = b.get(i);
      int k = a.length();

      for (int j=0;j<=g-l;j++){
        String sub = m.substring(j,j+l);
        if (sub.equals(a)){
          String message = i + "a" + j;
          ret.add(message);
        }
      }
    }

    return ret;
  }

}


Measured memory_bytes: 39452
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#ifndef LOCAL
struct ostdmy{template<class T>ostdmy&operator<<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
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;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
inline ll cube(ll a){return a*a*a;}
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    ll n,k;
    cin>>n>>k;
    // a+b%K,b+c%K,c+a%K
    // 2(a+b+c)%K
    // a+b+c%K (k!=2)
    // a%K,b%K,c%K
    if(k%2)
        cout<<(n/k)*(n/k)*(n/k)<<endl;
    else{
        ll a=n/(k/2); // n以下k/2の倍数の個数
        ll ans=0;
        ans+=cube(a/2); // 偶数のたしあわせ
        ans+=cube((a+1)/2); // 奇数のたしあわせ
        cout<<ans<<endl;
        // ans+=(n/k)*(n/k)*(n/k);
        // ans+=((n+1)/k)*((n+1)/k)*((n+1)/k);
        // cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int dpx[8000][20000];
int dpy[8000][20000];
  
int main()
{
  string s;
  int x, y;
  cin >> s >> x >> y;
  s += "T";

  int nx = 0, ny = 0;
  int xx[8000], yy[8000];
  int c = 0, n = 0;
  for(int i = 0; i < s.length(); i++){
    if(s[i] == 'T'){
      if(n == 0) x -= c;
      else if(c){
        if(n % 2 == 0) xx[nx++] = c;
        else yy[ny++] = c;
      }
      c = 0;
      n++;
    }else{
      c++;
    }
  }

  dpx[0][10000] = 1;
  for(int i = 0; i < nx; i++){
    for(int j = 0; j < 20000; j++){
      if(dpx[i][j]){
        dpx[i+1][j+xx[i]] = 1;
        dpx[i+1][j-xx[i]] = 1;
      }
    }
  }

  dpy[0][10000] = 1;
  for(int i = 0; i < ny; i++){
    for(int j = 0; j < 20000; j++){
      if(dpy[i][j]){
        dpy[i+1][j+yy[i]] = 1;
        dpy[i+1][j-yy[i]] = 1;
      }
    }
  }

  if(dpx[nx][x+10000] && dpy[ny][y+10000]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		cin >> v[i];
	vector<int> a, b;
	for (int i = 0; i < n; i += 2)
		a.push_back(v[i]);
	for (int i = 1; i < n; i += 2)
		b.push_back(v[i]);
	vector<int> anum(100001, 0), bnum(100001, 0);
	for (int i = 0; i < n / 2; i++)
		anum[a[i]]++;
	for (int i = 0; i < n / 2; i++)
		bnum[b[i]]++;
	vector<pair<int, int>> aele, bele;
	for (int i = 1; i <= 100000; i++)
		aele.push_back(make_pair(anum[i], i));
	for (int i = 1; i <= 100000; i++)
		bele.push_back(make_pair(bnum[i], i));
	sort(aele.rbegin(), aele.rend());
	sort(bele.rbegin(), bele.rend());
	int ans = 0;
	if (aele[0].second == bele[0].second)
		ans = max(aele[0].first + bele[1].first, aele[1].first + bele[0].first);
	else
		ans = aele[0].first + bele[0].first;
	cout << n - ans << endl;
	return 0;
	
}

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

int main() {
  int n;
  cin >> n;
  rep(i,n+1){
    if(i*108/100 == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}

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

int main(void) {
  int a;
  cin >> a;
  cout << 3 * a * a << endl;
  return 0;
}


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

int main(){
  int n,m,c;
  cin >> n >> m >> c;
  int b[m];
  for (int i=0;i<m;i++) cin >> b[i];
  int count = 0;
  int total = 0;
  int a;
  for (int i=0;i<n;i++){
    total = 0;
    for (int j=0;j<m;j++){
      cin >> a;
      total += a*b[j];
    }
    if (total+c > 0) count += 1;
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <cassert>
#include <vector>
#include <algorithm>
#include <string>
#include <stdexcept>

class Complex {
  // std::complex<int> is unspecified
  int real=0, imag=0;
  void overflow_check() const {
    if (abs(real) > 10000 || abs(imag) > 10000)
      throw std::overflow_error("overflow");
  }

public:
  Complex(int real, int imag): real(real), imag(imag) {}
  Complex &operator +=(const Complex &oth) {
    real += oth.real;
    imag += oth.imag;
    overflow_check();
    return *this;
  }
  Complex &operator -=(const Complex &oth) {
    real -= oth.real;
    imag -= oth.imag;
    overflow_check();
    return *this;
  }
  Complex &operator *=(const Complex &oth) {
    int tmp=real*oth.real-imag*oth.imag;
    imag = real*oth.imag+imag*oth.real;
    real = tmp;
    overflow_check();
    return *this;
  }
  std::string out() const {
    if (real == 0) {
      if (imag == 0) return "0";
      return std::to_string(imag)+"i";
    }
    std::string res=std::to_string(real);
    if (imag > 0) res += "+";
    if (imag != 0) res += std::to_string(imag) + "i";
    return res;
  }
} iu(0, 1);

Complex parse(const std::string &s, size_t &i, size_t preced=0) {
  const std::vector<std::string> ops={"+-", "*"};

  if (preced == ops.size()) {
    if (s[i] == '(') {
      Complex res=parse(s, ++i, 0);
      assert(s[i] == ')');
      ++i;
      return res;
    }
    if (isdigit(s[i])) {
      int res=s[i]-'0';
      while (++i < s.length() && isdigit(s[i])) {
        res = res*10+s[i]-'0';
        if (res > 10000) throw std::overflow_error("overflow");
      }
      return Complex(res, 0);
    }
    if (s[i] == 'i') {
      ++i;
      return iu;
    }
    assert(false);
  }

  Complex lhs=parse(s, i, preced+1);
  while (i < s.length()) {
    char op=s[i];
    if (!std::count(ops[preced].begin(), ops[preced].end(), op)) break;
    Complex rhs=parse(s, ++i, preced+1);
    if (op == '+') lhs += rhs;
    if (op == '-') lhs -= rhs;
    if (op == '*') lhs *= rhs;
  }
  return lhs;
}

int testcase_ends() {
  char buf[128];
  if (scanf("%s", buf) == EOF) return 1;
  std::string s=buf;
  size_t i=0;
  try {
    printf("%s\n", parse(s, i).out().c_str());
  } catch (std::overflow_error &e) {
    printf("overflow\n");
  }

  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2964
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<string>
using namespace std;
typedef struct{
  vector<string> sozai;
  long long money;
}BUTU;
pair<string,long long> P[1002];
BUTU butu[1024];
long long n,p,m,a,b;
string s,ss,mokuhyou;
long long tansaku(string now){
  for(int i=0;i<n;i++){
    if(P[i].first==now){
      return P[i].second;
    }
  }
  return -1;
}
long long check(string now){
  long long banti=tansaku(now);
  long long f=butu[banti].sozai.size();
  long long cnt=0;
  if(f==0){
    return butu[banti].money;
  }
  else{
    for(int i=0;i<f;i++){
      if(tansaku(butu[banti].sozai[i])!=-1){
	cnt+=check(butu[banti].sozai[i]);
      }
      else{
	return butu[banti].money;
      }
    }
    return min(cnt,butu[banti].money);
  }
  return -1;
}
main(){
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      butu[i].sozai.clear();
      cin>>s>>p;
      butu[i].money=p;
      P[i].first=s;
      P[i].second=i;
    }
    cin>>m;
    for(int i=0;i<m;i++){
      cin>>s>>a;
      b=tansaku(s);
      for(int j=0;j<a;j++){
	cin>>ss;
	butu[b].sozai.push_back(ss);
      }
    }
    cin>>mokuhyou;
    cout<<check(mokuhyou)<<endl;
  }
}
    

Measured memory_bytes: 1264
#include<iostream>
using namespace std;
 
int main(){
 int n,x,num;
 
 while(1){
  num = 0;
  cin >> n >> x;
   
  if(n == 0 && x == 0) break;
 
  for(int i = 1; i <= n; i++){
   for(int j = i+1; j <= n; j++){
    for(int k = j+1; k <= n; k++){
     if(i + j + k == x)
      num += 1;
    }
   }
  }
 
  cout << num << endl;
 }
 
 return 0;
}

Measured memory_bytes: 1164
N, A, B = map(int, input().split())
S = input()

for i in range(len(S)):
    if S[i] == "c":
        print("No")
    if S[i] == "a":
        if A > 0:
            print("Yes")
            A = A-1
        elif B > 0:
            print("Yes")
            B = B-1
        else :
            print("No")
    if S[i] == "b":
        if B > 0:
            print("Yes")
            B = B-1
        else :
            print("No")


Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define comp(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define infile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvli;
const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    int x;cin>>x;
    if(x<=599 && x>=400) cout<<8<<"\n";
    else if(x<=799 && x>=600) cout<<7<<"\n";
    else if(x<=999 && x>=800) cout<<6<<"\n";
    else if(x<=1199 && x>=1000) cout<<5<<"\n";
    else if(x<=1399 && x>=1200) cout<<4<<"\n";
    else if(x<=1599 && x>=1400) cout<<3<<"\n";
    else if(x<=1799 && x>=1600) cout<<2<<"\n";
    else if(x<=1999 && x>=1800) cout<<1<<"\n";
    
}





int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t=1;
    //cin>>t;
    FOR(i,1,t+1){
        //cout<<"Case #"<<i<<": "; 
        solve();
    }
    
	return 0;
	
	
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}


Measured memory_bytes: 3648
/*starting with the name of almighty ALLAH*/
/*solved by RAKIB JOY*/
// Practice is the only shortcut to improve
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define vc vector
#define vi vc<int>
#define vl vc<ll>
#define dbg(x) cout<<x<<endl;
#define mp(x,y) make_pair(x,y)
#define yes dbg("YES")
#define no dbg("NO")
#define tst int t;cin>>t;while(t--)
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define rj ios::sync_with_stdio(false);cin.tie(0);
#define rvs(v) reverse(v.begin(),v.end());
#define F first
#define S second
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 2*acos(0.0)
#define pii pair<int,int>
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define coutv(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define cinv(v) for(auto &it:v)cin>>it;
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using ordered_set =tree<T, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;
*/
//sieve bool b[1000005];void primenire(){int i, j;b[0]=true;b[1]=true;for(i=4; i<=1000000; i+=2){b[i]=true;}for(i=3; i<=1001; i+=2){if(!b[i]){for(j=i*i; j<=1000001; j+=2*i){b[j]=true;}}}}
//power ll power(ll a,ll b){if(b==0) return 1LL;if(b&1) return a*power(a,b-1);else return power(a,b/2)*power(a,b/2);}
//bigmod long long int m(long long int a,long long int b,long long int c){if(b==0)return 1;if(b%2==0){long long int  tmp=m(a,b/2,c);return ((tmp%c)*(tmp%c))%c;}elsereturn ((a%c)*(m(a,b-1,c)%c))%c;}
//MaxSubarraySum ll mss(vector<ll>v){ll mx=v[0];ll sz=v.size();for(int i=1;i<=sz;i++){ll t=v[i]+v[i-1];if(t>=v[i]) v[i]=t;mx=max(mx,v[i]*1LL);}return mx;}
//combination ll com[1001][1001];void combination(){com[1][1]=1;com[1][0]=1;for(ll i=2; i<=1000; i++){com[i][0]=1;for(ll j=1; j<=i; j++){com[i][j]=com[i-1][j]+com[i-1][j-1];}}}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

void solve()
{
    ll a;
    cin>>a;
    vl v(a+2);
    fr(i,1,a) cin>>v[i];
    vl vv=v;
    for(ll i=a-1; i>=1; i--)
    {
        vv[i]+=vv[i+1];
        vv[i]%=mod;
    }
    ll an=0;
    fr(i,1,a)
    {
        an+=((vv[i+1]*v[i])%mod);
        an%=mod;
    }
    cout<<an<<endl;
}
int main()
{
    rj
    solve();



    return 0;
}



Measured memory_bytes: 6364
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=200000+10;
struct dong{
    int id,x,y;
} p[maxn],p1,p2;
struct suan{
    dong x,y;
} a[maxn];
int sta[maxn];
int i,j,k,l,t,n,m,x,y,r,c,tot,top;
bool is(dong x){
    return x.x==0||x.y==0||x.x==r||x.y==c;
}
int sum(dong x){
    if(x.x==0) return 2*r+c+c-x.y;
    if(x.y==0) return x.x+x.y;
    if(x.x==r) return r+x.y;
    if(x.y==c) return r+c+r-x.x;
}
bool cmp(dong a,dong b){
    return sum(a)<sum(b);
}
int main(){
    scanf("%d%d%d",&r,&c,&n);
    fo(i,1,n){
        scanf("%d%d",&x,&y);
        p1=(dong){i,x,y};
        scanf("%d%d",&x,&y);
        p2=(dong){i,x,y};
        a[i]=(suan){p1,p2};
        if (is(p1)&&is(p2)){
            p[++tot]=p1;
            p[++tot]=p2;
        }
    }
    sort(p+1,p+tot+1,cmp);
    fo(i,1,tot){
        if (top&&sta[top]==p[i].id) top--;
        else sta[++top]=p[i].id;
    }
    if (top) printf("NO\n");else printf("YES\n");
}

Measured memory_bytes: 7552
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    int n, k;
    cin >> n >> k;
    int x[n];
    rep(i, n) cin >> x[i];
    int ans = 1000000000;
    for (int i = 0; i < n - k + 1; i++){
        if (x[i] < 0 && x[i + k - 1] > 0){
            int t = min(abs(x[i]), x[i + k - 1]) * 2 + max(abs(x[i]), x[i + k - 1]);
            ans = min(ans, t);
        }else if (x[i] >= 0){
            ans = min(ans, x[i + k - 1]);
        }else{
            ans = min(ans, abs(x[i]));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
using System; 

class Program 
{ 
    static void Main() 
    {
      var KS = Console.ReadLine().Split();
      var K = int.Parse(KS[0]);
      var S = int.Parse(KS[1]);
      var ans = ( S<2*K ? -(S>K?1:0)*(K-=S)*--K*3 + ++S*++S : (S-=1+3*K)*--S ) / 2;
      Console.WriteLine(ans);
    } 
}

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

int main() {
	int n, m;
	cin >> n >> m;
    vector<int>a(n);
    for (int i = 1; i < n; i++)a.at(i) = i;
    set<pair<int, int>>ab;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        ab.insert({ x,y });
    }
    ll ans = 0;
    do {
        //処理
        if (a.at(0) != 0)break;
        bool x = true;
        set<pair<int, int>>abc = ab;
        for (int i = 0; i < n - 1; i++) {
            int k = a.at(i);
            int l = a.at(i + 1);
            if (k > l)swap(k, l);
            if (!abc.count({ k,l })) {
                x = false;
                break;
            }
        }
        if (x)ans++;
    } while (next_permutation(a.begin(), a.end()));
    cout << ans << endl;
}

Measured memory_bytes: 256
// Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
//If you are not doing well now just stick to it and learn new things one day you will be...
//Compete with yourself
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
///*template{{{
#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
#define trav(a,x) for(auto &a:x)
#define fr(i,a,b)  for(ll i=a;i<=b;i++)
#define fr1(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sorta(a,n) sort(a,a+n)
#define sortd(a,n) sort(a,a+n,greater<ll>())
#define sorva(a) sort(a.begin(),a.end())
#define sortvd(a) sort(a.begin(),a.end(),greater<ll>())
#define tc(t) while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
using vi= vector<ll>;
using vvi= vector<vi>;
using vb =vector<bool>;
using vc =vector<char>;
using vs =vector<string>;
using vld =vector<ld>;
using pii =pair<ll,ll>;
using psi =pair<string,ll>;
using pci =pair<char,ll>;
using vpii =vector<pii>;
//}}}template*/
ll const mod=1e9+7;
ll const maxn=1e5+5;
ll const inf=1e18;
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool prime(ll x){
    if(x<=1)return false;
    for(int i=2;i<=sqrt(x);i++)if(x%i==0)return false;
    return true;
}
ll divisor(ll x){
    ll cnt=0;
    for(int i=1;i<=sqrt(x);i++){
        if(x%i==0){
            if(i!=x/i)cnt+=2;
            else cnt+=1;
        }
    }
    return cnt;
}
vector<ll> sieve(ll n) {    
    bool prim[n+1];
    memset(prim, true, sizeof(prim));
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) {
            for (int i=p*p; i<=n; i += p)
                prim[i] = false;
        }
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v;
}
vector<pii>fun(ll x){
    vpii v;
    for(ll i=2;i*i<=x;i++){
        if(x%i!=0)continue;
        ll cnt=0;
        while(x%i==0){
            cnt++;
            x/=i;
        }
        v.pb({i,cnt});
    }
    if(x!=1)v.pb({x,1});
    return v;
}
void solve(){
    ll x;
    cin>>x;
    vpii v=fun(x);
    ll ans=0;
    for(auto i:v){
        ll x=i.se;
        ll y=1;
        ll temp=0;
        while(y<=x){
            temp++;
            x-=y;
            y++;
        }
        ans+=temp;
    }
    cout<<ans<<"\n";
}
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    fio;
    clock_t zzzz = clock();
    ll t;
    t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    debug("Total Time: %.3f\n", (double)(clock() - zzzz) / CLOCKS_PER_SEC);
   return 0;
}



Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
using namespace std;
const long long MOD = 1e9 + 7;
vector <int> G[100003], Gt[100003];
int mi[100003];
int N, M;
int len[100003];
int act_poz;
int L = 0,  x, y;
int sort_top[100003];
bool viz[100003];
void top_sort(int i) {
    sort_top[act_poz++] = i;
    viz[i] = true;
    for (auto x : G[i]) {
        --mi[x];
        if (mi[x] == 0)
            top_sort(x);
    }
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        cin >> x >> y;
        G[x].pb(y);
        Gt[y].pb(x);
        mi[y]++;
    }
    for (int i = 1; i <= N; ++i) {
        if (mi[i] == 0 && viz[i] == 0) {
            top_sort(i);
        }
    }
    L = 1;
    for (int i = N - 1; i >= 0; --i) {
        for (auto aux : Gt[sort_top[i]]) {
            len[aux] = max(len[aux], len[sort_top[i]] + 1);
            L = max(L, len[aux]);
        }
    }
    cout << L;
    return 0;
}


Measured memory_bytes: 15616
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    int n,w; cin >> n >> w; 
    int a[n];
    long long int val[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i] >> val[i];
    }
    long long int dp[n+1][w+1];
    for(int i=0;i<=w;i++)
    {
        dp[0][i]=0;
    }
    for(int i=0;i<=n;i++)
    {
        dp[i][0]=0;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j<a[i-1])
            {
                dp[i][j]=dp[i-1][j];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-a[i-1]]);
            }
        }
    }
    cout << dp[n][w];
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    int fact[1000005];
    bool ok=false;
 
    void f(int x){
        if(ok==true)
            return;
        for(int i=1;i*i<=x;i++){
            if(x%i==0){
                int a=i;
                int b=x/i;
                if(a==b){
                    a=i;
                    b=1;
                }
                if(a!=1){
                    if(fact[a]){
                        ok=true;
                        return;
                    }
                    fact[a]++;
                }
                if(b!=1){
                    if(fact[b]){
                        ok=true;
                        return;
                    }
                    fact[b]++;
                }
            }
        }
    }
 
    void solve(){  
        int n;
        cin>>n;
        vector<int>a(n);
        for(int i=0;i<n;i++)
            cin>>a[i];
        int gcd=a[0];
        // cout<<"in "<<ok<<"\n";
        f(a[0]);
        // cout<<"in "<<ok<<"\n";
        for(int i=1;i<n;i++){
            f(a[i]);
            gcd=__gcd(gcd,a[i]);
            // cout<<"in "<<ok<<"\n";
        }
        if(!ok){
            cout<<"pairwise coprime";
        }
        else if(gcd==1){
            cout<<"setwise coprime";
        }
        else{
            cout<<"not coprime";
        }
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, M;
    cin >> N >> M;
    ll ma = 101010;
    vector<ll> imos(ma, 0);
    REP(i, M){
    	ll L, R;
    	cin >> L >> R;
    	L--;R--;
    	imos[L] += 1;
    	imos[R+1] -= 1;
    }
    REP(i, ma-1){
    	imos[i+1] += imos[i];
    }
    ll res = 0;
    REP(i, ma){
    	if(imos[i] == M){
    		res++;
    	}
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define maxn 100010
using namespace std;
typedef long long LL;
struct Edge {
    int to, ne;
    Edge(int _to=0, int _ne=0): to(_to), ne(_ne) {}
}edge[maxn*2];
int tot, ne[maxn];
void add(int u, int v) {
    edge[tot] = Edge(v, ne[u]);
    ne[u] = tot++;
}
int n, m, c[maxn];
void dfs(int u, int col) {
    c[u] = col;
    for (int i = ne[u]; ~i; i = edge[i].ne) {
        int v = edge[i].to;
        if (c[v] == -1) dfs(v, !col);
        if (c[v] != !col) { printf("%lld\n", 1LL*n*(n-1)/2-m); exit(0); }
    }
}
int main() {
    scanf("%d%d", &n, &m);
    memset(c, -1, sizeof(c));
    memset(ne, -1, sizeof(ne));
    for (int i = 0; i < m; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        add(u, v);
        add(v, u);
    }
    dfs(1, 0);
    int b=0, w=0;
    for (int i = 1; i <= n; ++i) if (c[i]) ++b; else ++w;
    printf("%lld\n", 1LL*b*w-m);
    return 0;
}


Measured memory_bytes: 3072