akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

static class CodeJam
{
    class Node
    {
        private readonly int i;
        private readonly int j;
        private bool visited = false;
        public int ans;
        public List<Node> Next { get; private set; }
        public Node(int i, int j)
        {
            this.i = i;
            this.j = j;
            ans = 0;
            Next = new List<Node>();
        }
        public int Get()
        {
            visited = true;
            if (ans == 0)
            {
                ans = 1;
                foreach (var next in Next)
                {
                    if (next.visited) { return -1; }
                    int max = next.Get();
                    if (max == -1) { return -1; } else { ans = Math.Max(max + 1, ans); }
                }
            }
            visited = false;
            return ans;
        }
    }

    static int Solve(int N, int[][] A)
    {
        var nodes = new Node[N][];
        for (int i = 0; i < N; ++i)
        {
            nodes[i] = new Node[N];
        }
        for (int i = 0; i < N; ++i)
        {
            for (int j = i + 1; j < N; ++j)
            {
                var node = new Node(i, j);
                nodes[i][j] = node;
                nodes[j][i] = node;
            }
        }
        Func<int, int, Node> get_node = (i, j) => { return nodes[i][A[i][j]]; };
        for (int i = 0; i < N; ++i)
        {
            var node1 = get_node(i, 0);
            for (int j = 1; j < N - 1; ++j)
            {
                var node2 = get_node(i, j);
                node1.Next.Add(node2);
                node1 = node2;
            }
        }
        int ans = 0;
        for (int i = 0; i < N; ++i)
        {
            int max = get_node(i, 0).Get();
            if (max == -1) { return -1; } else { ans = Math.Max(max, ans); }
        }
        return ans;
    }

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[][] A = new int[N][];
        for (int i = 0; i < N; ++i)
        {
            A[i] = Console.ReadLine().Split().Select(n => int.Parse(n) - 1).ToArray();
        }
        Console.WriteLine(Solve(N, A));
    }
}


Measured memory_bytes: 100800
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e6;
const double PI = acos(-1.0);
#define Test ll tesnum;tesnum = read();while(tesnum--)
ll read();
ll v[N];
int main()
{
    int n;
    cin>>n;
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        int x;
        cin>>x;
        v[x]++;
        ans+=x;
    }
    int q;
    cin>>q;
    while(q--){
        int a,b;
        cin>>a>>b;
        int d = b-a;
        ans+=d*v[a];
        v[b]+=v[a];
        v[a] = 0;
        cout<<ans<<endl;
    }
    return "BT7274", NULL;
}

inline ll read() {
    ll hcy = 0, dia = 1;char boluo = getchar();
    while (!isdigit(boluo)) {if (boluo == '-')dia = -1;boluo = getchar();}
    while (isdigit(boluo)) {hcy = hcy * 10 + boluo - '0';boluo = getchar();}
    return hcy * dia;
}

Measured memory_bytes: 4340
#include<cstdio>
#include<vector>
#include<cstdlib>

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi>  vvi;

const int INF=(1<<31)-1;

template<class T> struct Interval{
	T a,b;
	Interval(){}
	Interval(T A,T B):a(A),b(B){}
};

template<class T>
class RMQ{
	int n;
	// vector<T> a;
	T *a;

	T query(const Interval<int> &I,const Interval<int> &J,int u){
		if(J.b<=I.a || I.b<=J.a) return INF;
		if(I.a<=J.a && J.b<=I.b) return a[u];

		int m=(J.a+J.b)/2;
		T tl=query(I,Interval<int>(J.a,m),2*u+1);
		T tr=query(I,Interval<int>(m,J.b),2*u+2);
		return tl<tr?tl:tr;
	}

public:
	RMQ():a(NULL){}

	RMQ(const vector< vector<T> > &v,int k,int b):n(1){
		int N;
		if(!b) N=v[0].size();
		else   N=v.size();

		while(n<N) n<<=1;
		// a=vector<T>(2*n-1);
		a=(T *)malloc((2*n-1)*sizeof(T));
		rep(i,2*n-1) a[i]=0;

		if(!b) rep(i,N) a[n+i-1]=v[k][i];
		else   rep(i,N) a[n+i-1]=v[i][k];

		for(int i=n-2;i>=0;i--) a[i]=min(a[2*i+1],a[2*i+2]);
	}

	// ~RMQ(){ if(a){ free(a); printf("> hoge\n");} else puts("hogehoge"); }

	T query(int a,int b){
		return query(Interval<int>(a,b),Interval<int>(0,n),0);
	}
};

