akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){

 long long n;
 cin>>n;
    int sum =0;
  while(n){

    if(n>=500){
       int quot = n/500;
        sum += quot*1000;
       n -= quot*500; }

    if(n>=5){
         int quot = n/5;
        sum += quot*5;
       n -= quot*5; }

    if(n<5) break;

  }

  cout<<sum<<endl;

return 0;
}


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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    cout << ((r<=x && r<=y && W-r>=x && H-r>=y) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
set<int> v[55];
int vis[55];
int x[55],y[55];
void dfs(int m)
{
vis[m] = 1;
set<int>::iterator I;
for(I=v[m].begin();I!=v[m].end();I++)
if(vis[*I]==0)dfs(*I);
}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
int i,j;
for(i=1;i<=m;i++)
{
scanf("%d%d",&x[i],&y[i]);
v[x[i]].insert(y[i]);
v[y[i]].insert(x[i]);
}

int ans = 0;
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)vis[j] = 0;
int ff,gg;
ff = x[i];
gg = y[i];
v[ff].erase(gg);
v[gg].erase(ff);
dfs(1);
int cur = 0;
for(j=1;j<=n;j++)cur+=vis[j];
if(cur!=n)ans++;
v[ff].insert(gg);
v[gg].insert(ff);
}
printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 256
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    numbers = inputs
    number_set = set()

    for n in numbers:
        if n in number_set:
            number_set.remove(n)
        else:
            number_set.add(n)
    return len(number_set)


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(int_inputs(N))
    print(ret)


