akhauriyash/Code-Regression huggingface dataset:
// includes
#include <bits/stdc++.h>
using namespace std;

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<double> a(n);
  cin >> a;
  double sum = 0;
  rep(i, n)sum += 1. / a[i];
  cout << 1. / sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
long long  a,b,c,d,i,j,k,x,y,z,ans;
long long f[100005];
int main(){
	ans=0;
	f[0]=0;
	scanf("%lld %lld",&a,&b);
	for (i=1;i<=a;i++) scanf("%lld",&f[i]);
	for (i=1;i<=a;i++){
		if (f[i]+f[i-1]>b){
			c=f[i]+f[i-1]-b;
			ans+=c;
			f[i]-=c;	
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  

/////////////
int ch(int x)
{
	if(((int)(((int)sqrt(x))*((int)sqrt(x))))==x)
		return 1;
	return 0;
}
signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n;
	cin>>n;
	int d;
	cin>>d;
	int a[n][d];
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<d;++j)
		{
			cin>>a[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<n;++i)
	{
		for(int j=i+1;j<n;++j)
		{
			int v=0;
			for(int k=0;k<d;++k)
			{
				v+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
			}
			if(ch(v))
				++ans;
		}
	}
	cout<<ans;
}

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;
#define mod 1000000007

ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}


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

    ll ans = powmod(10,n)-powmod(9,n)-powmod(9,n) + powmod(8,n);
    ans %= mod;
    ans = (ans + mod) % mod;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3592
#define DEBUG 1
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

int main() {
    std::cin.tie(0); std::cin.sync_with_stdio(false);
    std::string s, t; std::cin >> s >> t;
    int a, b; std::cin >> a >> b;
    std::string u; std::cin >> u;
    if(s==u)a--;
    if(t==u)b--;
    std::cout << a<<" "<< b << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    if (s == "Sunny") {
        cout << "Cloudy\n";
    } else if (s == "Cloudy") {
        cout << "Rainy\n";
    } else {
        cout << "Sunny\n";
    }
}

Measured memory_bytes: 888
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Set<String> a = new HashSet<>();
    int N = sc.nextInt();
    for (int i = 0; i < N; i++) {
      a.add(sc.next());
    }
    if (N == a.size()) {
      System.out.println("YES"); 
    } else {
      System.out.println("NO"); 
    }
  }
}