int main(){
	for(int h,w,q;scanf("%d%d%d",&h,&w,&q),h||w||q;){
		vvi a(h,vi(w));
		rep(i,h) rep(j,w) scanf("%d",&a[i][j]);

		vector< RMQ<int> > rmq1(h);
		vector< RMQ<int> > rmq2(w);
		rep(i,h) rmq1[i]=RMQ<int>(a,i,0);
		rep(j,w) rmq2[j]=RMQ<int>(a,j,1);

		rep(_,q){
			int t,l,b,r; scanf("%d%d%d%d",&t,&l,&b,&r); b++; r++;

			int ans=INF;
			if(b-t<r-l) for(int i=t;i<b;i++) ans=min(ans,rmq1[i].query(l,r));
			else        for(int j=l;j<r;j++) ans=min(ans,rmq2[j].query(t,b));
			printf("%d\n",ans);
		}
	}

	return 0;
}

Measured memory_bytes: 58000
# Problem D - Chat in a Circle

from collections import deque

# input
N = int(input())
a_nums = list(map(int, input().split()))

# initialization
a_nums = sorted(a_nums, reverse=True)
point_list = deque([a_nums[0]])
point = 0

# count
for i in range(1, N):
    a = a_nums[i]
    point += point_list.popleft()
    point_list.append(a)
    point_list.append(a)

# output
print(point)


Measured memory_bytes: 106612
#include<iostream>
#include<vector>
#include<string>

int main(){
	int n;
	long long ans;
	long long mod= 1000000007;
	std::string s1, s2;
	std::vector<bool> isVert;

	std::cin>>n;
	std::cin>>s1;
	std::cin>>s2;

	for(int i=0; i<s1.size(); i++){
		if(s1[i]==s2[i]){
			isVert.push_back(true);
		}
		else{
			isVert.push_back(false);
			i++;
		}
	}

	if(isVert[0])
		ans=3;
	else
		ans=6;

	for(int i=1; i<isVert.size(); i++){
		if(!isVert[i-1] && !isVert[i])
			ans*=3;
		else if(isVert[i-1])
			ans*=2;
		
		ans= ans%mod;
	}

	std::cout<<ans<<std::endl;

	return 0;

}

Measured memory_bytes: 256
import itertools

N = int(input())

c = 0
n = str(N)
L = len(n)

if L >= 3:
  for j in range(L-2):
    for i in itertools.product(['3', '5', '7'], repeat=j+3):
      if int("".join(i)) <= N and len(set(i)) == 3:
        c += 1

print(c)


Measured memory_bytes: 46064
#include <stdio.h>
int main(void)
{
	int d,t,i;
	scanf("%d %d",&d,&t);
	i=0;
	while(1){
		if(d>=t || d==t){
			d=d-t;
			i=i+1;
		}
		if(d==0){
			break;
		}
		if(d<t){
			d=d-1;
			i=i+1;
		}
	}
	printf("%d\n",i);
	return 0;
}


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

int main() {	

	int n; cin >> n;
	string p_s = "";
	for (int i = 0; i < n; i++) {
		int p; cin >> p;
		p_s += to_string(p);
	}
	string q_s = "";
	for (int i = 0; i < n; i++) {
		int q; cin >> q;
		q_s += to_string(q);
	}
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		c[i] = i + 1;
	}
	int cnt = 1;
	int a, b;
	do {
		string c_s = "";
		for (int i = 0; i < n; i++) c_s += to_string(c[i]);
		if (c_s == p_s) a = cnt;
		if (c_s == q_s) b = cnt;
		cnt++;
	} while (next_permutation(c.begin(), c.end()));

	cout << abs(a - b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[28] = {0};
  string s;
  cin >> s;
  rep(i,s.size()){
    int p = (char)s[i]-'a';
    if(a[p] == 0){
        a[p] = 1;
    }else{
      while(p<26 && a[p] == 1) p++;
      if(p!=26){
        if(s.size() == 26) break;
        cout << s.substr(0,i) + (char)(p+'a') << endl;
        return 0;
      }
      while(i>0 && (char)s[i] <= (char)s[i-1]){ i--;a[(char)s[i]-'a'] = 0;}
      if(i==0){
        cout << "-1" << endl;
        return 0;
      }
      a[(char)s[i]-'a'] = 0;
      p = (char)s[i-1]-'a'+1;
      while(p<26 && a[p] == 1) p++;
      cout << s.substr(0,i-1) + (char)(p+'a') << endl;
      return 0;
    }
  }

  if(s.size() == 26){
    int i = 25;
    int p;
    a[(char)s[i]-'a'] = 0;
    while(i>0 && (char)s[i] < (char)s[i-1]){i--;a[(char)s[i]-'a'] = 0;}
    if(i==0){
      cout << "-1" << endl;
      return 0;
    }
    a[(char)s[i]-'a'] = 0;
    p = (char)s[i-1]-'a'+1;
    while(p<26 && a[p] == 1) p++;
    cout << s.substr(0,i-1) + (char)(p+'a') << endl;
  }else{
    int p = 0;
    while(p<26 && a[p] == 1) p++;
    cout << s + (char)(p+'a') << endl;
  }
  return 0;
}


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;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;
template <class T, class U>
void chmin(T& t, const U& u) {
  if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
  if (t < u) t = u;
}