Measured memory_bytes: 56152
N=int(input())
p=list(map(int,input().split()))
count=0
series=0
for i in range(N):
    if(p[i]-1 == i):
        series += 1
    elif(series > 0):
        count += -(-series//2)
        series=0
if(series > 0):
    count += -(-series//2)
print(count)

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

#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define pfis(a) printf("%d ",a);
#define pfls(a) printf("%lld ",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(int i=a;i<b;i++)
#define pb(a) push_back(a);
#define mp(a,b) make_pair(a,b)
#define ll long long

const ll mod=1e9+7;

int main()
{
	int h,w;
	sfi(h)
	sfi(w)

	string str[h];
	f(i,0,h)
		cin>>str[i];

	ll dp[h][w];
	memset(dp,0,sizeof(dp));

	dp[0][0]=1;

	f(i,0,h)
	{
		f(j,0,w)
		{
			if(str[i][j]=='.')
			{
				int up=i-1;
				int left=j-1;
				if(up>=0)
					dp[i][j]=(dp[i][j]+dp[up][j])%mod;
				if(left>=0)
					dp[i][j]=(dp[i][j]+dp[i][left])%mod;
			}
			else
			{
				dp[i][j]=0;
			}
		}
	}

	pfln(dp[h-1][w-1])
}

Measured memory_bytes: 13540
from collections import deque

n, limit = map(int, input().split())

queue = deque()
for index in range(n):
    name, size = input().split()
    queue.append([name, int(size)])

time = 0
while len(queue) > 0:
    item = queue.popleft()
    if item[1] > limit:
        item[1] -= limit
        queue.append(item)
        time += limit
    else:
        time += item[1]
        print(" ".join([item[0], str(time)]))


Measured memory_bytes: 13280
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll last(ll N, ll K) {
	while (N % K == 0 && N >= K)
		N /= K;
	return N % K;
}

int main() {
	ll N; cin >> N;
	int res = 1; // K = N : ok
	if (N > 2) ++res; // K = N - 1 : ok
	ll k;
	for (k = 2; k * k <= N; ++k)
		if (last(N, k) == 1)
			++res;
	for (ll i = 2; i * i <= N - 1; ++i) {
		if ((N - 1) % i == 0) {
			if (i >= k) ++res;
			if (i * i != N - 1 && (N - 1) / i >= k)
				++res;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
N = 50000
t = [1]*(N)
p = [2]
d = {2:1}
for i in range(3, N, 2):
    if t[i]:
        p.append(i)
        d[i] = 1
        for j in range(3*i, N, 2*i): t[j] = 0

while True:
    n = int(input())
    if n == 0: break

    count = 0
    if n % 2:
        if n - 2 in p: count += 1
    else:
        for p1 in p:
            if 2*p1 > n: break
            if n - p1 in d:
                count += 1
    print(count)

Measured memory_bytes: 7240
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;

ll A[100001], B[100001];

int main () {
    ll N;
    cin >> N;
    for(int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
    }
    reverse(A, A + N);
    reverse(B, B + N);
    ll ans = 0;
    for(int i = 0; i < N; i++)
    {
        ll tmp = ((A[i] + ans ) % B[i]);
        if(tmp != 0) ans += B[i] - tmp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include<iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout<< "YES"<<endl;
#define No cout<< "No"<<endl;
#define Yes cout<< "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 1000000;

int main(){
    
    string s;
    cin >> s;
    int r,l;
    int n=(int)s.size();
    int ans = 0;
    
    if(n%2==0){
        r = n/2;
        l = n/2-1;
    }else{
        r = n/2+1;
        l = n/2-1;
    }
    
    for(;r<n;r++){
        if(s[r]!=s[l])ans++;
        l--;
    }
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int n;

void solve(){
    int a[1024];
    rep(i,n) cin >> a[i];
    int d = 10000000;
    for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) chmin(d,abs(a[i]-a[j]));
    cout << d << endl;
}

int main(){
    while(1){
        cin >> n;
        if(n==0) break;
        solve();
    }
}

Measured memory_bytes: 3072
s=input()
if(s[0]=='A'):
    if(s.count('C',2,-1)==1):
        s=s.replace('C','')
        if(s[1:].islower()):
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long N, long long K, std::vector<long long> l){
    sort(l.rbegin(),l.rend());

    lli sum = 0;
    REP(i,0,K)sum+=l[i];
    cout<<sum<<endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> l(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&l[i]);
    }
    func(N, K, std::move(l));
    return 0;
}


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

int main(){
    int N, X;
    cin >> N >> X;
    int m[N];
    for(int i = 0; i < N; i++){
        cin >> m[i];
    }

    int tmp = 0;
    for(int j = 0; j < N; j++){
        tmp += m[j];
    }

    int minimum = INT_MAX;
    for(int k = 0; k < N; k++){
        minimum = min(minimum, m[k]);
    }

    cout << (X - tmp) / minimum + N << endl;

    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	string S;	cin >> S;
	sort(S.begin(), S.end());
	char c = 'a';
	for (int i = 0; i < S.size(); ++i) {
		if (S[i] > c) {
			break;
		}
		else {
			c = S[i] + 1;
		}
	}
	if (c == '{') {
		cout << "None" << endl;
		return 0;
	}
	cout << c << endl;
	cin >> S;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int n,q,i,j;
  scanf("%d %d",&n,&q);
  char s[n];
  int kosu[n];
  int answer[q];
  int l[q],r[q];

  scanf("%s",s);

  for(i=0;i<q;i++) scanf("%d %d",&l[i],&r[i]);

  for(i=0,j=0;i<n;i++)
    {
        kosu[i]=j;
        if(s[i]=='A'&&s[i+1]=='C')
            j++;
    }
    kosu[i]=j;

 

  for(i=0;i<q;i++){
    answer[i]=kosu[r[i]-1]-kosu[l[i]-1];
  }

  for(i=0;i<q;i++){
  printf("%d\n",answer[i]);
  }

  return 0;

}


Measured memory_bytes: 2432
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	int m;
      	int pros[] = new int[n];
      	int sum = 0;
      	int istack;
      	int istack2;
      
      	for(int i = 0;i < n;i++) {
          pros[i] = sc.nextInt();
          sum += pros[i];
        }
        m = sc.nextInt();
          
        for(int i = 0;i < m;i++){
          istack = sc.nextInt() - 1;
          istack2 = sc.nextInt();
          istack2 -= pros[istack];
          System.out.println((sum + istack2));
        }
      
	}
}

Measured memory_bytes: 36384
#include <iostream>
#include <set>
#include <stack>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cstring>
#include <queue>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;



int main()
{
	int N, h;
	vector<vector<int>> DP,nums;
	cin >> N;
	nums.resize(N);
	DP.resize(N);
	for (int i = 0; i < N; i++) 
	{
		for (int ii = 0; ii < 3; ii++) 
		{
			cin >> h;
			nums[i].push_back(h);
		}
	}

	DP[0].resize(3);
	DP[0][0] = nums[0][0];
	DP[0][1] = nums[0][1];
	DP[0][2] = nums[0][2];

	for (int i = 1; i < N; i++)
	{
		DP[i].resize(3);
		for (int ii = 0; ii < 3; ii++) 
		{
			if (ii == 0) 
			{
				DP[i][ii] = nums[i][ii] + max(DP[i - 1][ii + 1], DP[i - 1][ii + 2]);
			}
			else if (ii == 1) 
			{
				DP[i][ii] = nums[i][ii] + max(DP[i - 1][ii - 1], DP[i - 1][ii + 1]);
			}
			else if (ii == 2) 
			{
				DP[i][ii] = nums[i][ii] + max(DP[i - 1][ii - 1], DP[i - 1][ii - 2]);
			}
		}
	}
	int maxs = 0;
	for (int i = 0; i < 3; i++)
	{
		if (DP[N - 1][i] > maxs)
			maxs = DP[N - 1][i];
	}
	cout << maxs;
}

Measured memory_bytes: 11136
def C(_mid):
    tmp_sum = 0
    if len(ab) <= _mid:
        return False
    for i in range(0, _mid):
        tmp_sum += ab[i][1]
    if tmp_sum < K:
        return True
    else:
        return False


N, K = list(map(int, input().split()))
ab = []
for i in range(N):
    a, b = list(map(int, input().split()))
    ab.append([a, b])

ab.sort(key=lambda x: x[0])

lb = 0
ub = 100000
while ub - lb > 1:
    # print(str(lb) + " " + str(ub))
    mid = int((lb + ub) / 2)
    if C(mid):
        lb = mid
    else:
        ub = mid

print(ab[lb][0])


Measured memory_bytes: 22920
h,w=map(int,input().split())
n=int(input())
c=list(map(int,input().split()))
d=[]
for i in range(1,n+1):
  for j in range(c[i-1]):
    d.append(i)
ansl=[[0]*w for i in range(h)]
for i in range(h):
  if i%2==0:
    for j in range(w):
      ansl[i][j]=str(d[i*w+j])
  else:
    for j in range(w):
      ansl[i][w-j-1]=str(d[i*w+j])
for j in ansl:
  print(" ".join(j))


Measured memory_bytes: 4208
x=gets.to_i
max = 0
if x < 4
  puts 1
else
  for i in 2..(Math.sqrt(x))
    beki = 0
    j = 0
    while beki <= x
      beki = i**j
      j += 1
    end
    beki = i**(j-2)
    if max < beki
      max = beki
    end
  end
  puts max
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 105;
const int INF = (LL)1e9 + 5;
const LL MOD = 998244353;

int N, K, a[MAXN];
bool dp[100005];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	
	sort(a, a + N);
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j < N && a[j] <= i; j++) {
			if (!dp[i - a[j]]) {
				dp[i] = 1;
				break;
			}
		}
	}
	
	cout << (dp[K] ? "First\n" : "Second\n");
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

const int N_MAX = 2 * 100000;

struct ABpair {
	int a, b;
	bool operator<(const ABpair& right) const {
		return a == right.a ? b < right.b : a < right.a;
	}
};

int N, K, L, counter;
int groups[2][N_MAX + 10];//グループ覚える
map<ABpair,int> group_pair_count;//ペアを数える
bool invited[2][N_MAX + 10];
vector<int> nodes[2][N_MAX + 10];
bool c_flag;

void DFS(int g, int n, int c) {//i:道の種類, n:現在みている点, c:グループの種類
	if (invited[g][n]) return;
	c_flag = true;
	invited[g][n] = true;
	groups[g][n] = c;
	repi(i, 0, nodes[g][n].size()) {
		DFS(g, nodes[g][n][i], c);
	}
	return;
}

int main() {
	cin >> N >> K >> L;
	repi(i, 0, K) {
		int p, q;
		cin >> p >> q;
		nodes[0][p].push_back(q);
		nodes[0][q].push_back(p);
	}
	repi(i, 0, L) {
		int r, s;
		cin >> r >> s;
		nodes[1][r].push_back(s);
		nodes[1][s].push_back(r);
	}

	repi(i, 0, 2) {
		repi(j, 1, N + 1) {
			DFS(i, j, counter);
			if (c_flag) {
				counter++;
				c_flag = false;
			}
		}
	}

	repi(i, 1, N + 1) {
		ABpair abp;
		abp.a = groups[0][i];
		abp.b = groups[1][i];
		group_pair_count[abp]++;
	}

	repi(i, 1, N + 1) {
		ABpair abp;
		abp.a = groups[0][i];
		abp.b = groups[1][i];
		wr(group_pair_count[abp]);
		if (i == N) cout << endl;
		else wr(" ");
	}

	return 0;
}

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

int main(){
  int k,s;cin >> k >> s;
  int ans=0;
  for (int i=0;k>=i;++i){
    for (int j=0;k>=j;++j){
      int z = s - i - j;
      if (z>=0 && z<=k) ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    int n;
    int l = 0;
    vector<int> a(1e+5);

    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        if (a[i] <= 0)
        {
            l += 1;
        }
    }

    // 偶x偶 or 偶x奇
    long sum = 0;
    if (l % 2 == 0){
        for (int i = 0; i < n; i++)
        {
            sum += abs(a[i]);
        }
    } else{
        // 奇x偶
        // 奇x奇
        int m = abs(a[0]);
        for (int i = 0; i < n; i++)
        {
            sum += abs(a[i]);
            if (m >= abs(a[i])){
                m = abs(a[i]);
            }
        }
        sum -= (2 * m);
    }

    cout << sum;
    return 0;
}

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

int p[1000010];

int main() {
	int n;
	int count = 0;
	int ans = 0;

	cin >> n;

	for (int i = 0; i <= 1000000; i++) p[i] = 1;
	p[0] = p[1] = 0;
	for (int i = 2; i*i <= 1000000; i++) {
		if (p[i] == 1) {
			for (int j = 2; i*j <= 1000000; j++) {
				p[i*j] = 0;
			}
		}
	}

	for (int i = 1; i < n + 1; i++) {
		count = 0;
		if (p[i] == 0 && i % 2 != 0) {
			for (int j = 1; j < i + 1; j++) {
				if (i % j == 0) {
					count++;
				}
			}
			if (count == 8) {
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4096
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<iomanip>
#include<map>
#include<iostream>
using namespace std;
int main(){
//int n,a[100001]={0};
//cin>>n;
//cout<< <<endl;
string s;
cin>>s;
cout<<s[0]<<s.length()-2<<s[s.length()-1]; 
return 0;
}


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

typedef long long ll;
using namespace std;

int main(){
  int a,b,c;
  cin >> a>> b >> c;
  cout << max(a,max(b,c))-min(a,min(b,c)) << endl;
  return 0;
}

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


 
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)

#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(int i=0;i<n;i++)

#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ll mul(ll a,ll b)

using namespace std;
ll power(ll x, unsigned long long  y, ll p)  
{  
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y/2; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 
int fib(int n) { 
  double phi = (1 + sqrt(5)) / 2; 
  return round(pow(phi, n) / sqrt(5)); 
} 
ll max_subarray_sum(v arr)
{
    ll max_till = -10000000000000;
    ll  val =0;
    f(i,arr.size())
    {
        val+=arr[i];
        max_till = max(max_till,val);
        if (val <0)
        val=0;
    }
    // cout<<"max-till"<<max_till;
    return max_till;


}

void print_vec(v arr){
    f(i,arr.size())
    cout<<arr[i]<<" ";
    cout<<endl;
}


void solve()
{   
   ll n;
   cin>>n;
   vector<pair<ll,ll>> arr;
   f(i,n){
       ll x;
       cin>>x;
       arr.pb(mp(x,i+1));
   }
   sort(arr.begin(),arr.end());
   f(i,n){
       cout<<arr[i].S<<" ";
   }
   cout<<endl;
   
   ll ans=0;


   
    }











    



int main()
{   fastio;

    
	ll t;
    // ll n,m; 
    // cin>>t;
    t=1;
    f(_,t){
        solve();
    }

     
    



}

    


Measured memory_bytes: 2544
//
//  main.cpp
//  120_C_Unification
//
//  Created by tolemy on 2019/08/15.
//  Copyright © 2019 tolemy. All rights reserved.
//

#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    
    string s;
    cin >> s;
    
    int count0 = 0;
    int count1 = 0;
    
    for(int i = 0;i<s.length();i++)
    {
        if(s[i] == '0')
        {
            count0++;
        }
        else
        {
            count1++;
        }
    }
    
    int result = 2 * min(count0, count1);
    
    // insert code here...
    std::cout << result << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> ab(n);
    vector<pair<ll, ll>> cd(m);
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        ab[i] = make_pair(a, b);
    }
    rep(i, m) {
        ll c, d;
        cin >> c >> d;
        cd[i] = make_pair(c, d);
    }
    rep(i, n) {
        ll x = ab[i].first;
        ll y = ab[i].second;
        ll min_dist = 1e18;
        ll min_p = 0;
        rep(j, m) {
            ll chk_x = cd[j].first;
            ll chk_y = cd[j].second;
            ll dist = abs(x - chk_x) + abs(y - chk_y);
            if ( min_dist > dist ) {
                min_p = j + 1;
                min_dist = dist;
            }
        }
        cout << min_p << endl;
    }
    return 0;
}


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

l = 0
r = 0
l_num = 0
r_num = -1
while n > 1:
    if l <= r:
        l += a[l_num]
        l_num += 1
    else:
        r += a[r_num]
        r_num -= 1
    n -= 1

ans = min(abs(r - (l + a[l_num])), abs(l - (r + a[r_num])))

print(ans)

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	int R;
	cin >> R;
	cout << 2*M_PI*R;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;

int main() {
    int64_t N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    vector<int64_t> B(N);
    B.at(0)++;
    int64_t now = 1, sp, Tim;
    for (int i = 0; i < N; i++){
        if (i + 1 == K){
            cout << A.at(now - 1) << endl;
            return 0;
        }
        B.at(A.at(now - 1) - 1)++;
        if (B.at(A.at(now - 1) - 1) == 2){
            sp = A.at(now - 1);
            Tim = i + 1;
            break;
        }
        now = A.at(now - 1);
    }
    now = sp;
    int64_t L;
    for (int i = 0; i < N; i++){
        now = A.at(now - 1);
        if (now == sp){
            L = i + 1;
        }
    }
    int64_t Y = K - Tim;
    Y %= L;
    now = sp;
    for (int i = 0; i < Y; i++){
        now = A.at(now - 1);
    }
    cout << now << endl;

    

}

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

int main(){
    int n, digit=1;
    cin >> n;
    int n1 = n;
    rep(i, 6){
        n /= 10;
        if(n!=0)digit++;
    }

    if(digit==1) cout << n1 << endl;
    else if(digit==2) cout << 9 << endl;
    else if(digit==3) cout << n1-90 << endl;
    else if(digit==4) cout << 909 << endl;
    else if(digit==5) cout << n1-9090 << endl;
    else if(digit==6) cout << 90909 << endl;
    
    return 0;
}


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

int main() {
  int l,r;
  cin>>l>>r;
  bool result=false;
  int minimum=2020;
  int rest=0;
  
  for(int i=l;i<=r;i++){
    if(i%2019==0){
      minimum=0;
      goto OUT;
    }else{
      for(int j=l;j<=r;j++){
        if(j%2019==0){
          minimum=0;
          goto OUT;
        }
        if(i<j){
          int i_t=i%2019;
          int j_t=j%2019;
          rest=(i_t*j_t)%2019;
          if(minimum>=rest)minimum=rest;
        }
      }
    }
  }
  
  OUT:
  cout<<minimum<<endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void fst()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
}
int mod = 1e9 + 7;
int binpow(int a, int b)
{
    int res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = res * a;
            res %= mod;
        }
        a = a * a;
        a %= mod;
        b >>= 1;
        b %= mod;
    }
    return res;
}
#define Darr(x)           \
    cerr << #x << " = ";  \
    for (auto i : x)      \
        cerr << i << " "; \
    cerr << "\n";

#define all(a) a.begin(), a.end()
#define pb push_back
#define deb(x) cerr << #x << "=" << x << " ";
#define int long long
#define R(n) for (int i = 0; i < n; i++)
#define Rj(n) for (int j = 0; j < n; j++)
#define F(i, a, n) for (int i = a; i <= n; i++)
#define MN(x, y) x = min(x, y);
#define MX(x, y) x = max(x, y);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

int n, k, tc, y, u, v;

int32_t main()
{
    fst();
    //freopen("input.txt", "r", stdin);
    cin >> n;
    vi a(n);
    R(n) cin >> a[i];
    int i = 0;
    int money = 1000;
    int mx = 0;
    while (i < n)
    {
        int mn = a[i];
        while (a[i] > a[i + 1] && i < n-1)
        {
            mn = a[i + 1];
            i++;
        }
        int mx = a[i];
        while (a[i + 1] > a[i] && i < n-1)
        {
            mx = a[i + 1];
            i++;
        }/* 
        deb(mn)
        deb(mx) */
        if (mx > mn)
        {
            int k = (money) / mn;
            money %= mn;
            money += mx * k;
            if (i == n - 1)
                break;
        }
        i++;
    }
    cout << money << "\n";

    // Darr(a);
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string str,st,stt;
  int i,j,n,m;
   
  cin>>stt;
  n=stt.size();
  for(i=0;i<n;i++)
  {
  	cout<<"x";
  }
  
  
 return 0;  
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <deque>
#include <iostream>
#include <queue>
#include <math.h>
#include <algorithm>
#include <fstream>

using namespace std;
typedef long long ll;


int main(void) {
	/**/
	int count = 0, n;
	double sum=0;
	cin >> n;
	vector<int> a(n);


	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		sum += 1.0 / a[i];
	}
	cout << 1.0 / sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll n,q,k,a[1000005],b[1000005],c[1000005],ans;
string s;
int main(void){
	cin>>n>>s>>q;
	for(int i=0;i<n;i++){
	    if(s[i]=='D')a[i]++;
	    if(s[i]=='M')b[i]++;
	    if(s[i]=='C')c[i]++;
	}
	while(q--){
	    ans=0;
	    cin>>k;
	    ll x=0,y=0,z=0;
	    for(int i=0;i<n;i++){
	       if(i-k>=0){
	            if(a[i-k]){
	                y-=z;
	                x--;
	            }   
	            if(b[i-k]){
	                z--;
	            }
	       }
	       if(a[i]){
	           x++;
	       }
	       if(b[i]){
	           y+=x;
	           z++;
	       }
	       if(c[i])ans+=y;
	    }
	    cout<<ans<<endl;
	}
}


Measured memory_bytes: 24836
#include<stdio.h>
int main()
{  int n,i,k;
   long long a[200001];
   scanf("%d%d",&n,&k);
   for(i=1;i<=n;i++)
   scanf("%lld",&a[i]);
   for(i=1;i<=n-k;i++)
   {  if(a[i]<a[i+k]) printf("Yes\n");
      else printf("No\n");
   }
} 

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

#define Fo(i,k,n) for(i=k ; i<n ; i++)
#define ll  long long
#define ull unsigned long long
#define f(i,n) for(int i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007

void solve()
{
  int n;
  cin>>n;
  int vacation[n][3], dp[n][3];
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<3;j++)
      cin>>vacation[i][j];
  }
  for(int i=0;i<3;i++)
    dp[0][i] = vacation[0][i];
  for(int i=1;i<n;i++)
  {
    for(int j=0;j<3;j++)
    {
      if(j == 0)
        dp[i][j] = vacation[i][j] + max(dp[i-1][1],dp[i-1][2]);
      else if(j == 1)
        dp[i][j] = vacation[i][j] + max(dp[i-1][0],dp[i-1][2]);
      else if(j == 2)
        dp[i][j] = vacation[i][j] + max(dp[i-1][0],dp[i-1][1]);
    }
  }
  cout<<(max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])));
}

