akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

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

  if(a+b==15){
    P("+");
  }else if(a*b==15) {
    P("*");
  }else{
    P("x");
  }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

unsigned nChoosek( unsigned n, unsigned k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}

int main( int argc, char *argv[] ) {
	int n;
	cin >> n;
	vector<int> divisor(100, 0);
	for ( int i = 2 ; i < n + 1 ; i++ ){
		int c = i;
		for ( int j = 2 ; j < c + 1 && c != 1; j++ ){
			while ( c % j == 0 ){
				divisor[j]++;
				c /= j;
			}
		}
	}
	vector<int> prim_div;
	for ( auto i : divisor ) {
		if ( i != 0 )
			prim_div.push_back(i);
	}
	int sev = 0;
	while ( sev < prim_div.size() && prim_div[sev] >= 74 )
		sev++;
	int twe = 0;
	while ( twe < prim_div.size() && prim_div[twe] >= 24 )
		twe++;
	int fif = 0;
	while ( fif < prim_div.size() && prim_div[fif] >= 14 )
		fif++;
	int fiv = 0;
	while ( fiv < prim_div.size() && prim_div[fiv] >= 4 )
		fiv++;
	int thr = 0;
	while ( thr < prim_div.size() && prim_div[thr] >= 2 )
		thr++;

	int res = nChoosek(fiv, 2) * nChoosek(thr - 2, 1);
	res += nChoosek(fif, 1) * nChoosek(fiv - 1, 1);
	res += nChoosek(twe, 1) * nChoosek(thr - 1, 1);
	res += nChoosek(sev, 1);

	cout << res << "\n";
	return 0;
}


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

int main() {
  vector<bool> furui(5001,true);
  int j;
  for (int i=2; i<100; i++) {
    j = 2;
    while (i * j <= 5000) {
      furui[i*j] = false;
      j++;
    }
  }
  
  vector<long long> prime(500);
  long long now = 500;
    
  for (int i=0; i<500; i++) {
    while (!furui[now]) {
      now++;
    }
    prime[i] = now;
    now++;
  }
  
  vector<vector<long long>> ans(500,vector<long long>(500,0));
  
  for (int i=0; i<500; i++) {
    for (int j=0; j<500; j++) {
      if ((i+j)%2 == 1) {
        ans[i][j] = prime[(i-j+499)/2];
        ans[i][j] *= ((i+j+1)/2);
      }
    }
  }
  
  ans[0][0] = ans[0][1] * ans[1][0] + 1;
  ans[499][499] = ans[499][498] * ans[498][499] + 1;
  
  for (int i=0; i<500; i++) {
    for (int j=0; j<500; j++) {
      if (ans[i][j] == 0) {
        if (i == 0 || i == 499) {
          ans[i][j] = ans[i][j-1] * ans[i][j+1] + 1;
        }
        else {
          ans[i][j] = ans[i+1][j] * ans[i-1][j] + 1;
        }
      }
    }
  }
  
  
  int N;
  cin >> N;
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      cout << ans[i][j];
      if (j != N-1) {
        cout << " ";
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 4608
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <bitset>
#include <random>
#include <stack>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <ctime>

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define sc second
#define fs first
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template<class T> T sqr(T x) { return x*x; }
ld pi = 3.1415926535897932384626433832795;
ll mod = 1e9 + 7;
const int N = 2e5 + 10;

typedef vector<vector<ll> > mtrx;

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



int main() {
	int n, k, ost2 = 0, ost4 = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a % 4 == 0)
			ost4 += 1;
		else if (a % 2 == 0)
			ost2 += 1;
	}
	bool ok = 0;
	if (ost4)
		if (ost4 * 2 + 1 >= n) ok = 1;
	if (ost4)
		if (ost4 * 2 + ost2 >= n && ost2 > 1) ok = 1;
	if (ost2 == n) ok = 1;
	if (ok)
		cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int a,b,t;
    cin >> a >> b >> t;
    cout << (t/a)*b << endl;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> vec(n);
    for(int i=0;i<n;i++)
        cin >> vec[i];
    int minv = vec[0];
    int ret = -1e9;
    for(int i=1;i<n;i++){
        ret = max(vec[i] - minv,ret);
        minv = min(vec[i],minv);
    }
    cout << ret << endl;
}



Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define OUT(x) cout << (x) << endl;
#define ALL(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<(int)(n); ++i)
int dx[] = {0,1,0,-1};
int dy[] = {-1,0,1,0};

const int MAX_X=50, 
          MAX_Y=50;
const ll INF = 10e9;

string A[100];
string B[100];
int N,M;

int main() {
    int N; cin >> N;
    string S; cin >> S;
    string ans = S;
    for(int i=0; i<S.length(); i++){
        int s = S[i] - 'A';
        ans[i] = (s + N) % 26 + 'A';
    }
    cout << ans << endl;
}

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