const int MX = 1000005;
int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> c(MX, 0);
  rep(i, N) cin >> A[i], c[A[i]]++;
  bool pairwise = true;
  for (int i = 2; i < MX; i++) {
    int cnt = 0;
    for (int j = i; j < MX; j += i) {
      cnt += c[j];
    }
    if (cnt > 1) pairwise = false;
  }
  if (pairwise) {
    cout << "pairwise coprime" << endl;
    return 0;
  }
  int g = 0;
  rep(i, N) g = gcd(g, A[i]);
  if (g == 1) {
    cout << "setwise coprime" << endl;
    return 0;
  }
  cout << "not coprime" << endl;
  return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> data(m, vector<int>(10));

    for (int i = 0; i < m; i++){
        int k;
        cin >> k;
        for (int j = 0; j < k; j++){
            cin >> data.at(i).at(j);
        }
    }

    vector<int> amari(m);
    for (int i = 0; i < m; i++){
        cin >> amari.at(i);
    }

    int sum = 0;

    for (int i = 0; i < (1 << n) ; i++){
        bitset<10> bit(i);

        int light = 0;

        for (int j = 0; j < m; j++){
            int count = 0;
            for (int k = 0; k < 10; k++){
                if (data.at(j).at(k) == 0){
                    break;
                }

                if (bit.test(data.at(j).at(k) - 1)){
                    count++;
                }
            }

            if (count % 2 == amari.at(j)){
                light++;
            }
        }

        if (light == m){
            sum++;
        }

    }

    cout << sum << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int SX,SY,TX,TY;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>SX>>SY>>TX>>TY;
	FOR(i,TX-SX) _P("R");
	FOR(i,TY-SY) _P("U");
	FOR(i,TX-SX) _P("L");
	FOR(i,TY-SY) _P("D");
	_P("D");
	FOR(i,TX-SX+1) _P("R");
	FOR(i,TY-SY+1) _P("U");
	_P("L");
	_P("U");
	FOR(i,TX-SX+1) _P("L");
	FOR(i,TY-SY+1) _P("D");
	_P("R");
	_P("\n");
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 384
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int32_t X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<int64_t> p(A), q(B), r(C), a(X + Y + C);
  auto f = [](auto n, auto& c) { copy_n(istream_iterator<int64_t>(cin), n, begin(c)); sort(rbegin(c), rend(c)); };
  f(A, p); f(B, q); f(C, r);
  copy_n(begin(p), X, copy_n(begin(q), Y, copy_n(begin(r), C, begin(a)))); sort(rbegin(a), rend(a));
  cout << accumulate(begin(a), next(begin(a), X + Y), 0ll) << endl;
}


Measured memory_bytes: 4864
n,m,x,y = map(int, input().split())
xli = list(map(int, input().split()))
yli = list(map(int, input().split()))
xmax = max(xli)
ymin = min(yli)
for z in range(x+1, y+1):
    if xmax < z <= ymin:
        print("No War")
        exit()
print("War")