signed main()
{
  fastio


  int t=1;
  //cin>>t;
  
  for(int i = 1;i<=t;i++)
  {
    //cout<<"Case #"<<i<<": "<<solve()<<"\n";
    solve();
  }

}

Measured memory_bytes: 5928
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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


int main() {
    string s;
    cin >> s;
    string ans = "No";
    FOR(i, 1, 3) {
        if(s[i-1] != s[i]){
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>

using namespace std;


int main(){
    int n;
    cin>>n;
    set<string> S;
    for (int i = 1; i <= n; i++) {
        string str;
        cin>>str;
        S.insert(str);
    }
    cout<<S.size()<<endl;
}

Measured memory_bytes: 15648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


int main(){
	ll n;
	std::cin >> n;
	std::map<ll, int> a;
	rep(i,n){
		for (auto p : prime_factor(i+1)) {
			if(a.count(p.first))a[p.first]+=p.second;
			else a[p.first]=p.second;
			/* code */
		}
	}
	ll ans=1;
	for (auto p : a) {
		/* code */
		ans*=p.second+1;
		ans%=MOD;
		
	}
	std::cout << ans << std::endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int A[4][3][10]={};
    int N;
    int a,b,c,d;

    scanf("%d",&N);

    for(int i=0;i<N;i++){
        scanf("%d %d %d %d",&a,&b,&c,&d);
        A[a-1][b-1][c-1] += d;
    }

    for(int i=0;i<4;i++){
        for(int f=0;f<3;f++){
            for(int l=0;l<10;l++){
                printf(" %d",A[i][f][l]);
            }
            printf("\n");
        }
        if(i!=3)
            printf("####################\n");
    }
}


Measured memory_bytes: 2048
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;

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

static const int MAX = 10000;
static const int INFTY = (1 << 20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int>> adj[MAX];

void dijkstra() {
	priority_queue<pair<int, int>> PQ;
	int color[MAX];
	int dist[MAX];
	REP(i, n) {
		dist[i] = INFTY;
		color[i] = WHITE;
	}

	dist[0] = 0;
	PQ.push(make_pair(0, 0));
	color[0] = GRAY;

	while (!PQ.empty()) {
		pair<int, int> f = PQ.top(); PQ.pop();
		int u = f.second;
		color[u] = BLACK;

		//????°???????????????????????????????????????§???????????°??????
		if (dist[u] < f.first*(-1)) continue;

		REP(j, adj[u].size()) {
			int v = adj[u][j].first;
			if (color[v] == BLACK) continue;
			if (dist[v] > dist[u] + adj[u][j].second) {
				dist[v] = dist[u] + adj[u][j].second;
				PQ.push(make_pair(dist[v] * (-1), v));
				color[v] = GRAY;
			}
		}
	}

	REP(i, n) {
		cout << i << " " << (dist[i] == INFTY ? -1 : dist[i]) << endl;
	}
}

int main() {
	int k, u, v, c;
	cin >> n;
	REP(i, n) {
		cin >> u >> k;
		REP(j, k) {
			cin >> v >> c;
			adj[u].push_back(make_pair(v, c));
		}
	}

	dijkstra();

	return 0;
}

Measured memory_bytes: 8008
/**
 * @param input number
 */
function Main(input) {
  for (var num = input; true; num++) {
    if (isPrime(num)) {
      break;
    }
  }

  console.log(num);
}

function isPrime(num) {
  for (var i = 2; i < num; i++) {
    if (num % i === 0) {
      return false;
    }
  }
  return true;
}

Main(+require("fs").readFileSync("/dev/stdin", "utf8").trim());

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

int main()
{
	int N;
	bool appeared[100001] = {};
	int overlap_count = 0;
	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		int A;
		cin >> A;
		if (appeared[A])
			overlap_count++;
		else
			appeared[A] = true;
	}

	cout << N - (overlap_count / 2 + overlap_count % 2) * 2 << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int fi[256][256];

int main(void){
	
	int n, i, j;
	
	while (1){
		
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		
		fi[n][n] = 0;
		
		for (i = 0; i < n; i++){
			fi[i][n] = 0;
			for (j = 0; j < n; j++){
				scanf("%d", &fi[i][j]);
				fi[i][n] += fi[i][j];
			}
			fi[n][n] += fi[i][n];
		}
		
		for (i = 0; i < n; i++){
			fi[n][i] = 0;
			for (j = 0; j < n; j++){
				fi[n][i] += fi[j][i];
			}
		}
		
		for (i = 0; i <= n; i++){
			for (j = 0; j <= n; j++){
				printf("%5d", fi[i][j]);
			}
			
			printf("\n");
		}
	}
	
	return (0);
}
		

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

int main(){
    ll x,a,b;
    cin >>x;
    a=x/500;
    b=(x%500)/5;
    cout<<a*1000+b*5;
}

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

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

int main()
{
    _upgrade
    int n, x; cin >> n >> x;
    vector < int > v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(all(v));
    for(int i = 0; i < n; i++)
    {
        if(x < v[i])
        {
            cout << i << "\n";
            return 0;
        }
        x -= v[i];
    }
    cout << (x == 0 ? n : n - 1) << "\n";
	return 0;
}


Measured memory_bytes: 892
#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (s, ) = input!(u64);

    let st = 1_000_000_000;

    let quotient = s / st;
    let modulo = s % st;

    if s == 1_000_000_000_000_000_000 {
        println!("{} {} {} {} {} {}", 0, 0, 0, st, st, 0);
    } else {
        println!("{} {} {} {} {} {}", 0, 0, st, 1, st - modulo, quotient + 1);
    }
}

fn main() {
    solve();
}


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

using namespace std;

typedef long long ll;

const double eps = 0.00001;
const int MOD = 1000000007; //998244353
const int INF = 1070000055;
const long long LINF = 1223372000000000555;
const int N = 1050555;
const int M = 6525;

int a[N];
vector<int> v[N];
int cnt[N];
void solve(){
    int n;
    cin >> n;

    int g = 0;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        g = __gcd(g, a[i]);
    }

    for (int i = 2; i <= 1e6; i++){
        if (v[i].size() > 0) continue;
        v[i] = {i};
        for (int j = i + i; j <= 1e6; j += i){
            v[j].push_back(i);
        }
    }

    for (int i = 1; i <= n; i++){
        for (int x : v[a[i]]){
            cnt[x]++;
        }
    }

    if (*max_element(cnt, cnt + N) <= 1){
        cout << "pairwise coprime";
        return;
    }

    if (g == 1){
        cout << "setwise coprime";
        return;
    }

    cout << "not coprime";

}


int main() {
    ios_base::sync_with_stdio(false);
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 67776
/* long long or int & the MAX_INT or MIN_INT */
/* the size of a[] & inline */
/* xx 396 */

#include<bits/stdc++.h>
using namespace std;

const int MAX_N=1e2+10;

int B[MAX_N],N,A[MAX_N],ans=0;

signed main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>N; for(int i=0;i<N-1;i++) cin>>B[i];
	A[0]=B[0]; A[1]=B[0];
	for(int i=1;i<N-1;i++){
		if(A[i]>B[i]) A[i]=B[i];
		A[i+1]=B[i];
	}
	for(int i=0;i<N;i++) ans+=A[i];
	cout<<ans<<endl;
	return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

ll Q, H, S, D;
ll N;

int main() {
	cin >> Q >> H >> S >> D >> N;
	H = min(H, Q * 2);
	S = min(S, H * 2);
	D = min(D, S * 2);

	ll ret = (N / 2) * D + ((N & 1) ? S : 0LL);
	cout << ret << endl;
	return 0;
}

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


int main (){
    int N;
    cin>>N;
    vector<int> V(N), C(N);
    for(int i=0; i<N; i++){
        cin>>V.at(i);
    }
    for(int i=0; i<N; i++){
        cin>>C.at(i);
    }
    int sum=0;
    for(int i=0; i<N; i++){
        if(V.at(i)-C.at(i)>0){
            sum+=V.at(i)-C.at(i);
        }
    }
    cout<<sum<<endl;

}
    

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

int main(void){
        ll a, b, k;
        cin >> a >> b >> k;
        if(k <= a) cout << a - k << " " << b << endl;
        else {
                ll new_b = a + b - k;
                new_b = new_b >= 0 ? new_b : 0;
                cout << 0 << " " << new_b << endl;
        }
        return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <set>

using namespace std;
using ll = long long int;

// num: 12 -> {2, 3}
// num は最大で1e12
set<int> get_factors(ll num) {
	ll n = num;
	set<int> ret;
	while (n % 2 == 0) {
		n /= 2;
		ret.insert(2);
	}
	// nは奇数
	for(ll i = 3; i * i <= num; i += 2) {
		while (n % i == 0) {
			n /= i;
			ret.insert(i);
		}
	}
	if (n != 1) {
	ret.insert(n);

	}
	return ret;
}

int main() {
	// your code goes here
	ll A, B;
	cin >> A >> B;
	
	auto res1 = get_factors(A);
	auto res2 = get_factors(B);

	int cnt = 0;
	for(auto e: res1) {
		cnt += res2.count(e);
	}
	++cnt;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
    fscanf(STDIN,"%d %d %d",$a[0],$a[1],$a[2]);
    fscanf(STDIN,"%d %d %d",$a[3],$a[4],$a[5]);
    fscanf(STDIN,"%d %d %d",$a[6],$a[7],$a[8]);
    fscanf(STDIN,"%d",$n);
    
    $exKey=[];
    for($i=0;$i<$n;$i++){
        if(in_array($b = (int)trim(fgets(STDIN)),$a)){
            $exKey[] = array_search($b, $a);
        }
    }
    // print_r($exKey);
    $isBingos = [
        [0,1,2],
        [3,4,5],
        [6,7,8],
        [0,3,6],
        [1,4,7],
        [2,5,8],
        [0,4,8],
        [2,4,6]
    ];

    foreach($isBingos as $isBingo){
        if(array_intersect($isBingo,$exKey) === $isBingo){
            echo "Yes" . PHP_EOL;
            break;
        }
        if($isBingo === end($isBingos)){
            echo "No".PHP_EOL;
        }
    }
?>

Measured memory_bytes: 4856
/*
 ____________________________________________________________
|                                                            |
|                   Author: ay2306                           |
|____________________________________________________________|

*/
#include <bits/stdc++.h>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define MAXN 25
using namespace std;

int main(){
    int a;
    cin >> a;
    if(a<1200)cout << "ABC";
    else if(a < 2800)cout << "ARC";
    else cout << "AGC";   
    return 0;;
}

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

const int N = (int) 1e5;
int a[N], b[N], n, k;
vector<int> graph[N];
int depth[N];

void dfs(int u) {
    int nc = 0;
    for (auto v : graph[u]) {
        dfs(v);
        if (depth[v] != -1) {
            depth[u] = max(depth[u], depth[v]);
            ++nc;
        }
    }
    if (nc != 0) ++depth[u];
    if (depth[u] == k - 1) b[u] = 0, depth[u] = -1;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; --a[i];
        if (i != 0) graph[a[i]].push_back(i);
    }
    copy(a, a + n, b);
    dfs(0);
    int res = 0;
    b[0] = 0;
    for (int i = 0; i < n; ++i) if (a[i] != b[i]) ++res;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;


void solve(){
    string s, t, u;
    cin>>s;
    t = s;
    reverse(all(t));
    if(s != t){cout<<"No";return ;}
    u = s.substr(0,s.length()/2);
    //cout<<u<<endl;
    t = u;
    reverse(all(t));
    if(u != t){cout<<"No";return ;}
    u = s.substr(s.length()/2+1,s.length());
    //cout<<u<<endl;
    t = u;
    reverse(all(t));
    if(u != t){cout<<"No";return ;}
    cout<<"Yes";
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,d,x,a,ans;
    while(cin >> n >> d >> x)
    {
        ans = 0;
        for(int i = 0; i < n; i++)
        {
            cin >> a;
            for(int i = 1; i <= d; i += a)
                ans++;
        }
        cout << ans + x << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 1000000000
typedef long long ll;
typedef pair<ll,int> P;

int dp[110000][3];

int main(){
  int N,a[110000][3];
  cin>>N;
  for(int i=1;i<=N;i++){
    for(int j=0;j<3;j++) cin>>a[i][j];
  }

  dp[0][1]=0; dp[0][0]=0; dp[0][2]=0;

  for(int i=1;i<=N;i++){
    for(int j=0;j<3;j++){
      dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
    }
  }
  cout<<max(dp[N][0],max(dp[N][1],dp[N][2]))<<endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

//dp[i][j]はi個使い和がjのもの
vector<vector<ll>> dp(51, vector<ll>(2501, 0));

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A;
    cin >> A;
    vector<ll> X(N,0);
    for(ll i=0;i<N;++i)cin>>X[i];

    dp[0][0]=1;

    //１つずつ解禁
    for(ll i=0;i<N;++i){
        for(ll j=50;j>=1;--j){
            for(ll k=2500;k>=X[i];--k){
                dp[j][k]+=dp[j-1][k-X[i]];
            }
        }
    }

    ll ans=0;

    for(ll i=1;i<=50;++i){
        ans+=dp[i][i*A];
    }

    prt(ans)

    
    return 0;
}


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

int main() {
    vector<int> A;
    int q; cin >> q;
    int query;
    
    for(int i=0; i < q; ++i){
        cin >> query;
        if(query==0){
            int x; cin >> x;
            A.push_back(x);
        }else if(query==1){
            int p; cin >> p;
            cout << A.at(p) << endl;
        }else{
            A.pop_back();
        }
    }
}



Measured memory_bytes: 3940
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include<algorithm>
#include<iomanip>
#include<math.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int main()
{
	long long H,M = 1;
	long long a = 0;


	cin >> H;


	while (1) {
		if (H == 1 || H == 0) {
			a++;
			break;
		}
	
		a++;
		H = H / 2;

	}


	for (long long i = 1; i <= a; i++) {
		M = M * 2;
	}
	M = M - 1;

	cout << M;
}


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

    class Program
    {        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var tmp = new StringBuilder();
            var maerd = new StringBuilder("maerd");
            var remaerd = new StringBuilder("remaerd");
            var esare = new StringBuilder("esare");
            var resare = new StringBuilder("resare");
            for (var i = S.Length-1;0<=i;i--)
            {
                tmp.Append(S[i]);
                if (tmp.Length < 5) continue;
                if (tmp.Equals(maerd)) tmp.Clear(); 
                if (tmp.Equals(remaerd)) tmp.Clear(); 
                if (tmp.Equals(esare)) tmp.Clear(); 
                if (tmp.Equals(resare)) tmp.Clear(); 
            }
            if (tmp.Length!=0)
            {
                Console.WriteLine("NO");
                return;
            }
            Console.WriteLine("YES");
        }
    }

Measured memory_bytes: 13168