#define pb push_back
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define beg begin()
#define en end()
#define sz size()
#define mem(a,b) memset(a,b,sizeof a)

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

int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	if(n<105){
		cout<<"0";
		cout<<endl;
		return 0;
	}
	if(n<135){
		cout<<"1";
		cout<<endl;
		return 0;
	}
	if(n<165){
		cout<<"2";
		cout<<endl;
		return 0;
	}
	if(n<189){
		cout<<"3";
		cout<<endl;
		return 0;
	}
	if(n<195){
		cout<<"4";
		cout<<endl;
		return 0;
	}
	if(n<201){
		cout<<"5";
		cout<<endl;
		return 0;
	}
	
	return 0;
}


Measured memory_bytes: 384
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

t = int(readline())

def get_base(x,basis):
    for b in basis:
        x = min(x,x^b)
    return x

for _ in range(t):
    n = int(readline())
    a = list(map(int,readline().split()))
    s = readline().strip()

    basis = []
    for si,ai in zip(s[::-1], a[::-1]):
        x = get_base(ai,basis)
        if(si=='0')&(x>0):
            basis.append(x)
        elif(si=='1')&(x>0):
            print(1)
            break
    else:
        print(0)

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

int main()
{
	int N;
	cin >> N;
	vector <string> s(N);
	for(int i=0; i<N; i++){
		cin >> s[i];
	}
	int M;
	cin >> M;
	vector <string> t(M);
	for(int i=0; i<M; i++){
		cin >> t[i];
	}
	int cnt[110] = {0};
	for(int i=0; i<N; i++){
		for(int k=0; k<N; k++){
			if(s[i] == s[k]) cnt[i]++;
		}
		for(int j=0; j<M; j++){
			if(s[i] == t[j]) cnt[i]--;
		}
	}
	int ans = cnt[0];
	for(int i=0; i<N; i++){
		ans = max(ans,cnt[i]);
	}
	if(ans < 0) ans = 0;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;
/* c++11
#include <tuple>
using std::tuple; 
using std::make_tuple;
using std::get; // tuple std::get<NUM>(t); (0 <= NUM <= 2)
 */

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

VI Sieve_of_Eratosthenes(int number) {
    VI prime(number + 1, 0);    
    prime[1] = 1;
    for (int i = 2; i <= number; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j <= number; j += i) {
                prime[j]  = 1; 
            }
        }
    }
    return prime;
}