Measured memory_bytes: 3064
//ABC107C
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	vector<long long int> x(n);
	for(int i=0;i<n;i++){
		cin >> x.at(i);
	}
	long long int ans = x.at(k-1)-x.at(0) + min(abs(x.at(0)),abs(x.at(k-1)));
	for(int i=1;i<=n-k;i++){
		ans = min(ans,x.at(i+k-1)-x.at(i) + min(abs(x.at(i)),abs(x.at(i+k-1))));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
object Main extends App {
  val a = scala.io.StdIn.readInt()
  val b = scala.io.StdIn.readInt()
  val c = scala.io.StdIn.readInt()
  val x = scala.io.StdIn.readInt()

  var count = 0
  for (numA <- 0 to a; numB <- 0 to b; numC <- 0 to c) {
    if (x - (numA * 500 + numB * 100 + numC * 50) == 0) count += 1
  }

  println(count)
}

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

int main(void){
    int n,t,a;
    double ans = 10000000,c = 0;
    cin >> n >> t >> a;
    int h[n];
    for(int i = 0;i < n;i++)cin >> h[i];
    for(int i = 0;i < n;i++){
        if(abs((t-h[i]*0.006)-a) < ans){
            ans = abs(a-(t-h[i]*0.006));
            c = i+1;
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}
 
int main() {
	init();

	int n, k; cin >> n >> k;
	vector<int>d(k);
	rep(i, k)cin >> d[i];
	bool is = false;
	while (!is) {
		is = true;
		string s = to_string(n);
		rep(i, s.size()) {
			int a = s[i] - '0';
			rep(j, k) {
				if (a == d[j])is = false;
			}
		}
		if(!is)n++;
	}
	cout << n << "\n";


	return 0;
}

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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	int a, b; cin >> a >> b;

	if(b % a){
		cout << b - a << endl;
	}else{
		cout << b + a << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main() {
    int n;
    std::cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) std::cin >> a[i];
    int num = 0;
    while(true){
        for(int i = 0; i < n; i++){
            if(a[i]%2 != 0) {
                std::cout << num << std::endl;
                return 0;
            }
        }
        num++;
        for(int i = 0; i < n; i++) a[i] /= 2;

    }
    std::cout << num << std::endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<ll,ll>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long MODPOW(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	ll x;
    cin >> x;
    if(x>=30){
        cout <<"Yes" <<endl;
    }else{
        cout << "No" << endl;
    }
}

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


namespace Test1 {



    class ClassMain {


        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int n = ints[0];
                int y = ints[1];
                //int n = int.Parse(line);
                if(n==0){break;}

                if (n % 2 == 0 || y % 2 == 0) { Console.WriteLine("yes"); }
                else { Console.WriteLine("no"); }
            }
            
        }

        
    }

    

    
}

Measured memory_bytes: 5796
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール

// 処理内容
int main() {
    
    ll d, n; cin >> d >> n;
    vector<ll> t(d), a(n), b(n), c(n);
    REP(i, d) cin >> t[i];
    REP(i, n) cin >> a[i] >> b[i] >> c[i];

    // dp[i][j] := i日目(0-indexed)までみて、i日目に服jを着たときのスコア最大値
    vector<vector<ll>> dp(d, vector<ll>(n, 0));
    RANGE(i, 1, d-1) {
        REP(j, n) {
            REP(j0, n) {
                if (a[j0] <= t[i-1] && t[i-1] <= b[j0] && a[j] <= t[i] && t[i] <= b[j]) {
                    chmax(dp[i][j], dp[i-1][j0] + abs(c[j] - c[j0]));
                }
            }
        }
    }

    cout << *max_element(ALL_OF(dp[d-1])) << endl;
    
}


Measured memory_bytes: 3284
import sys
sys.setrecursionlimit(1000000)

N = int(input())
X = input()
pc = X.count('1')


if pc == 0:
    print(*[1]*N, sep='\n')
    exit()
elif pc == 1:
    if int(X, 2) == 1:
        for i in range(N-1):
            print(2)
        print(0)
        exit()
    else:
        for i in range(N):
            if i == N-1:
                print(2)
            elif X[i] == '0':
                print(1)
            else:
                print(0)
        exit()

mod_plus_1, mod_minus_1 = 0, 0
for i in range(N):
    mod_plus_1 = (mod_plus_1*2+int(X[i])) % (pc+1)
    mod_minus_1 = (mod_minus_1*2+int(X[i])) % (pc-1)


def f(x):
    if x == 0:
        return 0
    else:
        return f(x % bin(x).count('1'))+1


mods_p1, mods_m1 = [1 % (pc+1)], [1 % (pc-1)]
for i in range(N-1):
    mods_p1.append(mods_p1[-1]*2 % (pc+1))
    mods_m1.append(mods_m1[-1]*2 % (pc-1))
mods_p1 = mods_p1[::-1]
mods_m1 = mods_m1[::-1]


for i in range(N):
    if X[i] == '0':
        x = mod_plus_1 + mods_p1[i]
        x %= (pc+1)
    else:
        x = mod_minus_1 - mods_m1[i]
        x %= (pc-1)

    if x == 0:
        print(1)
    else:
        print(f(x)+1)


Measured memory_bytes: 105352
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int a = sc.nextInt();
//    System.out.println(" integer is " + N);
    int b = sc.nextInt();
    int productOfAb = a*b;
    if(productOfAb %2 ==0){
      System.out.print("Even");
    }else {
      System.out.print("Odd");
    }

  };

}


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

using namespace std;

long long n, m, f[100010][30];
long long res = 0;
string s, t;