Measured memory_bytes: 76676
#include<stdio.h>
char S[1001], c;
short s, w, i;
int main(void){
  while((c=getchar())!=10){S[s++]=c;}
  scanf("%hd", &w);
  for(i=0; i<s; i+=w){
    putchar(S[i]);
  }
  putchar(10);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    ll n, m;
    cin>>n>>m;
    vector<LP> ba(n);
    rep(i, n) cin>>ba[i].second>>ba[i].first;

    sort(ba.begin(), ba.end());
    reverse(ba.begin(), ba.end());
    vector<ll> sched(m + 1);
    rep(i, m + 1) sched[i] = i - m;
    ll ans = 0;
    rep(i, n) {
        ll d = -m + ba[i].second;
        vector<ll>::iterator iter = lower_bound(sched.begin(), sched.end(), d);
        if (iter == sched.end()) continue;
        sched.erase(iter);
        ans += ba[i].first;
    }
    cout<<ans<<endl;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
using Graph = V<V<int>>;
const int MOD =  1000000007;
const ll INF = 1LL << 60;


int main() {
    string s; cin >> s;
    int n = s.size();

    int ans = 1;
    bool flag = false;
    for(int i = 1; i < n; i++){
        if(flag) {
            ans++;
            flag = false;
        }else if(s[i - 1] != s[i]) {
            ans++;
        }else{
            if(i + 1 < n) {
                i++;
                flag = true;
                ans++;
            }
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3724
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(len(b)):
    c_i = 0
    c_i = min(a[i], b[i])
    c += c_i
    b[i] -= c_i
    c_i_1 = 0
    c_i_1 = min(a[i+1], b[i])
    c += c_i_1
    a[i+1] -= c_i_1
print(c)

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

int x[100000];

void win(bool f) { printf("%s\n", f ? "First" : "Second"), exit(0); }

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

int main(){
	int n;
	scanf("%d",&n);
	ll s = 0;
	f(i, 0, n){
		scanf("%d", x + i);
		s += x[i] - 1;
	}
	bool p = false;
	if (n & 1){
		while (!(s & 1)){
			int od = 0;
			bool on = false;
			f(i, 0, n) { if (x[i] & 1)++od; if (x[i] == 1) { on = true; break; } }
			if (od != 1 || on)break;
			p = !p;
			int r = x[0] & ~1;
			f(i, 0, n){
				if (x[i] & 1)x[i] &= ~1;
				r = gcd(r, x[i]);
			}
			s = 0;
			f(i, 0, n)x[i] /= r, s += x[i] - 1;
		}
	}
	win(s & 1 ^ p);
}


Measured memory_bytes: 640
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

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

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

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

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int h, w, k; cin >> h >> w >> k;
	int res = 0;
	vector<string> c(h); rep(i, h)cin >> c[i];
	rep(i, pow(2, h))
	{
		rep(j, pow(2, w))
		{
			int cnt = 0;
			rep(a, h)rep(b, w)
			{
				if ((i >> a) & 1 && (j >> b) & 1 && c[a][b] == '#')++cnt;
			}
			if (cnt == k)++res;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 4032
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    semai = float("inf")
    for _ in range(5):
        minute = I()
        semai = min(semai,minute)
    
    group = (n+semai-1)//semai
    ans = group + 4
    print(ans)
main()

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

const long long mod = 1e9+7;
const int N = 1e6+5;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fr(i,l,m) for(int i=l;i<m;i++)

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll pwr(ll x,ll y);
bool isprime(ll x);

ll a[N],m[N];
//vector<int> ;
int main()
{
ios_base::sync_with_stdio(false);
ll n,k;
cin>>n>>k;
fr(i,0,n)
{
    cin>>a[i];
}

for(int i=n-2;i>=max(n-k,0LL);i--)
{
    ll t=mod;
    for(int j=i+1;j<=n-1;j++)
    {
      t=min(m[j]+abs(a[i]-a[j]),t);
    }
    m[i]=t;
}
//m[n-1]=(0);
//m[n-2]=abs(a[n-2]-a[n-1]);
for(int i=(n-k-1);i>=0;i--)
{
    ll t=mod;
    for(int j=i+1;j<=min(i+k,n-1);j++){
    t=min(m[j]+abs(a[j]-a[i]),t);
    }
    m[i]=t;
}
cout<<m[0]<<endl;
// Code Here

return 0;
}
/////////
/////////
/////////
ll pwr(ll x,ll y)
{
    ll ans=1;
    x=x;
    while(y>0){
    if(y&1)ans=(x*ans);
    x=(x*x);
    y=y/2;
    }
    return ans;
}
bool isprime(ll x)
{
    if(x<2)return false;
    if(x<4)return true;
    if(x%2==0 || x%3==0)return false;
    for(ll i=5;i*i<=x;i+=6)
    {
        if(x%i==0 ||x%(i+2)==0)return false;
    }
    return true;
}


Measured memory_bytes: 5120
from itertools import accumulate

n, c = map(int, input().split())
xs, vs = [], []
for _ in range(n):
    x, v = map(int, input().split())
    xs.append(x)
    vs.append(v)
xs = [0] + xs + [c]
vs = [0] + vs + [0]


def maxcalrrl(xs=xs, vs=vs):
    avsr = list(accumulate(reversed(vs)))[::-1]

    calr = [a - 2 * x for x, a in zip(xs, accumulate(vs))]
    call = [a - (c - x) for x, a in zip(xs, avsr)]

    maxcalr = list(accumulate(calr, max))

    return max([
        call[i + 1] + maxcalr[i] for i in range(n + 1)
    ])


def maxcalrll(xs=xs, vs=vs):
    xsr = [c - x for x in xs][::-1]
    vsr = vs[::-1]
    return maxcalrrl(xsr, vsr)


# print(maxcalrrl())
answer = max([maxcalrrl(), maxcalrll()])
print(answer)


Measured memory_bytes: 34748
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N;
    cin >> N;
    int n = 0;
    for (int i = 0; i < N; ++i) {
        int d1, d2;
        cin >> d1 >> d2;
        if (d1 == d2) {
            ++n;
            if (n == 3) {
                cout << "Yes" << endl;
                return;
            }
        }
        else {
            n = 0;
        }
    }
    cout << "No" << endl;

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3632
n=int(input())
h=list(map(int,input().split()))

s=[]
for i in range(n-1,-1,-1):
    s.append(h[i])

for j in range(n-1):
    if s[j]+1<s[j+1]:
        print("No")
        exit()
    elif s[j]+1==s[j+1]:
        s[j+1]-=1

print("Yes")

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, M;
  cin >> N >> M;
  map<int, int> limitation;
  vector<bool> visit(N + 1, false);

  int s, c;
  REP(i, M) {
    cin >> s >> c;
    if (visit.at(s)) {
      if (limitation.at(s) == c) {
        continue;
      } else {
        cout << -1 << endl;
        return 0;
      }
    }

    limitation.insert(make_pair(s, c));
    visit.at(s) = true;
  }

  REP(i, 10000) {
    stringstream ss;
    ss << i;
    string t_s = ss.str();
    if ((int)t_s.length() == N) {
      bool ok = true;
      for (auto const &it : limitation) {
        if (t_s.at(it.first - 1) != it.second + '0') {
          ok = false;
          break;
        }
      }

      if (ok) {
        cout << i << endl;
        return 0;
      }
    }
  }

  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define inf INFINITY
#define file freopen( "input.txt" , "r" , stdin) ; freopen( "output.txt" , "w" , stdout) ;
#define Gamed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define _3102_ main()
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
const int N = 1e5 + 100;
const ll MX = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-9 ;

ll n, a[N] , b[N] , c[N], dp[N][3] ;

ll solve( int i , int j ){
	if ( i < 0 ) return 0 ;
	ll &ret = dp[i][j] ;
	if ( ret != -1) return ret ;
	if ( j == 0 ){
		return ret = a[i] + max ( solve(i-1 , 1), solve(i-1,2) ) ;
	}
	else if ( j == 1 ){
		return ret = b[i] + max ( solve(i-1 , 0), solve(i-1,2) ) ;
	}
	return ret = c[i] + max ( solve(i-1 , 1), solve(i-1,0) ) ;
}

int _3102_{
	Gamed
	cin >> n ;
	for ( int i = 0 ; i < n ; i ++ ) {
		cin >> a[i] >> b[i] >> c[i] ;
	}
	memset ( dp , -1 , sizeof dp);
	dp[0][0] = a[0] , dp[0][1] = b[0] , dp[0][2] = c[0] ;
	cout << max ( solve ( n - 1 , 1) , max ( solve ( n -1 , 0 ) , solve ( n - 1 , 2 ))) << endl ;
	return 0;
}


Measured memory_bytes: 12976
/*
 * 2356.cc: Palindromic Anagram
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 20;

/* typedef */

typedef long long ll;

/* global variables */

int as[26];
ll fracs[MAX_N + 1];

/* subroutines */

inline ll nck(int n, int k) {
  return fracs[n] / fracs[n - k] / fracs[k];
}

void prepare_fracs(int n) {
  fracs[0] = 1;
  for (int i = 1; i <= n; i++)
    fracs[i] = fracs[i - 1] * i;
}

/* main */

int main() {
  string s;
  cin >> s;
  int sn = s.size(), n = sn / 2;
  
  for (int i = 0; i < sn; i++) as[s[i] - 'a']++;

  int oddn = 0;
  for (int i = 0; i < 26; i++) {
    if (as[i] & 1) oddn++;
    as[i] /= 2;
  }
  if (oddn > 1) {
    puts("0");
    return 0;
  }

  prepare_fracs(n);

  ll ans = 1;
  int k = n;
  
  for (int i = 0; i < 26; i++) {
    //printf("%d: nck(%d,%d)\n", i, k, as[i]);
    ans *= nck(k, as[i]);
    k -= as[i];
  }

  printf("%lld\n", ans);
  return 0;
}

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

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define sz(x) ((long long int)x.size())
#define pb push_back
#define pob pop_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << '\n'
#define prs(XX) cout << XX << ' '
#define TEST cout << "TEST\n";

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int MOD = 1e9 + 7;
const long long int INF = 2e9 + 13;
const long long int mINF = -2e9 - 13;
const double PI = acos(-1.0);
const double EPS = 1e-9;

ll mx(ll x, ll y){ return (x>y?x:y); }
ll mn(ll x, ll y){ return (x<y?x:y); }

void max_self(ll &x, ll y){ x = mx(x, y); }
void min_self(ll &x, ll y){ x = mn(x, y); }
void add(ll &x, ll y){ x%=MOD; x += (y%MOD); x %= MOD; }
void mul(ll &x, ll y){ x%=MOD; x *= (y%MOD); x %= MOD; }

ll us(ll n, ll x, ll m){
    if(x == 0) return 1;
    ll a = us(n, x>>1, m);
    return (((a*a)%m)*(x&1?n:1))%m;
}

ll N, R;

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    cin >> N >> R;
    if(N >= 10) cout << R << endl;
    else cout << R + (10-N)*100 << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Map<Integer,Integer> a = new TreeMap<>();
        for(int i = 1;i<n+1;i++){
            a.put(Integer.parseInt(sc.next()),i);
        }
        for(Integer num: a.values()){
            System.out.println(num);
        }
    }
}


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

int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    vector<int> judge(4,0);
    string judge_name[4] = {"AC","WA","TLE","RE"};

    for(int i=0;i<n;i++){
        cin>>s[i];
        if(s[i]=="AC") judge[0]++;
        else if(s[i]=="WA") judge[1]++;
        else if(s[i]=="TLE") judge[2]++;
        else judge[3]++;
    }
    for(int i=0;i<4;i++){
        cout<<judge_name[i]<<" "<<"x"<<" "<<judge[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 6432
#include <bits/stdc++.h>
using namespace std;
int main(){
int r, c;
cin>>r>>c;

int num[101][101] = {};
for(int i=0;i<r;i++)
for(int j=0;j<c;j++) cin>>num[i][j];

for(int i=0;i<r;i++)
for(int j=0;j<c;j++) num[r][c] += num[i][j];

for(int i=0;i<r;i++){
int sum = 0;
for(int j=0;j<c;j++) sum += num[i][j];
num[i][c] = sum;
}

for(int j=0;j<c;j++){
int sum = 0;
for(int i =0;i<r;i++) sum += num[i][j];
num[r][j] = sum;
}

for(int i=0;i<=r;i++){
for(int j=0;j<=c;j++){
if(j) cout<<" ";
cout<<num[i][j];
}
cout<<endl;
}
return 0;
}


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

const vector<vector<int>> D = {
    {4, 0, 2, 3, 5, 1}, // N
    {2, 1, 5, 0, 4, 3}, // E
    {1, 5, 2, 3, 0, 4}, // S
    {3, 1, 0, 5, 4, 2}  // W
};

struct Dice {
  vector<int> face;

  Dice(vector<int> v) : face(v) {
  }

  void roll(char direction) {
    int dir;
    if (direction == 'N')
      dir = 0;
    if (direction == 'E')
      dir = 1;
    if (direction == 'S')
      dir = 2;
    if (direction == 'W')
      dir = 3;

    vector<int> tmp(6);
    rep(i, tmp.size()) tmp[D[dir][i]] = face[i];
    face = tmp;
  }

  int top() {
    return face.front();
  }
};

int main() {
  vector<int> v(6);
  rep(i, 6) cin >> v[i];
  Dice d(v);

  string command;
  cin >> command;

  rep(i, command.size()) d.roll(command.at(i));
  cout << d.top() << endl;
}


Measured memory_bytes: 3212
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	while (cin >> n) {
		while (n > 39) {
			n -= 39;
		}
		cout << "3C";
		printf("%.2d\n", n);
	}
	return 0;
}

Measured memory_bytes: 3088
#include <stdio.h>

int main(void){
  char s[51] = { '\0' };
  scanf("%s", s);
  int i = 0;
  while(s[i] != '\0') i++;
  i -= 8;
  for(int j = 0; j < i; j++) printf("%c", s[j]);
  printf("\n");

  return 0;
}

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

int main(){
    long n;
    cin >> n;
    
    vector<long> exist(1000001);
    
    long maxa = 1;
    for(long i = 0; i < n; i++) {
        long a; 
        cin >> a;
        maxa = max(maxa, a);
        exist.at(a) += 1;
    }
    
    for(long i = 1; i <= maxa; i++){
        if(exist.at(i) >= 1) {
            for(long j = 2; i*j <= maxa; j++) {
                exist.at(i*j) = 0;
            }
        }
        if(exist.at(i) > 1) exist.at(i) = 0;
    }
    
    long ans = 0;
    for(long i = 1; i <= maxa; i++) {
        ans += exist.at(i);
    }
    cout << ans << endl;
}


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

using namespace std;
/*
void lcs(int i, int j, string s1, string s2)
{
	if(i==0 || j==0)  return;

	if(i>0 && dp[i][j] == dp[i-1][j]+1) lcs(i-1,j);
	else if(i>0 && dp[i][j] == dp[i][j-1]+1) lcs(i,j-1);
	else
	{
		lcs(i-1,j-1);
		if(s1[i] == s2[j])  cout << s1[i];
	}
}
*/
int main()
{
	string s1,s2;
	cin >> s1 >> s2;

	int n = s1.size();
	int m = s2.size();

	int dp[n+1][m+1];

	for(int i=0; i<=n; i++)  dp[i][0] = 0;

	for(int i=0; i<=m; i++)  dp[0][i] = 0;
	
	for(int i=1;i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			int x = dp[i-1][j];
			int y = dp[i][j-1];
			int z;
			if(s1[i-1] == s2[j-1])  z = dp[i-1][j-1]+1;
			else                    z = dp[i-1][j-1];

			dp[i][j] = max(x, max(y, z));
			
		}
	}
	
	int index = dp[n][m];
	//cout << index << endl;
    char lcs[index+1];
    lcs[index] = '\0';
	int i = n;
	int j = m;
	while(i>0 && j>0)
	{
		if(s1[i-1] == s2[j-1])
		{
		    lcs[index-1] = s1[i-1];
		    i--;
		    j--;
		    index--;
		}
		
		else if(dp[i-1][j] > dp[i][j-1])  i--;
		else                              j--;
	}
	
	cout << lcs;
	


}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int N; cin >> N;
	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		int a; cin >> a;
		if (i % 2 == 1 && a % 2 == 1)cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3592
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b := readInt(), readInt()

	if a < b {
		a, b = b, a
	}
	n := gcd(a, b)

	d := make(map[int]int, 0)
	for i := 2; i*i <= n; i++ {
		if n%i != 0 {
			continue
		}
		for n%i == 0 {
			n /= i
			d[i]++
		}
	}
	if n != 1 {
		d[n]++
	}
	fmt.Println(len(d) + 1)
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func isPrime(x int) bool {
	for i := 2; i*i <= x; i++ {
		if x%i == 0 {
			return false
		}
	}
	return true
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int c = 0;
  cin >> N;
  int t = N;
  while(t>0){
  c += t%10;
  t /= 10;
  }
  if(N%c == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    return ret;
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.is_err() || res.ok().unwrap() == 0 || u8b[0] <= ' ' as u8 {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = std::string::String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}
fn parse<T: std::str::FromStr>(s: &str) -> T { s.parse::<T>().ok().unwrap() }

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { parse(&get_word()) }

const MOD: i64 = 1_000_000_007;

fn powmod(x: i64, mut e: i64, m: i64) -> i64 {
    let mut sum = 1;
    let mut cur = x % m;
    while e > 0 {
        if e % 2 != 0 {
            sum = sum * cur % m;
        }
        cur = cur * cur % m;
        e /= 2;
    }
    sum
}

fn make_dp_table(n: usize) -> Vec<Vec<i64>> {
    let mut dp = vec![Vec::new(); n];
    dp[0] = vec![0; 2 * n];
    for i in 0 .. 2 * n {
        dp[0][i] = 1;
    }
    for i in 1 .. n {
        dp[i] = vec![0; 2 * n - i];
        for j in 0 .. 2 * n - i {
            dp[i][j] = (dp[i - 1][j + 1] + if j > 0 { dp[i][j - 1] } else { 0 })
                % MOD;
        }
    }
    dp
}

fn main() {
    let n = get();
    let k: usize = get::<usize>() - 1;
    let mut tot: i64 = 0;
    let dp = make_dp_table(n);
    if k < n - 1 {
        for m in n - k - 1 .. n {
            let mut tmp = dp[n - m - 1][m + 1 + k - n];
            for i in 0 .. n - k - 2 {
                tmp = tmp * (m - 1 - i) as i64 % MOD;
                tmp = tmp * powmod(i as i64 + 1, MOD - 2, MOD) % MOD; 
            }
            tot += tmp;
            tot %= MOD;
        }
    } else {
        tot = dp[n - 1][0];
    }
    for _ in k + 2 .. n {
        tot = tot * 2 % MOD;
    }
    println!("{}", tot);
}


Measured memory_bytes: 56956
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	int a, b;
	cin >> a >> b;

	int ans = a - 1;
	if (b >= a)ans++;
	cout << ans << endl;
	return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;

const int maxn = 55;

int val[20][20];
int N;
int f[1 << 18][maxn];

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if (fopen("A.INP", "r")){
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  }
  cin >> N; vector<int> a(N), b(N);
  for (auto & x : a) cin >> x;
  for (auto & x : b) cin >> x;
  for (int i = 0; i < N; ++i){
    for (int j = 0; j < N; ++j){
      val[i][j] = (i % 2 == j % 2) ? a[i] : b[i];
    }
  }
  fill_n(&f[0][0], (1 << 18) * maxn, 1e9 + 5);
  f[0][0] = 0;
  for (int mask = 0; mask < (1 << N); ++mask){
    int i = __builtin_popcount(mask);
    for (int V = 0; V < maxn; ++V){
      int cost = 0;
      for (int j = 0; j < N; ++j){
        if (mask >> j & 1) continue;
        if (val[j][i] >= V){
          f[mask + (1 << j)][val[j][i]] = min(f[mask + (1 << j)][val[j][i]], f[mask][V] + cost);
        }
        ++cost;
      }
    }
  }
  int ret = 1e9;
  for (int i = 0; i < maxn; ++i){
    ret = min(ret, f[(1 << N) - 1][i]);
  }
  if (ret == 1e9) ret = -1;
  cout << ret << '\n';
}


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

int calc(int n) {
    int i = 0;
    while (n >= 5) {
        i += n / 5;
        n /= 5;
    }
    return i;
}

int main() {
    int n;
    while (cin >> n) {
        if (n == 0) break;
        cout << calc(n) << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin>>n;
  int b[n-1];
  for (int i=0; i<n-1; i++) cin>>b[i];
  int a[n];
  a[n-1] = b[n-2];
  for (int i=n-2; i>0; i--) {
    a[i] = min(b[i], b[i-1]);
  }
  a[0] = b[0];
  long long ans = 0;
  for (int i=0; i<n; i++) ans += a[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = sorted(LIST())
print(s[0]+s[1])

Measured memory_bytes: 5148
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

ll q;
vector<ll> vec;

int main() {
    fastInp;

    ll a, b;
    cin >> a >> b;

    ll ans = INT64_MAX;
    if (-a <= b) {
        ans = min(ans, abs(b + a) + 1);
    }
    if (a <= b) {
        ans = min(ans, abs(b - a));
    }
    if (-a <= -b) {
        ans = min(ans, (-b + a) + 2);
    }
    if (a <= -b) {
        ans = min(ans, -b - a + 1);
    }
    cout << ans;
    return 0;
}

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

int N, M;
int p[100001], x[100001], y[100001];

struct UnionFind {
    vector<int> par;
    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) {
            par[i] = i;
        }
    }
    int root (int x) {
        if (x == par[x]) return x;
        else return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        par[x] = y;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

main()
{
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        p[i]--;
    }
    UnionFind uf(N);
    for (int i = 0; i < M; i++) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
        uf.unite(x[i], y[i]);
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (uf.same(i, p[i])) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
/*
 * atcoder/abc134/e.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <set>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * Aの要素をK個の色で塗り分けることはK個のグループに分けるとみなせる.
 * そのグループの条件は狭義単調増加列であること.
 * 既存のグループを管理しながら、条件を満たしつつ既存のグループに追加していき、
 * 条件を満たせない場合は新規のグループを作れば良い.
 * 条件を満たすグループが複数ある場合は「もっともきつい」グループを貪欲に選択すれば良い.
 * 「もっともきつい」とは、右端が最も大きいグループのこと.
 * 右端が最大でないものを選んでしまうと後で追加できたはずの要素が追加できなくなり、
 * 損をすることになる.
 */
int N;
vector<int> A;
void solve() {
  cin >> N;
  A.resize(N);

  // S := Aを最初から見ていった時に、既存の単調増加部分列に追加出来る場合は末尾に追加、
  // 出来ない場合は新規の単調増加部分列を作成、としていった時に出来る単調増加部分列群の
  // 右端の値の集合.
  // 右端の情報さえあれば、その単調増加部分列に追加可能か判定できる.
  multiset<int> S;

  loop(n,0,N) cin >> A[n];

  for (auto&&a: A) {
    auto iter = S.lower_bound(a); // a以上の最初の値を見つける
    // 見つかった場合、aより小さい右端をもつ単調増加部分列があるということ.
    // 同じ値が複数ある場合lower_boundは最初の場所を返すので、iter - 1 は必ずa未満
    // そのa未満の右端をもつ単調増加部分列に追加（右端を、消して上書きする）
    if (iter != S.begin()) S.erase(--iter);
    // 上記までで消した場合は上書きになり、消さない場合は新規追加
    S.insert(a);
  }
  cout << S.size() << endl;

}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  int count = 1;
  int ans = 0;
  while (1) {
    if (count >= b) {
      break;
    }
    count += (a - 1);
    ans++;
    
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x, f = 0;
	cin >> x;
	int s=x;
	while (x > 0)
	{
		f += (x % 10);
		x /= 10;
	}
	
	((s % f) == 0) ? cout << "Yes" : cout << "No";
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
    static final int MOD = 1_000_000_007;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        
        long res = a%MOD;
        
        for(int i = a-1; i > 0; i--){
            res=res*i%MOD;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

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

int main() {
  i64 n, x;
  cin >> n >> x;
  vector<i64> vec;
  vec.push_back(x);
  for(int i = 0;i < n;i++) {
    i64 a;
    cin >> a;
    vec.push_back(a);
  }
  sort(all(vec));
  i64 g = vec[1] - vec[0];
  for(int i = 0;i < n;i++) {
    g = gcd(g, vec[i + 1] - vec[i]);
  }
  cout << g << endl;
}


Measured memory_bytes: 1400
#include<iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <stack>
#include <list>
#include <map>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <climits>
#include <queue>
#include <stack>
#include <cstdio>

using namespace std;

const double EPS (1e-8);
const double PI = acos(-1.0);

template<class T>
struct Po{
	T x,y;
	Po() : x(0.0),y(0.0) {}
	Po(const T &x,const T &y) : x(x),y(y) {}
	Po operator+(const Po& a) const { return Po(x + a.x,y + a.y); }
	Po operator-(const Po& a) const { return Po(x - a.x,y - a.y); }
	Po operator*(const double& a) const { return Po(x * a, y * a); }
	Po operator/(const double& a) const { return Po(x / a, y / a); }
};

enum{ CCW = 1,CW = -1,ON = 0};

typedef Po<double> P;

double SQ(double x) {return x* x; }
double abs(const P& a) { return sqrt(SQ(a.x) + SQ(a.y)); }
double dot( const P& a,const P &b){ return a.x * b.x + a.y * b.y ; }
double cross( const P& a,const P &b){ return a.x * b.y - a.y * b.x ; }

P rot(const P& a, double theta){
	return P( a.x * cos(theta) - a.y * sin(theta) ,
		a.x * sin(theta) + a.y * cos(theta) );
}

int ccw(P a,P b,P c){
	b = b - a; c = c - a;
	double rdir = cross(b,c);
	double len = abs(b) * abs(c);
	if( rdir > EPS *len) return CCW;
	else if( rdir < -EPS * len) return CW;
	return ON;
}

bool intersect(P& a1,P& b1,P& a2, P& b2){
	if(max(a1.x,b1.x) + EPS < min(a2.x,b2.x)
	||max(a1.y,b1.y) + EPS < min(a2.y,b2.y)
	||max(a2.x,b2.x) + EPS < min(a1.x,b1.x)
	||max(a2.y,b2.y) + EPS < min(a1.y,b1.y) ) return false;
	return ccw(a1,b1,a2) * ccw(a1,b1,b2) <= 0
		&& ccw(a2,b2,a1) * ccw(a2,b2,b1) <= 0;
}

typedef pair<P,P> PD;

PD GetContact(const P& p, const P &q,double pr,double pq){
	P a = q-p;
	P b = rot(a,PI / 2);
	double c = abs(a);
	b = b / c;

	double s = (pr + pq + c) / 2;
	double men = sqrt(s * (s - pr) * (s - pq) * (s - c));
	double l = 2 * men / c;
	double lp = sqrt(SQ(pr) - SQ(l));
	
	a = a / c * lp;
	b = b * l;
	return PD(p + a + b,p + a - b);
}

int n;
P p[100];
double r[100];
double dp[202][202];

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


int main(){

	while(cin>>n,n){
		vector<P> us;
		vector<PD> vpd;
		FOR(i,n) cin>>p[i].x >> p[i].y >> r[i];
		FOR(i,202) FOR(j,202) dp[i][j] = 1e50;
		us.push_back(p[0]);

		for (int i = 0; i < n - 1; i++){
			PD pd = GetContact(p[i],p[i+1],r[i],r[i+1]);
			us.push_back(pd.first);
			us.push_back(pd.second);
			vpd.push_back(pd);
		}
		us.push_back(p[n-1]);

		for(int i = 0; i < (int)us.size(); i++){
			for(int j = i + 1; j < (int)us.size(); j++){
				bool ok = true;
				int l  = (1 + i) / 2;
				int r = (1 + j) / 2 - 1;
				for (int k = l; k < r; k++){
					if(!intersect(us[i],us[j],vpd[k].first,vpd[k].second))
						ok = false;
				}
				if(!ok) continue;
				double dist = abs(us[i] - us[j]);
				dp[j][i] = dp[i][j] = dist;
			}
		}

		int a = (int)us.size();
		FOR(k,a) FOR(i,a) FOR(j,a) dp[i][j] = min(dp[i][j],dp[i][k] + dp[k][j]);

		printf("%.10lf\n",dp[0][a - 1]);

	}
	return 0;
}

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

int A, B, C;
int X;
vector<int> dataS(3);
int goukei = 0;
int countX = 0;

int main() {
	for (int i = 0; i < 3; i++) {
		cin >> dataS.at(i);
	}
	cin >> X;

	for (int i = 0; i <= dataS.at(0); i++) {
		for (int j = 0; j <= dataS.at(1); j++) {
			for (int k = 0; k <= dataS.at(2); k++) {
				goukei = 500 * i + 100 * j + 50 * k;
				if (goukei == X)countX++;
			}
		}
	}

	cout << countX << endl;
}

Measured memory_bytes: 764
def is_prime(x):
    if x == 2:
        return 1
    elif x % 2 == 0:
        return 0
    else:
        return pow(2, x - 1, x) == 1
      
if __name__ == '__main__':
  N = int(input())
  cnt = 0
  for n in range(N):
    v = int(input())
    if is_prime(v):
      cnt += 1 
  print(cnt)


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

int main()
{
	string str;
	string str1;
	cin >> str >> str1;
	int ans = 0;
	if(str[0] == str1[0])ans++;
	if(str[1] == str1[1])ans++;
	if(str[2] == str1[2])ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

#UnionFindTreeクラスの定義
class UnionFind():
    #クラスコンストラクタ
    #selfはインスタンス自身
    def __init__(self, n):
        #親ノードを-1に初期化する
        self.parents = [-1] * n

    #根を探す（再帰関数）
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    #xとyの木を併合する
    def union(self, x, y):
        #x,yの根をX,Yとする
        X = self.find(x)
        Y = self.find(y)

        #根が同じなら結合済み
        if X == Y:
            return

        #ノード数が多い方をXとする
        if self.parents[X] > self.parents[Y]:
            X, Y = Y, X

        #XにYのノード数を足す
        self.parents[X] += self.parents[Y]
        #Yの根を X>0 とする
        self.parents[Y] = X


N, M = map(int, input().split())
info = [tuple(map(int, s.split())) for s in sys.stdin.readlines()]

#UnionFindインスタンスの生成
uf = UnionFind(N)
for a, b in info:
    #インデックスを調整し、a,bの木を結合
    a -= 1; b -= 1
    uf.union(a, b)

c = 0
for i in range(N):
  if uf.parents[i] < 0:
    c += 1

print(c-1)

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

const int INF = 10000000;

int main()
{
    int k;
    cin >> k;
    while(k % 2 == 0) k /= 2;
    while(k % 5 == 0) k /= 5;
    int a[100002]; //kで割った余りがiとなる最小の和
    fill(a, a + k, INF);
    a[1] = 1;
    queue<int> que;
    que.push(1);
    while(que.size()){
        int now = que.front();
        que.pop();
        int next = now * 10 % k;
        int count = 0;
        while(a[next] > a[now]){
            a[next] = a[now];
            count++;
            next = next * 10 % k;
        }
        if(a[now] + 1 < a[(now + 1) % k]){
            a[(now + 1) % k] = a[now] + 1;
            que.push((now + 1) % k);
        }
        next = now * 10 % k;
        for(int i = 0; i < count; i++){
            if(a[next] + 1 < a[(next + 1) % k]){
                a[(next + 1) % k] = a[next] + 1;
                que.push((next + 1) % k);
            }
            next = next * 10 % k;
        }
    }
    cout << a[0] << endl;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(m);
    REP(i,m)cin >> a[i];
    vector<int> pt(n,0);
    int b;
    REP(i,m){
        REP(j,n){
            cin >> b;
            if(b==a[i])pt[j]++;
            else pt[a[i]-1]++;
        }
    }

    REP(i,n)cout << pt[i] << endl;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>

template<class RandomAccessIterator, class Field>
RandomAccessIterator fast_fourier_transform(RandomAccessIterator first, RandomAccessIterator last, RandomAccessIterator result, Field hint){
    ::std::vector<Field> res(first, last);
    ::std::size_t N = res.size();

    // bit reverse
    for(::std::size_t i = 0, j = 0; i < N; ++i){
        if(i < j)::std::swap(res[i], res[j]);
        j ^= N / (1 + (i ^ (i + 1))) * (i ^ (i + 1));
    }

    ::std::stack<Field> root;
    root.push(hint);
    for(::std::size_t i = 2; i < N; i <<= 1){
        root.push(hint *= hint);
    }

    // fft
    for(::std::size_t i = 1; i < N; i <<= 1){
        auto t = root.top();
        root.pop();
        for(::std::size_t j = 0; j < N; j += 2 * i){
            Field coef = static_cast<Field>(1);
            for(::std::size_t k = 0; k < i; ++k){
                auto tmp = res[j + k];
                res[j + k] += coef * res[j + k + i];
                res[j + k + i] = tmp - coef * res[j + k + i];
                coef *= t;
            }
        }
    }

    return ::std::copy(res.begin(), res.end(), result);

}

using real = double;

real pi = boost::math::constants::pi<real>();
::std::size_t t = 1;

template<class RandomAccessIterator1, class RandomAccessIterator2, class RandomAccessIterator3>
RandomAccessIterator1 convolution(RandomAccessIterator1 first1, RandomAccessIterator1 last1, RandomAccessIterator2 first2, RandomAccessIterator2 last2, RandomAccessIterator3 result){
    using value_type = typename ::std::iterator_traits<RandomAccessIterator1>::value_type;
    using size_type = ::std::size_t;
    size_type N = last1 - first1, M = last2 - first2;
    while(t < N + M)t <<= 1;

    ::std::vector<value_type> input1(first1, last1), input2(first2, last2), chukan1(t), chukan2(t), res(t);
    input1.resize(t);
    input2.resize(t);
    value_type hint = value_type(::std::cos(pi / (t / 2)), ::std::sin(pi / (t / 2))), ihint = value_type(::std::cos(pi / (t / 2)), -::std::sin(pi / (t / 2)));
    fast_fourier_transform(input1.begin(), input1.end(), chukan1.begin(), hint);
    fast_fourier_transform(input2.begin(), input2.end(), chukan2.begin(), hint);
    ::std::transform(chukan1.begin(), chukan1.end(), chukan2.begin(), res.begin(), ::std::multiplies<value_type>());

    return fast_fourier_transform(res.begin(), res.end(), result, ihint);
}

int main(){
    using real = double;
    using namespace std;
    unsigned long N, L;
    cin >> N >> L;
    vector<unsigned long> T(N);
    copy_n(istream_iterator<unsigned long>(cin), N, T.begin());
    vector<complex<real>> ps(N), res(4 * N);
    transform(T.begin(), T.end(), ps.begin(), [&L](auto t){return complex<real>(cos(pi * t / L), sin(pi * t / L));});
    convolution(ps.begin(), ps.end(), ps.rbegin(), ps.rend(), res.begin());
    complex<real> x{0};
    for(long i = 0, c = -N; i + 1 < N; ++i){
        x += res[i] * static_cast<real>(c += 2);
    }
    t *= N * (N - 1) * (N - 2) / 6;
    x /= t;
    cout << setprecision(15) << fixed << endl;
    cout << x.real() << " " << x.imag() << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(void){

  int n,m,i,j;
  scanf("%d %d",&n,&m);

  int A [100][100] ;
  int B [100] ;
  int C [100] = {};

  for (i = 0; i < n; i++){
    for (j = 0; j < m; j++){
      scanf("%d ",&A[i][j]);
    }
  }
  for (i = 0; i < m; i++){
    scanf("%d",&B[i]);
  }

  for (i = 0; i < n; i++){
    for (j = 0; j < m; j++){
      C[i] += A[i][j] * B[j];
    }
    printf("%d\n",C[i]);
  }

  return 0;
}



Measured memory_bytes: 2744
s = input()
p2 = s[0]
p1 = s[1]
ans = "-1 -1"
if p2 == p1 :
  ans = '1 2'
else:
  for i in range(2,len(s)):
    if p2 == s[i] or p1 == s[i]:
      ans = str(i-1)+" "+str(i+1)
      break
    p2 = s[i-1]
    p1 = s[i]
print(ans)


Measured memory_bytes: 3188
from math import sqrt, floor
from itertools import combinations
from collections import defaultdict
N = int(input())

ans_root = sqrt(1 + 8 * N)
if (1 + 8 * N) - floor(ans_root) ** 2 > 1e-6:
    print("No")
    exit(0)

k = floor((1 + ans_root) // 2)
result = defaultdict(list)
for i, (flag1, flag2) in enumerate(combinations(range(k), 2), start=1):
    result[flag1].append(str(i))
    result[flag2].append(str(i))

print("Yes")
print(k)
for value in result.values():
    print(len(value), " ".join(value))


Measured memory_bytes: 17396