int main(void) {
    int number = 1299709;
    VI prime = Sieve_of_Eratosthenes(number);
    int p;
    while (1) {
        cin >> p;
        if (p == 0) {
            break;
        }
        int left;
        int right;
        if (prime[p] == 0) {
            cout << 0 << endl;
            continue;
        }
        bool left_det = false;
        bool right_det = false;
        int width = 0;
        while (!(left_det && right_det)) {
            width++; 
            if (prime[p - width] == 0 && !left_det) {
                left = p - width;
                left_det = true;
            }
            if (prime[p + width] == 0 && !right_det) {
                right = p + width;
                right_det = true;
            }
        }
        cout << right - left << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
	long long n, a, b;
	scanf("%lld %lld %lld", &n, &a, &b);
	long long ans = a * (n / (a + b));
	if (n % (a + b) > 0) {
		ans += min(a , n % (a + b));
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+10 , OO = 0x3f3f3f3f ;
//const int mod = 1000000007;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
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
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

int v[N] , w[N] , n , k;
ll dp[105][N];

ll solve(int idx , int rem){
	
	if(idx == n) return 0;
	ll& ret = dp[idx][rem];
	if(~ret) return ret;
	ll choice1 = solve(idx+1 , rem); // leave
	ll choice2 = 0;
	if(rem >= w[idx])
		choice2 = solve(idx+1 , rem-w[idx]) + v[idx];
	return ret = max(choice1 , choice2);
}


int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	cin >> n >> k;
	for(int i = 0 ; i < n ; ++i)
		cin >> w[i] >> v[i];
	
	clr(dp , -1);
	cout << solve(0 , k) << "\n";


    return 0;
}

Measured memory_bytes: 82560
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
import math
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

def main():
  a, b, c = map(int, input().split())
  d = c - a - b
  if d>0 and 4*a*b<d**2:
    print('Yes')
  else:
    print('No')
  

if __name__ == '__main__':
  main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int R,G,B,N,res=0;cin>>R>>G>>B>>N;
    for (int i = 0; i < N/R+1; i++) {
        for (int j = 0; j < N/G+1; j++) {
            if((N-i*R-j*G)>=0 and (N-i*R-j*G)%B==0)res++;
        }
    }
    cout<<res;
}


Measured memory_bytes: 256
/*
 * FileName:     bit_flag_sample
 * CreatedDate:  2020-07-27 01:27:23 +0900
 * LastModified: 2020-07-27 20:23:47 +0900
 */

#include <stdio.h>

int main(void){
    unsigned long long int bit = 0;
    int q;scanf("%d", &q);
    for(int i=0; i<q; i++){
        int command;scanf("%d", &command);
        if( 0<=command && command<=3 ){
            int t;scanf("%d", &t);
            if( command==0 ){
                if(bit>>t&1UL)printf("1\n");
                else printf("0\n");
            }
            else if( command==1 ){
                bit |= 1UL<<t;
            }
            else if( command==2 ){
                bit &= ~(1UL<<t);
            }
            else{
                bit ^= (1UL<<t);
            }
        }
        else{
            if( command==4 ){
                printf("%d\n", !(bit+1));
            }
            else if( command==5 ){
                if( bit==0 ){
                    printf("0\n");
                }
                else{
                    printf("1\n");
                }
            }
            else if( command==6 ){
                printf("%d\n", bit==0);
            }
            else if( command==7 ){
                printf("%d\n", __builtin_popcountll(bit));
            }
            else{
                printf("%llu\n", bit);
            }
        }
//        printf("%lld\n", bit);
    }
    return 0;
}



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

int main() {
	int n;
	while (cin >> n, n) {
		int m[17][17] = {};
		m[n/2+1][n/2] = 1;
		int px = n/2+1;
		int py = n /2;
		for (int i = 2;i <= n*n;i++) {
			px++;
			py++;
			if (px >= n)px -= n;
			if (py >= n)py -= n;
			if (m[px][py] != 0) {
				px++;
				py--;
				if (py < 0)py += n;
				if (px >= n)px -= n;
			}
			m[px][py] = i;
		}
		for (int i = 0;i < n;i++) {
			for (int j = 0;j < n;j++) {
				printf("%4d", m[i][j]);
				if (j == n - 1)cout << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define INF 1e+10
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;

int a[200000],n,m;
ll dist[200000];

int main(){
  cin>>n>>m;
  for(int i=1;i<=n;i++) cin>>a[i];
  for(int i=0;i<=n+1;i++) dist[i]=INF;
  priority_queue < P, vector< P >, greater < P > > Q;
  for(int i=1;i<=n;i++) if(a[i]>a[i-1] && a[i]>a[i+1]) Q.push(P(0,i));
  while(!Q.empty()){
    ll cost = Q.top().f,p=Q.top().second;
    Q.pop();
    cost += m-a[p];
    dist[p]=cost;
    if(p-1>0 && a[p]>a[p-1]) Q.push(P(cost,p-1));
    if(p+1<=n && a[p]>a[p+1]) Q.push(P(cost,p+1));
  }
  ll ans=-1;
  for(int i=1;i<=n;i++) ans = max(ans,dist[i]);
  cout<<ans<<endl;

  return 0;
}

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

k = int(input())

ans = 0

while True:
    if b <= a:
        b *= 2
        ans+=1
    elif c <= b:
        c *= 2
        ans += 1
    if a < b and b < c:
        break
if ans > k:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 8968
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int N,Q;
vector<vector<Int>> G(200010);
vector<Int> cost(200010);
vector<bool> visited(200010,false);

void dfs(int v,int pv){
    visited[v] = true;
    if(v!=0) cost[v] += cost[pv];
    for(auto nv: G[v]){
        if(visited[nv]==false) dfs(nv,v);
    }
}

int main(){
    cin >> N >> Q;
    rep(i,N-1){
        int a,b;cin >> a >> b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    rep(i,Q){
        int p,x;cin >> p >> x;
        p--;
        cost[p]+=x;
    }
    dfs(0,0);
    rep(i,N-1) cout << cost[i] << " ";
    cout << cost[N-1] << endl;
}

Measured memory_bytes: 24320
#include<iostream>
#include<vector>
#include<algorithm>
#include<sstream>
using namespace std;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main()
{
  int n;
  cin>>n;
  vector<int> data;
  for(int i=0;i<n;i++)
    {
      int s;
      cin>>s;
      data.insert(lower_bound(data.begin(),data.end(),s),s);
      if(data.size()>=10)
      	data.resize(10);
    }
  vector<int> ans;
  for(int i=0;i<data.size();i++)
    for(int j=i+1;j<data.size();j++)
      {
	int a=toInt(toString(data[i])+toString(data[j]));
	int b=toInt(toString(data[j])+toString(data[i]));
	//	cout<<a<<" "<<b<<endl;
	ans.push_back(a);
	ans.push_back(b);
      }
  sort(ans.begin(),ans.end());
  //  cout<<ans[0]<<endl;
  // cout<<ans[1]<<endl;
  cout<<ans[2]<<endl;

}

Measured memory_bytes: 1256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sn = new Scanner(System.in);
    
    int A = sn.nextInt();
    int B = sn.nextInt();
    int C = sn.nextInt();
    
    if(( A == B && A != C )
       || ( A == C && A != B )
       || ( B == C && B != A )) {
      System.out.print("Yes");
    } else {
      System.out.print("No");
    }
  }
}


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

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

// Data structures.
struct Point {
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
    Point(const Point& p) : x(p.x), y(p.y) {}

    Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
    Point operator*(double k) const { return Point(k * x, k * y); }
    Point operator/(double k) const { return Point(x / k, y / k); }

    bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; }
    bool operator==(const Point& p) const { return fabs(x - p.x) < 1e-10 && fabs(y - p.y) < 1e-10; }

    static double norm(const Point& p) { return sqrt(p.x * p.x + p.y * p.y); }
    static double dot(const Point& p1, const Point& p2) { return p1.x * p2.x + p1.y * p2.y; }
    static double cross(const Point& p1, const Point& p2) { return p1.x * p2.y - p1.y * p2.x; }
};

struct Segment {
    Point s, t;
};

int ccw(const Point& p1, const Point& p2, const Point& p) {
    double cr = Point::cross(p2 - p1, p - p1);
    if (cr > 0) return 1;
    if (cr < 0) return 2;
    if (Point::dot(p2 - p1, p - p1) < 0) { return 3; }
    if (Point::dot(p - p2, p1 - p2) < 0) { return 4; }
    return 5;
}

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

    Point p1, p2;
    cin >> p1.x >> p1.y >> p2.x >> p2.y;

    int q;
    cin >> q;

    rep(i, 0, q) {
        Point p;
        cin >> p.x >> p.y;
        int ans = ccw(p1, p2, p);
        string s;
        if (ans == 1) {
            s = "COUNTER_CLOCKWISE";
        } else if (ans == 2) {
            s = "CLOCKWISE";
        } else if (ans == 3) {
            s = "ONLINE_BACK";
        } else if (ans == 4) {
            s = "ONLINE_FRONT";
        } else {
            s = "ON_SEGMENT";
        }
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 3260
import java.util.Scanner;

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

		String s = sc.next();
		String p = sc.next();

		s += s;
		if (s.indexOf(p) != -1)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}



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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int A = input[0];
            int B = input[1];
            int C = input[2];
            int D = input[3];

            bool isTakahashi = true;
            while (true)
            {
                if (isTakahashi)
                {
                    C -= B;
                }
                else
                {
                    A -= D;
                }

                isTakahashi = !isTakahashi;

                if (C <= 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }

                if (A <= 0)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 28288
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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;
}

using Graph = vector<vector<int>>;

ll gcd(int x, int y)
{
	return y==0 ? x:gcd(y,x % y);
}

typedef struct{
    int x;
    int y;
} point;

int main() {
    int n;
    cin>>n;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j==n){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

int main() {
    int a[4];
    rep(i, 4) cin >> a[i];
    sort(a, a + 4);
    if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int n;
int g[500][500];
void solve(int bgn, int end, int k) {
	if (bgn == end)return;
	int h = (bgn + end) / 2;
	h++;
	for (int i = bgn; i < h; i++) {
		for (int j = h; j <= end; j++) {
			g[i][j] = k;
		}
	}
	solve(bgn, h - 1, k + 1);
	solve(h, end, k + 1);
	return;
}
int main() {
	scanf("%d", &n);
	solve(0, n - 1, 1);
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n - 1; j++) {
			printf("%d ", g[i][j]);
		}
		printf("%d\n", g[i][n - 1]);
	}
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

//0-index ?????????????????°?????????(????????´??°or?????? , ????°????or?????§???or???) verified AOJ DSL_2,DSL_3
template<class T>
class segtree{
private:
    vector<T> dat;
    int _size;  //the number of leaves
    T _init;
    
public:
    segtree(int __size=0 , T init=numeric_limits<T>::max() ):_size(__size) , _init(init){
        if(__size==0)return ;
        int x=1;
        while(x<_size)x*=2;
        _size = x;
        dat.resize(_size*2);
    }
    
    void init(vector<T> v){
        for(int i=_size;i<_size+v.size();i++) dat[i] = v[i-_size];
        for(int i=_size-1;i>=1;i--)dat[i] = min(dat[i*2],dat[i*2+1]); //minimum
        //for(int i=_size-1;i>=1;i--)dat[i] = max(dat[i*2],dat[i*2+1]); //maximum
        //for(int i=_size-1;i>=1;i--)dat[i] = dat[i*2]+dat[i*2+1];      //sum
    }
    
    void update(int m,T x){
        int i = m+_size;
        //dat[i] += x;    //addition
        dat[i] = x;     //initialize
        for(; i!=1; i/=2){
            dat[i/2] = min(dat[i],dat[i^1]);    //minimum
            //dat[i/2] = max(dat[i],dat[i^1]);    //maximum
            //dat[i/2] = dat[i]+dat[i^1];         //sum
        }
    }
    
    // call find(s,t)
    T find(int s,int t,int num=1,int l=0,int r=-1){
        if(r==-1)r=_size; //I couldn't "int b=_size".
        if(r<=s||t<=l)return _init;
        if(s<=l&&r<=t)return dat[num];
        return min( find(s,t,num*2,l,(l+r)/2) , find(s,t,num*2+1,(l+r)/2,r) );    //minimum
        //return max( find(s,t,num*2,l,(l+r)/2) , find(s,t,num*2+1,(l+r)/2,r) );    //maximum
        //return find(s,t,num*2,l,(l+r)/2) + find(s,t,num*2+1,(l+r)/2,r);           //sum
    }
    int size(){return _size;}
};


int main(){
    int n,q;
    cin>>n>>q;
    segtree<int> st(n);
    rep(i,n)st.update((int)i,(1LL<<31)-1);
    rep(i,q){
        int type;
        cin>>type;
        
        if(type==0){
            int j,x;
            cin>>j>>x;
            st.update(j,x);
        }else{
            int s,t;
            cin>>s>>t;
            cout<<st.find(s,t+1)<<endl;
        }
    }
}

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

// LOOP
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
//

// DEBUG
#define format(x) << #x << ": " << (x)
#define com << ", "
#define ndl << "\n"
#define debug1(x) cerr format(x) ndl;
#define debug2(x, y) cerr format(x) com format(y) ndl;
#define debug3(x, y, z) cerr format(x) com format(y) com format(z) ndl;
void debug_out() { cerr << "\n"; }
template <typename H, typename... T> 
void debug_out(H h, T... t) { cerr << " " << (h); debug_out(t...); }
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
// 

void solve() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  char x = 'L', y = 'R';
  if (s[0] == x) swap(x, y);
  FOR(i, 1, n) {
    if (s[i] == x) {
      FOR(j, i, n) {
        if (s[j] == y) break;
        s[j] = y;
      }
      k--;
      if (k == 0) break;
    }
  }
  int res = n - 1;
  FOR(i, 1, n) {
    if (s[i] != s[i - 1]) res--;
  }
  cout << res << "\n";
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie();
  //auto beginProgram = chrono::steady_clock::now();
  {
    solve();
  }
  //auto endProgram = chrono::steady_clock::now();

  return 0;
}




Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#define int long long
#define ll long long
using namespace std;
signed main() {
	int n;
	cin >> n;
	if (n % 10 == n / 100)cout << "Yes" << endl;
	else cout << "No" << endl;
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
#define STR_GREATER "GREATER"
#define STR_LESS "LESS"
#define STR_EQUAL "EQUAL"

void comparison(char* A, char* B){
  int index = 0;
  int lenA = strlen(A);
  int lenB = strlen(B);

  while((index < lenA) && (index < lenB)){
    if(A[index] > B[index]){
      printf("%s\n", STR_GREATER);
      return;
    }
    else if(A[index] < B[index]){
      printf("%s\n", STR_LESS);
      return;
    }
    index++;
  }
  printf("%s\n", STR_EQUAL);
  return;
}

int main(int argc, char const *argv[]) {
  char* A;
  char* B;
  int valA, valB;
  int lenA, lenB;
  int index = 0;

  A = (char*)malloc(sizeof(char)*MAX);
  B = (char*)malloc(sizeof(char)*MAX);
  scanf("%s %s", A, B);
  lenA = strlen(A);
  lenB = strlen(B);

  if(lenA > lenB){
    printf("%s\n", STR_GREATER);
  }
  else if(lenA < lenB){
    printf("%s\n", STR_LESS);
  }
  else{
    comparison(A, B);
  }

  return 0;
}


Measured memory_bytes: 128
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};
use std::f64::consts;
fn main() {
   input! {
      a:f64,b:f64,mut h:f64,m:f64
   }
   h += m / 60.0;
   h *= 5.0;
   let dg = (h - m).abs() * 6.0;
   let rd = dg * consts::PI / 180.0;
   //dbg!(dg, rd);
   println!("{}", (a * a + b * b - 2.0 * a * b * rd.cos()).sqrt());
}


Measured memory_bytes: 3104
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#define ma make_pair
#define pu push_back
#define INF (1e9)
#define N 100
using namespace std;
typedef pair<int,int> P;
int dijkstra(int,int);
int n,m,a,b,w,ans;
bool visited[N];
vector<P> edge[N];
map<int,int> s;

int main(){
  while(1){
    cin>>n>>m;
    ans=INF;
    if(!n&&!m) break;
    for(int i=0;i<m;i++){
      cin>>a>>b>>w,edge[a-1].pu(P(b-1,w)),edge[b-1].pu(P(a-1,w));
      if(s.find(w)==s.end()) s.insert(ma(w,a-1));
    }
    for(map<int,int>::iterator i=s.begin();i!=s.end();i++){
      for(int j=0;j<N;j++) visited[j]=false;
      int r=dijkstra((*i).first,(*i).second);
      ans=min(ans,r);
    }
    if(ans!=INF) cout<<ans<<endl;
    else cout<<-1<<endl;
    for(int i=0;i<N;i++) edge[i].clear();
  }
  return 0;
}

int dijkstra(int base,int sn){
  int maxv,cnt=0;;
  priority_queue<P,vector<P>,greater<P> > q;
  maxv=base;
  q.push(P(base,sn));
  while(!q.empty()){
    P t=q.top(); q.pop();
    int x=t.second;
    if(visited[x]) continue;
    visited[x]=true;
    cnt++;
    maxv=max(maxv,t.first);
    for(int i=0;i<edge[x].size();i++)
      if(edge[x][i].second>=base)
	q.push(P(edge[x][i].second,edge[x][i].first));
  }
  if(cnt==n) return maxv-base;
  return INF;
}

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

enum Order {DEC, EQL, INC};
int memo[501][10][500][3][2];

const vector<int> vec(const string& s) {
  vector<int> res;
  for(const auto& c: s) res.insert(begin(res), c - '0');
  return res;
}

bool zigzag(const string& s, int M) {
  auto n = vec(s);
  for(int i = 1; i < n.size(); ++i) if(n[i - 1] == n[i]) return false;
  for(int i = 2; i < n.size(); ++i) {
    if(n[i - 2] < n[i - 1] && n[i - 1] < n[i]) return false;
    if(n[i - 2] > n[i - 1] && n[i - 1] > n[i]) return false;
  }
  int r = 0;
  int m = 1 % M;
  for(const auto& i: n) {
    r = (r + i * m) % M;
    m = (10 * m) % M;
  }
  return !r;
}

// Return n * 10^d mod M.
int remain(int n, int d, int M) {
  static vector<int> base = {1};
  while(base.size() <= d) base.push_back((base.back() * 10) % M);
  return (n * base[d]) % M;
}

int rec(const vector<int>& n, int M, int d, int i, int r, int ord, int eql) {
  if(memo[d][i][r][ord][eql]) return memo[d][i][r][ord][eql];
  if(!d) return !r;
  int res = 0;
  if(eql) {
    if(ord == INC && i > n[d-1]) res += rec(n, M, d-1, n[d-1], (r + remain(n[d-1], d-1, M)) % M, DEC, 1);
    if(ord == DEC && i < n[d-1]) res += rec(n, M, d-1, n[d-1], (r + remain(n[d-1], d-1, M)) % M, INC, 1);
    for(int j = 0; j < n[d-1]; ++j) {
      if(ord == INC && i > j) res += rec(n, M, d-1, j, (r + remain(j, d-1, M)) % M, DEC, 0);
      if(ord == DEC && i < j) res += rec(n, M, d-1, j, (r + remain(j, d-1, M)) % M, INC, 0);
    }
  } else {
    if(ord == EQL) {
      if(d == 1) {
        for(int j = 0; j < 10; ++j) if(!(j % M)) ++res;
      } else {
        res += rec(n, M, d-1, 0, 0, EQL, 0);
        for(int j = 1; j < 10; ++j) {
          res += rec(n, M, d-1, j, remain(j, d-1, M), DEC, 0);
          res += rec(n, M, d-1, j, remain(j, d-1, M), INC, 0);
        }
      }
    } else {
      for(int j = 0; j < 10; ++j) {
        if(ord == INC && i > j) res += rec(n, M, d-1, j, (r + remain(j, d-1, M)) % M, DEC, 0);
        if(ord == DEC && i < j) res += rec(n, M, d-1, j, (r + remain(j, d-1, M)) % M, INC, 0);
      }
    }
  }
  return memo[d][i][r][ord][eql] = (res % 10000);
}

int count(const string& s, int M) {
  auto n = vec(s);
  int res = 0;
  for(int d = 0; d < n.size(); ++d) for(int i = 0; i < 10; ++i) for(int r = 0; r < M; ++r) for(int ord: {DEC, INC, EQL}) for(int eql: {0, 1}) memo[d][i][r][ord][eql] = 0;
  if(n.size() == 1) {
    for(int i = 0; i <= n.front(); ++i) res += !(i % M);
  } else {
    int d = n.size() - 1;
    res += rec(n, M, d, n[d], remain(n[d], d, M), INC, 1);
    res += rec(n, M, d, n[d], remain(n[d], d, M), DEC, 1);
    res += rec(n, M, d, 0, 0, EQL, 0);
    for(int i = 1; i < n[d]; ++i) {
      res += rec(n, M, d, i, remain(i, d, M), INC, 0);
      res += rec(n, M, d, i, remain(i, d, M), DEC, 0);
    }
  }
  return res % 10000;
}

int main() {
  string A, B;
  int M;
  cin >> A >> B >> M;
  cout << (count(B, M) - count(A, M) + (zigzag(A, M) ? 1 : 0) + 10000) % 10000 << endl;
}

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

int main(){
  string S = "";
  string T = "";
  int ans = 0;
  cin >> S >> T;
  for (int i=0; i<S.size(); i++){
    if (S[i] != T[i]){
      ans += 1;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3920
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int N, L;
char S[112][112];
char gununu[112];

int main()
{
	in >> N >> L;
	rep(i, N) { in >> S[i]; }

	for (int i = 0; i < N; ++i)
	{
		for (int j = i + 1; j < N; ++j)
		{
			if (strcmp(S[i], S[j]) > 0)
			{
				strcpy(gununu, S[i]);
				strcpy(S[i], S[j]);
				strcpy(S[j], gununu);
			}
		}
	}

	rep(i, N) { out << S[i]; }
	out << std::endl;
	return 0;
}

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

using namespace std;

// エラトステネスの篩
vector<bool> makeJudgementTable(int64_t number) {
    vector<bool> prime(number + 1, true);
    if (number >= 0) prime[0] = false;
    if (number >= 1) prime[1] = false;
    for (int64_t i = 2; i <= number; i++) {
        if (!prime[i]) continue;
        for (int64_t j = i * i; j <= number; j = j + i) {
            prime[j] = false;
        }
    }
    return prime;
}

int main() {
    vector<int64_t> N;

    while (true) {
        int tmp;
        cin >> tmp;
        if (tmp == 0) break;
        N.push_back(tmp);
    }

    const int64_t MAX_NUMER = 1299709;
    vector<bool> isPrimeNumbers = makeJudgementTable(1299709);

    // kが素数かどうか判断する
    // 素数の場合 -> 0
    // 素数でない場合 -> 前後の素数を求める -> 前後の素数の差を計算する

    vector<int64_t> primeGaps(N.size(), 0);

    for (int i = 0; i < N.size(); i++) {
        if (isPrimeNumbers.at(N.at(i))) {  // 素数の時
            primeGaps.at(i) = 0;
        } else {  // 素数ではない時

            int64_t previousPrimeNumber = 0;  // 前の素数
            for (int64_t j = N.at(i); 0 < j; j--) {
                if (isPrimeNumbers.at(j)) {
                    previousPrimeNumber = j;
                    break;
                }
            }
            int64_t followingPrimeNumber = 0;  // 後ろの素数
            for (int64_t j = N.at(i); j <= MAX_NUMER; j++) {
                if (isPrimeNumbers.at(j)) {
                    followingPrimeNumber = j;
                    break;
                }
            }
            primeGaps.at(i) = followingPrimeNumber - previousPrimeNumber;
        }
    }

    for (int64_t i = 0; i < primeGaps.size(); i++) {
        cout << primeGaps.at(i) << endl;
    }

    return 0;
}


Measured memory_bytes: 3160
#!/usr/bin/env python3

n = int(input())
b = list(map(int, input().split()))

ans = 0 
for i in range(n):
    if i==0:
        ans += b[0]
    elif i==n-1:
        ans += b[n-2]
    else:
        ans += min([b[i-1], b[i]])
print(ans)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl


#
void func() {
  LL N;
  cin >> N;
  LL M;
  cin >> M;
  LL L;
  cin >> L;
  const LL INF = 100010001000;


  vector<vector<LL>> D(N,vector<LL>(N,INF));
  REP(i, N) {
    D[i][i] = 0;
  }

  REP(i, M) {
    LL a;
    cin >> a;
    LL b;
    cin >> b;
    LL c;
    cin >> c;
    a--;
    b--;
    D[a][b] = c;
    D[b][a] = c;
  }
  
  REP(k, N) {
    REP(i, N) {
      REP(j, N) {
        if (D[i][j] > D[i][k] + D[k][j]) {
          D[i][j] = D[i][k] + D[k][j];
        }
      }
    }
  }
  //REP(k, N) {
  //  PRINTSP(D[k]);
  //}
  vector<vector<LL>> E(N, vector<LL>(N, INF));
  REP(i, N) {
    REP(j, N) {
      if (D[i][j] <= L) {
        E[i][j] = 1;
      }
    }
  }
  //REP(k, N) {
  //  PRINTSP(E[k]);
  //}
  REP(k, N) {
    REP(i, N) {
      REP(j, N) {
        if (E[i][j] > E[i][k] + E[k][j]) {
          E[i][j] = E[i][k] + E[k][j];
        }
      }
    }
  }
  //REP(k, N) {
  //  PRINTSP(E[k]);
  //}

  LL Q;
  cin >> Q;
  REP(q, Q) {
    LL s;
    cin >> s;
    LL t;
    cin >> t;
    s--;
    t--;
    LL l = E[s][t];
    if (l < INF) {
      cout << l-1 << endl;
    }
    else {
      cout << -1 << endl;

    }

  }

}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 1920
#include <bits/stdc++.h>  // ver2.1.4
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a.back()<<endl
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

int mypow(int x, int n, int m){  //  高速累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  
  int n,m,memo;
  cin >> n;
  
  Vi a(n),ans(n);
  
  rep(i,0,n){
    cin >> memo;
    ans[memo-1] = i+1;
  }
  
  
  Vout(ans);
  return 0;
}

Measured memory_bytes: 2432
/*
I just got lost in thought. It was unfamiliar territory.
- Steven Wright
*/

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <vector>
//#include <boost/math/common_factor.hpp>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 1000000000;
const int MAX = 100005;
const int MAX1 = 2007;
const int MAX2 = 4007;
const int LEN = 21;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1234567891;
//g++ -std=c++11 your_file.cpp -o your_program

int ct1[MAX], ct2[MAX];

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ifstream in("");
    ofstream out("");
    int n;
    int arr[MAX];
    FILL(ct1, 0);
    FILL(ct2, 0);
    cin >> n;
    REP(i, n){
        int tmp;
        cin >> tmp;
        if (i & 1) ++ct2[tmp];
        else ++ct1[tmp];
        arr[i] = tmp;
    }
    int mx1 = 0, mx2 = 0, ind1 = 0, ind2 = 0;
    REP(i, n){
         if (i & 1){
             if (ct2[arr[i]] > mx2) mx2 = ct2[arr[i]], ind2 = arr[i];
         }
         else {
             if (ct1[arr[i]] > mx1) mx1 = ct1[arr[i]], ind1 = arr[i];
         }
    }
    if (ind1 != ind2) cout << n - mx1 - mx2 << endl;
    else {
        int tmpct = mx2;
        ct2[ind2] = 0;
        mx2 = 0;
        for (int i = 1; i < n; i += 2){
            if (ct2[arr[i]] > mx2) mx2 = ct2[arr[i]], ind2 = arr[i];
        }
        int tmp1 = n - mx1 - mx2;
        ct1[ind1] = 0;
        mx1 = 0;
        for (int i = 0; i < n; i += 2){
            if (ct1[arr[i]] > mx1) mx1 = ct1[arr[i]], ind1 = arr[i];
        }
        int tmp2 = n - mx1 - tmpct;
        cout << min(tmp2, tmp1) << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String[] args){
        ABC159A();
    }
    private static void ABC159A() {
        // no comment, no error check
        final int INPUT_LINES_CNT = 1;
        final String DATA_SPLIT_SPACE = " ";

        ArrayList<String> inputLines = getStdInMultiLines(INPUT_LINES_CNT);

        if (inputLines.size() == 0) {
            System.out.println(0);
            return;
        }

        String outputStr;
        try {
            List<String> inputLineList= 
            Arrays.asList((inputLines.get(0)).split(DATA_SPLIT_SPACE));

            int evenNum = Integer.valueOf(inputLineList.get(0));
            int oddNum = Integer.valueOf(inputLineList.get(1));
            int outputNum = 0;

            if (0 <= evenNum && evenNum <= 100 && 0 <= oddNum && oddNum <= 100
                && 2 <= evenNum + oddNum) {
                    for (int i = evenNum - 1; i >= 1; i--){
                        outputNum = outputNum + i;
                    }
                    for (int i = oddNum - 1; i >= 1; i--){
                        outputNum = outputNum + i;
                    }
                    outputStr = String.valueOf(outputNum);
            }
            else {
                outputStr = "0";
            }
        }
        catch (Exception ex) {
            outputStr = "0";
        }

        System.out.println(outputStr);
        return;
    }

private static int getStdInNum() {
        String line1 = getStdInSingleLine();
        if (isNumber(line1)) {
            return Integer.parseInt(line1);
        }
        return 0;
    }

    private static ArrayList<String> getStdInMultiLines() {
        int cnt = 0; 
        int max = 0;

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (cnt++ == 0) {
                max = Integer.parseInt((list.get(0)).split(" ")[0]);
            }
            else if (cnt == max + 1) {
                break;
            }
        }
        cin.close();
        return list;
    }
    private static ArrayList<String> getStdInMultiLines(int inputLinesCnt) {
        int cnt = 0; 

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (++cnt == inputLinesCnt) {
                break;
            }
        }
        cin.close();
        return list;
    }

    private static String getStdInSingleLine() {
        Scanner cin = new Scanner(System.in);

        for (;cin.hasNext();) {
            cin.close();
            return cin.nextLine();
        }

        cin.close();
        return "";
    }

    private static boolean isNumber(String val) {
        try {
            Integer.parseInt(val);
            return true;
        }
        catch (NumberFormatException nfex) {
            return false;
        }
    }

}


Measured memory_bytes: 22612
#include <stdio.h>


int main(void)
{
  int i, j, k;
  int n, x;
  
  
  while( scanf("%d %d", &n, &x), n || x ){
  int cnt = 0;
    for( i = 1; i <= n; i++ ){
      for( j = 1; j < i; j++ ){
        for( k = 1; k < j; k++ ){
          if( i+j+k == x ){
            if( i!=j && j!=k && k!=i ) cnt++;
          }
        }
      }
    }
  
    printf("%d\n", cnt);
  
  }
  
  return 0;

 
}

Measured memory_bytes: 600