void Process()
{
    memset(f, -1, sizeof(f));

    for (int i=n-1; i>=0; i--)
    {
        for (int j=1; j<=26; j++)
            f[i][j] = f[i+1][j];

        f[i][(int) s[i+1] - 96] = i + 1;
    }

    int pos = 0;
    for (int i=1; i<=m; i++)
    {
        //cout << pos << " " << res << endl;
        if (f[pos][(int) t[i] - 96] != -1)
            pos = f[pos][(int) t[i] - 96];
                else
                {
                    if (pos == 0)
                    {
                        res = -1;   break;
                    }
                        else
                        {
                            res += n;   pos = 0;    i--;
                        }
                }
    }

    if (res < 0) cout << res;
        else cout << res + pos;
}

void Input()
{
    ios_base::sync_with_stdio(0);   cin.tie(0);

    cin >> s >> t;  n = s.length();  m = t.length();
    s = ' ' + s;    t = ' ' + t;
}

int main()
{
    Input();
    Process();
    return 0;
}


Measured memory_bytes: 24044
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value


void solve() {

	int N;
	cin >> N;

	cout << 180 * (N - 2) << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
vector<int> v[1000000];
int main()
{	int n; cin>>n;
	for(rint QAQ=1;QAQ*(QAQ+1)/2<=n;QAQ++)
	if(QAQ*(QAQ+1)/2==n)
	{	printf("Yes\n"); printf("%d\n",QAQ+1);
		int cnt=0;
		for(rint i=1;i<=QAQ+1;i++)
		for(rint j=i+1;j<=QAQ+1;j++) v[i].push_back(++cnt),v[j].push_back(cnt);
		for(rint i=1;i<=QAQ+1;i++)
		{	printf("%d ",v[i].size());
			for(auto x:v[i]) printf("%d ",x); printf("\n");
		}
		return 0;
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 25728
def chmin(a,b):
    if a>b:
        dp[i]=b
    else:
        dp[i]=a
        return True
    return False

N=int(input())
h=list(map(int,input().split()))
cost=0
dp=[1000000000]*N
dp[0]=0
# print(dp)
i=1
while i < N :
    chmin( dp[i],dp[i-1]+abs(h[i]-h[i-1]) )
    if i > 1 :
        chmin( dp[i],dp[i-2]+abs(h[i]-h[i-2]))
    i+=1

print(dp[N-1])

Measured memory_bytes: 13924
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
char s[N];int f[N],g[2*N];
int main(){
	int n,k,c;scanf("%d%d%d%s",&n,&k,&c,s+1);
	for(int i=1;i<=n;i++){
		if(s[i]=='o')f[i]=f[max(0,i-c-1)]+1;
		f[i]=max(f[i-1],f[i]);
	}
	for(int i=n;i>=1;i--){
		if(s[i]=='o')g[i]=g[i+c+1]+1;
		g[i]=max(g[i],g[i+1]);
	}
	if(f[n]>k)return 0;
	for(int i=1;i<=n;i++){
		if(s[i]=='o'&&f[i-1]<f[i]&&g[i+1]<g[i])printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

vector<int> z_algorithm(const string& s){
    vector<int> prefix((int)s.length());

    for(int i = 1, j = 0; i < (int)s.length(); ++i){
        if(i + prefix[i - j] < j + prefix[j]){
            prefix[i] = prefix[i - j];
        }
        else{
            int k = max(0, j + prefix[j] - i);
            while(i + k < (int)s.length() && s[k] == s[i + k]){
                ++k;
            }
            prefix[i] = k;
            j = i;
        }
    }
    prefix[0] = (int)s.length();
    
    return prefix;
}

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

    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        vector<int> table = z_algorithm(s.substr(i, n - i));
        int sz = table.size();
        int res = 0;
        for(int j = 1; j < sz; ++j){
            if(j >= table[j])   chmax(res, table[j]);
        }
        chmax(ans, res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define MOD 998244353LL
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a,
             const pair<int,int> &b)
{
    if(a.ff == b.ff) {
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff);
}

bool prime[1000001];
void SieveOfEratosthenes(int n) 
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.

    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
int n, k;
int h[100005] = {0};
int a[100005] = {0};
int prec[100005] = {0};
int32_t main()
{
    IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    cin >> n >> k;
    rep(i, 0, n){
    	cin >> h[i];
    }
    sort(h, h+n);
    rep(i, 0, n-1){
    	a[i] = h[i+1] - h[i];
    }
    int ans = inf;
    rep(i, 0, n-k+1){
    	ans = min(h[i+k-1] - h[i], ans);
    }
    cout << ans;
}

Measured memory_bytes: 1792
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))

a = 0
b = 0
c = 0
for i in range(N):
    if P[i]<=A:
        a += 1
    elif P[i]<=B:
        b += 1
    elif B<P[i]:
        c += 1

print(min(a,b,c))

Measured memory_bytes: 61896
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

const int mod = 998244353;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint dp[3010][10000];
int main() {
  int n,s;
  cin >> n >> s;
  vi a(n);
  rep(i,n)cin >> a[i];
  dp[0][0] = 1;
  rep(i,n){
    rep(j,s+1){
      dp[i+1][j]+=dp[i][j]*2;
      dp[i+1][j+a[i]]+=dp[i][j];
    }
  }
  cout<<dp[n][s].x<<endl;
  return 0;
}

Measured memory_bytes: 238716
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int x[5];
    for(int i=0; i<5; i++){
        cin >> x[i];
        if(x[i] == 0){
            cout << i+1 << ln;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>

int main() {
	int A, B, K, i;
	std::cin >> A >> B >> K;
	i = 1;
	while (i <= K)
	{
		if (A % 2 > 0)A--;
		B = B + (A / 2);
		A = A / 2;
		i++;
		if (i > K) break;
		if (B % 2 > 0)B--;
		A = A + (B / 2);
		B = B / 2;
		i++;
	}
	std::cout << A << " " << B << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main
{
  private static ArrayList<Integer> primeNumberList = new ArrayList<>();

  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    ArrayList<Integer> inputList = new ArrayList<>(50);

    while (input.ready())
    {
      int inputNum = Integer.valueOf(input.readLine());
      if (inputNum == 0)
      {
        break;
      }
      inputList.add(inputNum);
    }

    int max = 0;
    for (Integer each : inputList)
    {
      if (max < each)
        max = each;
    }

    setPrimeNumberList(max);

    for (int num : inputList)
    {
      System.out.println(sumOfPrimeNumbers(num));
    }
  }

  private static int sumOfPrimeNumbers(int limit)
  {
    int ans = 0;
    int count = 0;
    for (int each : primeNumberList)
    {
      if (limit > count)
      {
        ans += each;
      }
      count++;
    }
    return ans;
  }

  private static void setPrimeNumberList(int listSize)
  {
    int num = 3;
    primeNumberList.add(2);
    while (primeNumberList.size() < listSize)
    {
      if (isPrimeNumber(num))
      {
        primeNumberList.add(num);
      }
      num++;
    }
  }

  private static boolean isPrimeNumber(int number)
  {
    final int limit = (int) Math.sqrt(number);
    for (int each : primeNumberList)
    {
      if (number % each == 0)
      {
        return false;
      }
      if (each > limit)
      {
        break;
      }
    }
    return true;
  }
}

Measured memory_bytes: 29628
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"basic.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
#endif

// int as[510 * 510];
vector<int> as(510 * 510);
// vector<int> as(10 * 10);
int main(){
    int n; cin >> n;
    vector<int> xs(n), xs2;
    for(int i=0;i<n;i++){
        cin >> xs[i];
        as[xs[i] - 1] = i + 1;
    }
    xs2 = xs;
    sort(xs2.begin(), xs2.end());
    vector<int> spaces;
    int prev = 0;
    for(int i=0;i<n;i++){
        spaces.push_back(xs2[i] - prev - 1);
        prev = xs2[i];
    }
    prints("as", as);
    prints("spaces", spaces);
    int acc = 0, idx = 0, idx2 = -1;
    queue<int> q;
    for(int i=0;i<n;i++){
        idx2 += spaces[i] + 1;
        int num = as[idx2];//as[xs[i] - 1];//i + 1;//xs[i];
        acc += spaces[i];
        acc -= num - 1;
        prints("acc", acc, "num", num, "idx2", idx2);
        if(acc < 0){
            cout << "No" << '\n';
            return 0;
        }
        for(int rem = num - 1; rem; rem--){
            while(as[idx]){ idx++; }
            as[idx] = num;
        }
        for(int rem = n - num, idx3 = idx2 + 1; rem; rem--){
            // while(as[idx3]){ idx3++; if(idx3 >= as.size()){ cout << "No" << '\n'; return 0; }}
            // as[idx3] = num;
            q.push(num);
        }
    }
    for(int i=0;i<n*n;i++){
        if(!as[i]){
            as[i] = q.front(); q.pop();
        }
    }
    for(int i=0;i<n*n;i++){
        if(!as[i]){
            cout << "No" << '\n';
            return 0;
        }
    }
    prints("as", as);
    vector<int> nums(n);
    for(int i=0;i<n*n;i++){
        nums[as[i] - 1]++;
        if(nums[as[i] - 1] == as[i]){
            prints(as[i], i + 1);
            // prints(i + 1, xs[as[i] - 1]);
            if(i + 1 != xs[as[i] - 1]){
                cout << "No" << '\n';
                return 0;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(nums[i] != n){
            cout << "No" << '\n';
            return 0;
        }
    }

    cout << "Yes" << '\n';
    for(int i=0;i<n * n;i++){
        cout << as[i] << (i == n * n - 1 ? '\n' : ' ');
    }
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

const int MAX = 3000;

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

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


ll com(int n, int k){
    if(n < k) return 0;
    if(n < 0 or k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main(){

    combinit();
    ll n, k;
    cin >> n >> k;
    for(int i = 1; i <= k; ++i){
        // if(i == 1 or i == k){
        //     cout << com(n-k+1, i) << endl;
        // }
        // else{
        //     cout << com(n-k+1, i)* << endl;
        // }
        cout << com(n-k+1, i)*com(k-1, k-i)%MOD << endl;
    }


    return 0;
}


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static int solve(int n, int c, int k, int[] ts) {
        int count = 0;
        int r = 0;
        int maxT = -1;
        for (int t : ts) {
            if (maxT == -1) {
                maxT = t + k;
            }

            if (maxT >= t && count < c) {
                count++;
            } else {
                r++;
                count = 1;
                maxT = t + k;
            }
        }
        if (count > 0) {
            r++;
        }
        return r;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int c = in.nextInt();
        int k = in.nextInt();
        int[] ts = new int[n];
        for (int i = 0; i < n; i++) {
            ts[i] = in.nextInt();
        }
        Arrays.sort(ts);
        System.out.println(solve(n, c, k, ts));
    }
}


Measured memory_bytes: 50360
#include<stdio.h>
#include<algorithm>
using namespace std;
char a[1008];
int main(){
  scanf("%s",a);
  sort(a,a+4);
  int s=0,t=-1;
  for(int i=0;i<4;i++){
    if(a[i]!=t)
        s++,t=a[i];
  }
  if(s==2)
    printf("Yes\n");
  else
    printf("No\n");
}


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

int a[100005];

int main()
{
	int n,tmp;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>tmp;
		a[tmp]=i;
	}
	cout<<a[1];
	for(int i=2;i<=n;i++)
		cout<<' '<<a[i];
	return 0;
}

Measured memory_bytes: 1152
/*
 *
 *    I am o0o0oo00.
 *
 */
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll          long long
#define p7          1000000007
#define p9          998244353
#define pb          push_back
#define ff          first
#define ss          second
#define vll         vector<ll>
#define pll         pair<ll,ll>
#define vpll        vector<pll>
#define mll         map<ll,ll>
#define test        ll T;cin>>T;while(T--)
#define ad(a,n)     vll a;a.resize(n);for(ll i=0;i<n;i++)cin>>a[i];
#define as(a,n)     for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define all(x)      x.begin(),x.end()

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

ll powm(ll x, ll y, ll m = p7) {
    x = x % m; ll res = 1; while (y)
    {if (y & 1)res = res * x; res %= m; y = y >> 1; x = x * x; x %= m;} return res;
}
ll modi(ll a, ll m = p7) {return powm(a, m - 2, m);}
void yesno(bool f) {f ? cout << "First" << endl : cout << "Second" << endl;}

ll dp[100001] = {0};
ll a[100] = {0};




void ss99()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}


int32_t main()
{
    ss99();
//    test
    {
        ll n, k; cin >> n >> k;
        for (ll i = 0; i < n; i++)
            cin >> a[i];
        for (ll i = 1; i <= k; i++)
        {
            for (ll j = 0; j < n; j++)
            {
                if (i < a[j])
                    break;
                else
                {
                    if (dp[i - a[j]] == 0)
                    {
                        dp[i] = 1;
                        break;
                    }
                }
            }
        }
        yesno(dp[k] == 1);
    }
    return 0;
}

Measured memory_bytes: 1024
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"

using namespace std;
const long long int MOD = 1000000007;

char letter[200000];
int s, e;

int a;

int main() {
	cin >> letter;
	s = -1;
	for (int i = 0; letter[i] != NULL; i++) {
		if (s == -1) {
			if (letter[i] == 'A')s = i;
		}
		if (letter[i] == 'Z')e = i;
	}
	cout << e - s + 1 << endl;
	return 0;
}



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


using namespace std;

int main(void){
	int n;

	cin >> n;


	vector<int> a(n), b(n), c(n);

	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	for (int i = 0; i < n; i++){
		cin >> b[i];
	}
	for (int i = 0; i < n; i++){
		cin >> c[i];
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());


	vector<int> ap(n, 0), bp(n, 0);

	for (int i = 0; i < n; i++){
		int l = 0, r = n - 1;
		while (l < r){
			int mid = (r + l)/2;
			if (b[mid] > a[i]){
				if (mid == 0){
					ap[i] = 0;
					break;
				}
				if (b[mid - 1] <= a[i]){
					ap[i] = mid;
					break;
				}
				else {
					r = mid;
				}
			}
			else {
				if (mid == n - 1){
					ap[i] = n;
					break;
				}
				if (b[mid + 1] <= a[i]){
					l = mid + 1;
				}
				else {
					ap[i] = mid + 1;
					break;
				}
			}
		}
		if (r == l){
			if (b[r] > a[i])
				ap[i] = r;
			else
				ap[i] = n;				
		}

		l = 0, r = n - 1;
		while (l < r){
			int mid = (r + l)/2;
			if (c[mid] > b[i]){
				if (mid == 0){
					bp[i] = 0;
					break;
				}
				if (c[mid - 1] <= b[i]){
					bp[i] = mid;
					break;
				}
				else {
					r = mid;
				}
			}
			else {
				if (mid == n - 1){
					bp[i] = n;
					break;
				}
				if (c[mid + 1] <= b[i]){
					l = mid + 1;
				}
				else {
					bp[i] = mid + 1;
					break;
				}
			}
		}
		if (r == l){
			if (c[r] > b[i])
				bp[i] = r;
			else
				bp[i] = n;				
		}
	}


	vector<unsigned long long> bpp(n, 0);
	bpp[n-1] = n - bp[n-1];
	for (int i = n - 2; i >= 0; i--){
		bpp[i] = bpp[i+1] + (n - bp[i]);
	}


	unsigned long long num = 0;

	for (int i = 0; i < n; i++){
		if (ap[i] != n)
			num += bpp[ap[i]];
	}

	cout << num << endl;

	return 0;
}	


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

const int N = 2e5 + 9;

vector<int>V[N];
int n, o, h[N], t, la[N], cnt, f[N], f2[N], p;
bool is[N], vis[N], in[N];

void Dfs (int x) {
	vis[x] = is[x] = 1;
	for (auto v : V[x]) {
		if (vis[v]) { if (is[v]) in[h[t = 1] = o = v] = 1; } else Dfs(v);
		if (o) break;
	}
	if (o) {
		if (x == o) o = -1;
		if (o != -1) in[h[++t] = x] = 1;
	}
	is[x] = 0;
}

int jj[N];

void Dfs2 (int x) {
	for (auto v : V[x]) if (!in[v]) Dfs2(v);
	++cnt; for (auto v : V[x]) if (!in[v]) la[f[v]] = cnt;
	while (la[f[x]] == cnt) ++f[x];
	if (in[x]) { f2[x] = f[x] + 1; while (la[f2[x]] == cnt) ++f2[x]; }
}

int main () {
	scanf("%d", &n);
	for (int i = 1, j; i <= n; ++i) scanf("%d", &j), V[j].emplace_back(i);
	for (int i = 1; i <= n && o == 0; ++i) if (!vis[i]) Dfs(i);
	for (int i = 1; i <= t; ++i) Dfs2(h[i]);
	p = f[h[1]];
	for (int i = 2; i <= t; ++i) p = f[h[i]] == p ? f2[h[i]] : f[h[i]];
	p = f[h[1]] == p ? f2[h[1]] : f[h[1]];
	if (p == f[h[1]]) return puts("POSSIBLE"), 0;
	p = f2[h[1]];
	for (int i = 2; i <= t; ++i) p = f[h[i]] == p ? f2[h[i]] : f[h[i]];
	p = f[h[1]] == p ? f2[h[1]] : f[h[1]];
	if (p == f2[h[1]]) return puts("POSSIBLE"), 0;
	return puts("IMPOSSIBLE"), 0;
}

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

int main(){
  int N; cin >> N;
  vector<int> a(N);
  double suma=0;
  int ans =0;
  
  rep(i,N){
    cin >> a[i];
    suma += a[i];
  }
  
  suma /= N;
  
  rep(i,N){
    ans += (a[i]-round(suma))*(a[i]-round(suma));
  }
  
  cout << ans << endl;
}


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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  rep(i,n) {
    int l, r;
    cin >> l >> r;
    ans += (r-l+1);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=1;

int main()
{
    int n;
    scanf("%d",&n);
    int ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j*i<n;j++){
            ans++;
        }
    }
    printf("%d",ans);

}


Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const double Pi=acos(-1.0);
const int MAXN=1e6+5;
int n,m,t;
int v[MAXN];
char s[MAXN];
int main(){
    cin>>n;
    int ans=0;
    REP(i,1,n)cin>>v[i];
    REP(i,1,n){
        REP(j,i+1,n){
            REP(k,j+1,n){
                if(v[i]!=v[j]&&v[j]!=v[k]&&v[i]!=v[k]){
                    if(v[i]+v[j]>v[k]&&v[i]+v[k]>v[j]&&v[j]+v[k]>v[i])ans++;
                }
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3192