akhauriyash/Code-Regression huggingface dataset:
//bismillahir rahmanir rahim            //Author:Fayed Anik

#include <bits/stdc++.h>

using namespace std;


#define         ll                         long  long
#define         lf                         double
#define         pb(x)                      push_back(x)
#define         ull                        unsigned long long
#define         sfl(a)                     scanf("%lld",&a)
#define         sf(a)                      scanf("%d",&a)
#define         pf(a)                      printf("%d\n",a)
#define         pfl(a)                     printf("%lld\n",a)
#define         pdl(a)                     printf("%llf\n",a)
#define         FOR(x,n)                   for(ll x=1;x<=n;++x)
#define         vii                        vector< ll > v
#define         pi                         3.14159265359
#define         mex                        10000000
#define         pii                        pair< ll , ll >
#define         mem(m,a)                   memset( m, a,sizeof m)
#define         mp(a,b)                    make_pair(a,b)
#define         maxn                       100000
#define         mod                        1000000007
#define         INF                        1e17
#define         f1                         first
#define         f2                         second
#define         all(v)                     v.begin(),v.end()
#define         PI                         acos(-1)
#define         printminusone              printf("-1\n")
#define         bug                        printf("bug")

ll tree[400005],a[100005];
ll ans=1;

void build(ll node,ll b,ll e){
	if(b==e){
		tree[node]=a[b];
		return;
	}
	ll left=node<<1;
	ll right=left+1;
	ll mid=(b+e)>>1;
	build(left,b,mid);
	build(right,mid+1,e);
	tree[node]=__gcd(tree[left],tree[right]);
}


ll query(ll node,ll b,ll e,ll i,ll j){
	if(i>e or j<b){
		return 0;
	}
	if(b>=i and e<=j){
		return tree[node];
	}

	ll left=node<<1;
	ll right=left+1;
	ll mid=(b+e)>>1;

	return __gcd(query(left,b,mid,i,j),query(right,mid+1,e,i,j));
}
int main(){
	ll n;
	sfl(n);
	for(ll i=1;i<=n;i++){
		sfl(a[i]);
	}

	build(1,1,n);

	for(ll i=1;i<=n;i++){
		ans=max(ans,__gcd(query(1,1,n,1,i-1),query(1,1,n,i+1,n)));
	}

	pfl(ans);
}



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

int main(){
    /*input*/
    string s;
    cin >> s;
    //int year = stoi(s.substr(0,4));
    int month = stoi(s.substr(5,2));
    //int day = stoi(s.substr(8,2));

    /*evaluate*/
    string ans;
    if(month > 4)
        ans = "TBD";
    else
        ans = "Heisei";

    /*output*/
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
n = int(readline())
A = []
B = []
AB = []
for i in range(n):
    a, b = map(int, readline().split())
    A.append(a)
    B.append(b)
    AB.append(a+b)
AB.sort()
ans = -sum(B) + sum(AB[::-2])
print(ans)


Measured memory_bytes: 15392
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"def solve():\n"
"  I=lambda:map(int,input().split())\n"
"  N,W=I()\n"
"  g={}\n"
"  for _ in[0]*N:\n"
"    a,b=I()\n"
"    g[a]=g.get(a,[])+[b]\n"
"  *w,=g.keys()\n"
"  v=[]\n"
"  for i in range(len(w)):\n"
"    s=[0]+sorted(g[w[i]])[::-1]\n"
"    for i in range(1,len(s)):\n"
"      s[i]+=s[i-1]\n"
"    v.append(s)\n"
"  for _ in[0]*(4-len(w)):\n"
"    w.append(10**18)\n"
"    v.append([0])\n"
"  ans=0\n"
"  for i in range(len(v[0])):\n"
"    s0=w[0]*i\n"
"    for j in range(len(v[1])):\n"
"      s1=s0+w[1]*j\n"
"      if s1>W:break\n"
"      for k in range(len(v[2])):\n"
"        s2=s1+w[2]*k\n"
"        if s2>W:break\n"
"        l=min((W-s2)//w[3],len(v[3])-1)\n"
"        ans=max(ans,v[0][i]+v[1][j]+v[2][k]+v[3][l])\n"
"  print(ans)\n"
"if __name__=='__main__':\n"
"  solve()\n"
"\"";
  system(s);
  return 0;
}            

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

#define __m int mid=(l+r)>>1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

template<class T>
inline bool rd(T &num) {
    char in;
    bool IsN = false;
    while(in = getchar(), in != '-' && (in < '0' || in > '9'))if(in == EOF)return false;
    in == '-' ? (IsN = true, num = 0) : num = in - '0';
    while(in = getchar(), in >= '0' && in <= '9')num = num * 10 + in - '0';
    return IsN ? num = -num : num, true;
}

#define rep(i,a,b) for(register int i = (a); i< (b); i++)
#define per(i,a,b) for(register int i = (a); i> (b); i--)
#define clr(a) memset(a,0,sizeof(a));
#define inf(a) memset(a,0x3f,sizeof(a));
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rd2(a,b) rd(a)&&rd(b)
#define rd3(a,b,c) rd(a)&&rd(b)&&rd(c)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

string nico;
#ifdef LOCAL
#define bug(x) cout<<#x<<" : "<<x<<endl
#define infile(x) freopen(x,"r",stdin)
#define outfile(x) freopen(x,"w",stdout)
#else
#define bug(x)
#define infile(x)
#define outfile(x)
#endif

const int maxn = 2e5 + 7;
const int inf  = 0x3f3f3f3f;
const LL linf  = (LL)inf << 32 | inf;
const int mod  = 1e9 + 7;

LL num[maxn];
int main() {
    IO;
    int n;
    cin>>n;
    rep(i,1,n+1){
        cin>>num[i];
        num[i]-=i;
    }
    sort(num+1,num+n+1);
    LL mid1 = num[(n+1)/2],mid2=num[(n+1)/2+1],mid3 = (num[(n+1)/2] + num[(n+1)/2+1])/2;
    LL ans1=0,ans2=0,ans3=0;
    rep(i,1,n+1){
        ans1 += abs(num[i]-mid1);
        ans2 += abs(num[i]-mid2);
        ans3 += abs(num[i]-mid3);
    }
    ans1 = min(ans1,min(ans2,ans3));
    cout<<ans1<<endl;
        
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod2=998244353;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll spf[10005];
void sieve()
{
  for(int i=1;i<10005;i++)
  spf[i]=i;
  for(int i=2;i*i<=10005;i++)
  if(spf[i]==i)
  for(int j=2*i;j<10005;j+=i)
  spf[j]=min(spf[j],(ll)(i));
}

int main(){
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   ll k;
   cin>>k;
   ll cur=7%k,curi=1,ten=10,sev=7;
   bool poss=false;
   map<ll,ll>m;
   for(int i=0;i<=k;i++){
     if(cur==0){
       poss=true;
       break;
     }
     if(m[cur])
     {
       poss=false;
       break;
     }
     m[cur]++;
     cur*=ten;
     cur%=k;
     cur+=sev;
     cur%=k;
     curi++;
   }
   if(poss)
   cout<<curi;
   else
   cout<<-1;
}


Measured memory_bytes: 66140
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    if(S.equals("ABC")) {
      System.out.println("ARC");
    } else if(S.equals("ARC")) {
      System.out.println("ABC");
    }
  }
}

Measured memory_bytes: 35768
let (a, b) = Scanf.scanf "%d %d\n" (fun a b -> a, b)
 
let () =
  print_int @@ a / b; print_string " ";
  print_int @@ a mod b; print_string " ";
  let f = (float_of_int a) /. (float_of_int b) in
  Printf.printf "%f\n" f

Measured memory_bytes: 2436
#include <stdio.h>
#include <string.h>

typedef struct {
	int a;
	int b;
} pass_t;

static int Count;

static void route(pass_t *pass, int M, int N, char history[8], int target);

int main(int argc, char *argv[])
{
	int i, N, M;
	pass_t pass[28];
	char history[8] = {0};

	scanf("%d %d", &N, &M);
	for ( i = 0; i < M; i++ ){
		scanf("%d %d", &pass[i].a, &pass[i].b);
	}
	route(pass, M, N, history, 1);
	printf("%d\n", Count);
	return 0;
}

static void route(pass_t *pass, int M, int N, char history[8], int target)
{
	char h[8];
	int i;

	if ( history[ target - 1 ]  == 1 ){
		return;
	}
	memcpy(h, history, 8);
	h[ target - 1] = 1;

	for ( i = 0; i < N; i++ ){
		if ( h[i] != 1 ){
			break;
		}
	}
	if ( i == N ){
		Count++;
	}

	for ( i = 0; i < M; i++ ){
		if ( pass[i].a == target ){
			route(pass, M, N, h, pass[i].b);
		} else if (pass[i].b == target ){
			route(pass, M, N, h, pass[i].a);
		}
	}
}


Measured memory_bytes: 128
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x, k, d = map(int, readline().split())
    cur = abs(x)
    rem = k
    cnt = min(cur // d, k)
    cur -= cnt * d
    rem -= cnt
    if rem % 2 == 0:
        ans = cur
    else:
        ans = abs(cur - d)

    print(ans)

if __name__ == '__main__':
    main()


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


def main():
    h, w = map(int, input().split())
    n = int(input())
    a = list(map(int, input().split()))
    i = 0
    ans = [[0 for _ in range(w)] for _ in range(h)]

    # 一筆書きの要領で，a[i]の数だけ数字を順番に埋めていく
    for hi in range(h):
        for wi in range(w):
            if a[i] == 0:
                i += 1

            ans[hi][wi] = i + 1
            a[i] -= 1

    # 出力のときに，奇数番目の行(0-index)だけ反転させる
    for index, a in enumerate(ans):
        if index % 2 == 1:
            a = a[::-1]

        print(' '.join(map(str, a)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<algorithm>

#define MAX_N 1000005

using namespace std;
int k;
unsigned long n;
int ranks[MAX_N + 1];
int tmp[MAX_N + 1];
int sa[MAX_N + 1];

bool compare_sa(int i, int j){
    if(ranks[i] != ranks[j]){
        return ranks[i] < ranks[j];
    } else {
        int ri =( i + k <= n )? ranks[i + k] : -1;
        int rj =( j + k <= n )? ranks[j + k] : -1;
        return ri < rj;
    }
    return true;
}

void construct_sa(string s,int* sa)
{
    n = s.length();
    
    for(int i = 0; i <= n;++i)
    {
        sa[i] = i;
        ranks[i] = i < n ? s[i] : -1;
    }
    
    for(k = 1;k <= n ; k *= 2)
    {
        sort(sa,sa + n + 1,compare_sa);
        
        tmp[sa[0]] = 0;
        for(int i = 1; i <= n; ++i)
        {
            tmp[sa[i]] = tmp[sa[i -1]] + (compare_sa(sa[i - 1],sa[i]) ? 1 : 0);
        }
        for(int i = 0;i <= n;++i)
        {
            ranks[i] = tmp[i];
        }
    }
}

bool contain(string s,int* sa, string t)
{
    unsigned long a = 0;
    unsigned long b = s.length();
    while(b - a > 1)
    {
        unsigned long c = (a + b) / 2;
        
        if(s.compare(sa[c],t.length(),t) < 0) a = c;
        else b = c;
    }
    
    return (s.compare(sa[b], t.length(),t) == 0);
    
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string S;
    int N;
    
    cin >> S;
    cin >> N;
    
    construct_sa(S,sa);
    
    for(int i = 0 ;i < N;++i)
    {
        string T;
        cin >> T;
        if(contain(S,sa,T)) cout << 1 << endl;
        else cout << 0 << endl;
    }
}



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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

double XS,YS,XT,YT;
int N;
struct barrier{
	double x,y,r;
};
double min_cost [1000];
const double INF = 1e30;

double distance(double x1,double y1,double x2,double y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

void dijkstra(vector<barrier>& B)
{
	priority_queue< pair<double,int>,vector< pair<double,int> >,greater< pair<double,int> > > pq;
	FOR(i,0,N){
		pq.push({max(0.0,distance(XS,YS,B [i].x,B [i].y) - B [i].r),i});
	}

	while(pq.empty() == false){
		double cost = pq.top().first;
		int curr = pq.top().second;
		pq.pop();

		if(min_cost [curr] <= cost) continue;
		min_cost [curr] = cost;

		FOR(i,0,N) if(i != curr){
			pq.push({cost + max(0.0,distance(B [curr].x,B [curr].y,B [i].x,B [i].y) - B [curr].r - B [i].r),i});
		}
	}
}

int main()
{
	scanf("%lf%lf%lf%lf",&XS,&YS,&XT,&YT);
	scanf("%d",&N);

	vector<barrier> B(N);
	FOR(i,0,N){
		scanf("%lf%lf%lf",&B [i].x,&B [i].y,&B [i].r);
	}

	fill_n(min_cost,N,INF);
	dijkstra(B);

	double ans = distance(XS,YS,XT,YT);
	FOR(i,0,N){
		chmin(ans,min_cost [i] + max(0.0,distance(B [i].x,B [i].y,XT,YT) - B [i].r));
	}

	printf("%.10f\n",ans);

	return 0;
}


Measured memory_bytes: 16748
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include<regex>
#include <unordered_map>  

using namespace std;

//conversion
//------------------------------------------
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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)


//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int n, m, q, l[200009], r[200009], x[509][509], c[509][509];

int main() {
	//入力受け取り、2次元座標にプロット
	cin >> n >> m >> q;
	for (int i = 1; i <= m; i++) {
		cin >> l[i] >> r[i]; x[l[i]][r[i]]++;
	}

	//行ごとに累積和を計算しておく。
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)c[i][j] = c[i][j - 1] + x[i][j];
	}
	
	//クエリが着たら。pからqまで各行の和を累積和を使って計算して足し上げていく。
	for (int i = 1; i <= q; i++) {
		int p, q; cin >> p >> q;
		int sum = 0;
		for (int j = p; j <= q; j++)sum += c[j][q] - c[j][p - 1];
		cout << sum << endl;
	}


	return 0;
}

Measured memory_bytes: 4480
fn main() {
    let n = read::<usize>();
    let mut v = read_vec::<i64>();
    for i in 0..n {
        v[i] = v[i] - (i + 1) as i64;
    }
    v.sort();
    let med1 = v[n / 2];
    let med2 = if n > 1 { v[n / 2 + 1] } else { v[0] };

    //println!("{:?}", v);

    let mut ans = 1000000000000000000;
    for b in vec![med1, med2] {
        let mut sad = 0;
        for i in 0..n {
            sad += (v[i] - b).abs();
        }
        //println!("{}: {}", b, sad);
        ans = std::cmp::min(ans, sad);
    }
    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 8444
#include <stdio.h>
int main(){
    int in; //入力
    int h=0; //時
    int m=0; //分
    int s=0; //秒

    scanf("%d",&in);

    while(in>=3600){ //時を決定
    in -= 3600;
    h++;
    }

    while(in>=60){ //分を決定
    in -= 60;
    m++;
    }

    s = in; //余りが秒

    printf("%d:%d:%d\n",h,m,s);
}


Measured memory_bytes: 2108
// ※※※ 解説理解不能パターン. ※※※
// ABC 139解説.
// https://img.atcoder.jp/abc139/editorial.pdf
// -> 解説の再現が出来なかったため, 以下のソースコードを復習する.
// kmjp氏.
// https://atcoder.jp/contests/abc139/submissions/7263904
#include <bits/stdc++.h>
using namespace std;
#define FOR(x, to) for(int x = 0; x < (to); x++)

deque<int> A[1010];
int step[1010];

int main(){
    int N;
    scanf("%d", &N);
    FOR(i, N){
        FOR(j, N - 1){
            int x;
            scanf("%d", &x);
            A[i].push_back(x - 1);
        }
    }
    int M = N * (N - 1) / 2;
    queue<int> Q;
    FOR(i, N) Q.push(i);
    int num = 0;
    while(Q.size()){
        int ok = 0;
        queue<int> Q2;
        while(Q.size()){
            int i = Q.front();
            Q.pop();
            if(step[i] <= num && A[i].size() && A[A[i].front()].front() == i && step[A[i].front()] <= num) {
                step[i] = step[A[i].front()] = num + 1;
                Q2.push(i);
                Q2.push(A[i].front());
                A[A[i].front()].pop_front();
                A[i].pop_front();
                M--;
            }
        }
        num++;
        if(M == 0) break;
        swap(Q, Q2);
    }
    if(M) printf("%d\n", -1);
    else  printf("%d\n", num);
    return 0;
}

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

int main() {
  int N, D, counter=0;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  for (int i=0; i<N; i++) {
    for (int j=0; j<D; j++) {
      cin >> X.at(i).at(j);
    }
  }
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      if (i != j) {
        double distance = 0.0;
        for (int k=0; k<D; k++) {
          distance += pow(X.at(i).at(k)-X.at(j).at(k), 2);
        }
        distance = sqrt(distance);
        if (ceil(distance) == floor(distance)) {
          counter++;
        }
      }
    }
  }
  cout << counter/2 << endl;
}

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

using namespace std;

const int N = 52;
long long x[N];
long long y[N];

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

    int n, k;
    cin >> n >> k;

    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    long long ans = 4200000000000000000LL;
    for (int l = 0; l < n; l++) {
        for (int r = 0; r < n; r++) {
            if (x[r] < x[l]) {
                continue;
            }
            for (int b = 0; b < n; b++) {
                for (int t = 0; t < n; t++) {
                    if (y[t] < y[b]) {
                        continue;
                    }
                    int cnt = 0;
                    for (int q = 0; q < n; q++) {
                        if (x[q] >= x[l] && x[q] <= x[r] && y[q] >= y[b] && y[q] <= y[t]) {
                            cnt++;
                        }
                    }
                    if (cnt >= k) {
                        long long cand = (x[r] - x[l]) * (y[t] - y[b]);
                        if (cand < ans) {
                            ans = cand;
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
point = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                if max(l[i],l[j],l[k])*2 < l[i]+l[j]+l[k]:
                    point += 1

print(point)

Measured memory_bytes: 8936
package main

import (
	"fmt"
	"sort"
)

type element struct {
	i int
	n int
}

type elements struct {
	s []element
}

func (r elements)Len() int { return len(r.s) }
func (r elements)Less(i, j int) bool { return r.s[i].n > r.s[j].n }
func (r elements)Swap(i, j int) { r.s[i], r.s[j] = r.s[j], r.s[i] }

func main() {
	var N int
	fmt.Scanf("%d", &N)
	as := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &as[i])
	}

	es := make([]element, N)
	for i, a := range as {
		es[i] = element{i, a}
	}
	sort.Sort(elements{es})

	for i := 0; i < N; i++ {
		for _, e := range es {
			if e.i != i {
				fmt.Println(e.n)
				break
			}
		}
	}
}


Measured memory_bytes: 9600
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    vi data(N); F0R(i, N) cin >> data[i];
    sort(all(data));
    ll ans = 0;
    F0R(i, N) {
        FOR(j, i+1, N) {
            ans += lb(all(data), data[i] + data[j]) - ub(all(data), data[j] - data[i]);
            ans--;
            if (data[i] * 2 > data[j]) ans--;
        }
    }

    cout << ans/3 << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
S = list(input().split())
stack = []
for s in S:
    if s.isnumeric():
        stack.append(int(s))
    else:
        n2 = stack.pop(len(stack) - 1)
        n1 = stack.pop(len(stack) - 1)
        if s == '+':
            stack.append(n1 + n2)
        elif s == '-':
            stack.append(n1 - n2)
        elif s == '*':
            stack.append(n1 * n2)
print(stack[0])



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

void Main() {
  int n;
  string s;
  cin >> n >> s;

  if (n % 2 != 0) {
    cout << "No" << endl;
    return;
  }
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[i + n / 2]) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
nt = []
nt = list(map(int, input().split()))

grid = []
for i in range(nt[0]):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)

c = 1001
for pair in grid:
    if pair[1] <= nt[1]:
        if pair[0] < c:
            c = pair[0]

if c == 1001:
    print('TLE')
else:
    print(c)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    string s;
    cin >> s;
    for (char &ch : s) {
        ch = 'x';
    }
    cout << s << '\n';
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 5;
typedef long long ll;
const ll p = 37;
unordered_map<ll, int> mp;
ll power[maxn], hashing[maxn];
void get_hash(string &s) {
	power[0] = 1;
	for (int i = 1; i < maxn; ++i)
		power[i] = power[i - 1] * p;
	for (int i = 1; i <= s.length(); ++i)
		hashing[i] = hashing[i - 1] + (s[i - 1] - 'a' + 1) * power[i - 1];
}
bool check(int len, string &s) {
	for (int i = len; i <= s.length(); ++i) {
		ll cur = (hashing[i] - hashing[i - len]) * power[s.length() - i];
		int pos = mp[cur];
		if (pos) {
			if (i - pos >= len)
				return true;
		}
		else
			mp[cur] = i;
	}
	mp.clear();
	return false;
}
int bi_search(string &s) {
	int left = 1, right = s.length(), res = 0;
	while (left <= right) {
		int mid = (left + right) / 2;
		if (!check(mid, s))
			right = mid - 1;
		else {
			res = mid;
			left = mid + 1;
		}
	}
	return res;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n; string s;
	cin >> n >> s;
	get_hash(s);
	cout << bi_search(s) << '\n';
	return 0;
}

Measured memory_bytes: 1536
#![allow(unused_imports)]
use proconio::marker::*;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
    }

    let res = solve(n);
    println!("{}", res);
}

fn solve(n: usize) -> usize {
    n * (n - 1) / 2
}


Measured memory_bytes: 2152
class Unionfind():

    def __init__(self, n):
        self.par = [-1]*n

    def find(self, x):
        if(self.par[x] < 0):
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return False
        if self.par[x]>self.par[y]:
            x,y = y,x
        self.par[x]+=self.par[y]
        self.par[y] = x
        return True

    def size(self,x):
        return -self.par[self.find(x)]

    def count_group():
        c = 0
        for i in range(len(self.par)):
            if self.par[i]<0:
                c+=1
        return c

n,m = map(int, input().split())
a = []
for i in range(m):
    b = list(map(int, input().split()))
    b[0]-=1
    b[1]-=1
    a.append(b)
ans = 0
for i in range(m):
    uf = Unionfind(n)
    for j in range(m):
        if i==j:
            continue
        uf.union(a[j][0],a[j][1])
    if uf.same(a[i][0],a[i][1]):
        continue
    else:
        ans+=1
print(ans)

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

public class Main {

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

	    int N=gi();
	    int[] D=new int[N];

	    for (int i=0; i<N;i++) {
	    	D[i]=gi();
	    }

	    Arrays.parallelSort(D);

	    int c= D[N/2] - D[N/2 -1];

	    System.out.println(c);

	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
}

Measured memory_bytes: 60228
// VABC049_D
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18

class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.resize(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

template <class T>
void printVec(vector <T> &vec) {
    size_t len = vec.size();
    REP(i, len) {
        if (i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N, K, L, p, q;
    cin >> N >> K >> L;
    vector<ll> res(N, 1);
    UnionFind Road(N), Rail(N);
    REP(i, K) {
        cin >> p >> q; --p; --q;
        Road.merge(p, q);
    }
    
    REP(i, L) {
        cin >> p >> q; --p; --q;
        Rail.merge(p, q);
    }
    
    // 道路でも電車でも連結してる
    // 根が同じ
    map<pair<ll, ll>, ll> mp;
    REP(i, N) mp[{Road.root(i), Rail.root(i)}]++;
    REP(i, N) cout << mp[{Road.root(i), Rail.root(i)}] << " ";
    cout << endl;
    
    return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

vector<vector<llong> > memo;
string S;
llong S_size;

llong mpow(llong num, llong beki = 12) {
	if (beki == 1) return num;

	llong ret = mpow(num, beki/2);
	ret = ret * ret % 13;
	if (beki & 1)
		ret = ret * num % 13;

	return ret;
}

llong dp(llong now, llong m) {
	if (now == -1) return m == 0;

	if (memo[now][m] != -1)
		return memo[now][m];

	llong ret = 0;
	if (S[now] == '?') {
		for (int i = 0; i <= 9; ++i) {
			ret = (ret + dp(now-1, (m-i+13)%13*4%13)) % mod;
		}
	} else {
		llong num = S[now] - '0';
		ret = (ret + dp(now-1, (m-num+13)%13*4%13)) % mod;
	}

	return memo[now][m] = ret;
}

int main() {
	cin >> S;
	S_size = S.size();

	memo.resize(S_size, vector<llong>(13, -1));
	cout << dp(S_size-1, 5) << endl;

	return 0;
}

Measured memory_bytes: 21504
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n ; 
	cin >> n ;
	int cnt = 0 ; 
	int mn = MOD;
	while(n--){
		int a ;
		cin >> a ;
		cnt+=(a<mn);
		mn = min(a,mn);
	}
	cout << cnt << endl;
}


signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3624
n,m,c=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
a = []
for i in range(n):
  a.append([int(j) for j in input().split()])

cnt = 0
for i in range(n):
  seki = [i*j for i,j in zip(a[i],b)]
  wa = sum(seki)
  r = wa + c
  if r > 0:
    cnt+=1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define de(c) cout << #c << " = " << c << endl
#define dd(c) cout << #c << " = " << c << " "
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}());
const ll mod=100000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 200023;
int T;
int n;
int x;
int y;


int main(int argc, char const *argv[])
{
#ifdef indiewar
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    cin >> T;
    T =1;
    while(T--)
    {
        cin >> x >> y;
        int f = 0;
        rep(i,1,10011)
        {
            int a = i * 0.08;
            int b = i * 0.1;
            if(a == x && b == y)
            {
                f = 1;
                cout << i << endl;
                break;
            }
        }
        if(f == 0)
            cout << -1 <<endl;

    }
    return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    long n,k,q; cin >> n >> k >> q;
    vector<long> point(n,k);
    vector<long> A(q,0); 
    rep(i,q)cin >> A[i];
    rep(i,q){
        ++point[A[i]-1];
    }
    rep(i,n){
        if(point[i]<=q) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (auto&& e : h) {
    cin >> e;
  }

  vector<int> cost(n);
  cost[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; ++i) {
    int c1 = cost[i - 1] + abs(h[i] - h[i - 1]);
    int c2 = cost[i - 2] + abs(h[i] - h[i - 2]);
    cost[i] = min(c1, c2);
  }

  cout << cost[n - 1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <vector>
#include <functional>

using namespace std;
typedef long long ll;

ll INF = 1LL * 1e14;

int main(void) {
    int N;
    cin >> N;
    vector<int> a(3*N);
    vector<ll> a_total(2*N), b_total(2*N);
    priority_queue<ll, vector<ll>, greater<ll> > q_a;
    priority_queue<ll> q_b;
    for(int i=0; i<3*N; i++) {
        cin >> a[i];
        if(i < N) {
            a_total[0] += a[i];
            q_a.push(a[i]);
        }
        else if(i >= 2*N) {
            b_total[0] += a[i];
            q_b.push(a[i]);
        }
    }

    for(int i=1; i<=N; i++) {
        q_a.push(a[N-1+i]);
        a_total[i] = a_total[i-1] + a[N-1+i] - q_a.top();
        q_a.pop();
        q_b.push(a[2*N-i]);
        b_total[i] = b_total[i-1] + a[2*N-i] - q_b.top();
        q_b.pop();
    }

    ll ans = -INF;
    for(int i=0; i<=N; i++) ans = max(ans, a_total[i] - b_total[N-i]);
    printf("%lld\n", ans);
return 0;
}

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

const int MAX_N = 1e5 + 5;
const lint MOD = 1e9 + 7;
lint dp[MAX_N][4];
string S;

int main(){
    cin >> S;

    lint cur = 1;
    for(int i=0;i<S.size();i++){
        for(int j=0;j<3;j++){
            dp[i+1][j] = dp[i][j];
            if(S[i] == '?') dp[i+1][j] *= 3;
            if(j == 0 && (S[i] == 'A' || S[i] == '?')) dp[i+1][j] += cur;
            else if(j == 1 && (S[i] == 'B' || S[i] == '?')) dp[i+1][j] += dp[i][0];
            else if(j == 2 && (S[i] == 'C' || S[i] == '?')) dp[i+1][j] += dp[i][1];
            dp[i+1][j] %= MOD;
        }
        if(S[i] == '?') cur = cur * 3 % MOD;
    }

    cout << dp[S.size()][2] << endl;
    return 0;
}


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

void Main()
{
    long w, h;
    cin >> w >> h;
    if(h == 1 || w == 1)
        cout << 1 << endl;
    else
        cout << (w*h+1)/2 << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
	long long n;
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	n=max(a*c,a*d);
	n=max(n,b*c);
	n=max(n,b*d);
	cout<<n<<endl;
}

Measured memory_bytes: 3636
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    s = input()
    q = I()
    K = LI()
    for k in K:
        ans = 0
        sa = 0
        sb = 0
        ns = 0
        for i in range(n):
            if i >= k:
                j = i-k
                if s[j] == "D":
                    sa -= 1
                    ns -= sb
                elif s[j] == "M":
                    sb -= 1
            if s[i] == "D":
                sa += 1
            elif s[i] == "M":
                sb += 1
                ns += sa
            elif s[i] == "C":
                ans += ns
        print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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

using namespace std;


int answer=0;

int main(){
 int n;
 cin>>n;
 int now=0;
 
 
 for(int i=1;i<=n;i++){
    int a=i;
    int times=0;
    
    

    while(a%2==0){
        ++times;
         a/=2;
      }
    if(now<=times){
       now=times;
       answer=i;
    }
     }
cout<<answer<<endl;
  return 0;
       }

 
  
  



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

using namespace std;
using ll = long long;

#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)

int main()
{
    ll A, B;
    cin >> A >> B;

    ll ans = -1;
    if (A <= 9 && B <= 9)
    {
        ans = A * B;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 45

int main(){
  int i,n,F[N];

  scanf("%d",&n);

  F[0]=F[1]=1;

  for(i=2;i<=n;i++){
    F[i]=F[i-1]+F[i-2];
  }

  printf("%d\n",F[n]);

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, sum = 0; cin >> N;
  map<ll, int> num;
  for(int i = 0; i < N; i++) {
    int x; cin >> x;
    if(num.count(x)) num.at(x)++;
    else num[x] = 1;
    if(num.at(x) % 2 == 1) sum++;
    else sum--;
  }
  cout << sum << endl;
}

Measured memory_bytes: 6528
import math

# input
K = int(input())

# process
gcdl = []
for i in range(K):
    l = []
    for j in range(K):
        l.append(math.gcd(i+1, j+1))
    gcdl.append(l)
# print(gcdl)

ans = 0
for a in range(K):
    for b in range(a, K):
        for c in range(b, K):
            # print([a, b, c])
            if a == c:
                ans += a+1
            elif b == c:
                ans += gcdl[a][b]*3
            elif a == b:
                ans += gcdl[a][c]*3
            else:
                t = gcdl[a][b]
                t = gcdl[t-1][c]
                ans += t*6

# output
print(ans)


Measured memory_bytes: 9436
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define PI 3.14159265
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(ll &a,ll b){
	a = min(a,b);
}
int main(){
	int n; cin >> n;
	int ans = 0;

	if(n&1){
		cout << n/2 << endl;
	}else{
		cout << n/2-1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
/** source code by coolreshab **/

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

#define MAX 100000
#define MAX1 100000
#define inf 1000000000
#define mod 1000000007
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
  	//begin
    int K,A,B,t;
    ll ans=1;
    cin>>K>>A>>B;
    if(B-A>2)
    {
        t=min(K,A-1);
        K-=t;
        ans+=t;
        if(K)
        {
            if(K&1)
            {
                ans+=1LL*(K/2)*(B-A);
                ans++;
            }
            else
                ans+=1LL*(K/2)*(B-A);
            cout<<ans;
        }
        else
            cout<<ans;
    }
    else
        cout<<K+1;
    //end

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
long long int gcd(long long int x, long long int y){
  return y!=0 ? gcd(y, x%y) : x;
}
long long int lcm(long long int x, long long int y){
  return x*y/gcd(x, y);
}
int main(){
  int i, j, sx, sy, tx, ty, x, y;
  cin >> sx >> sy >> tx >> ty;
  x=tx-sx;
  y=ty-sy;
  for(i=0; i<y; i++)
    cout << 'U';
  for(i=0; i<x; i++)
    cout << 'R';
  for(i=0; i<y; i++)
    cout << 'D';
  for(i=0; i<x+1; i++)
    cout << 'L';
  for(i=0; i<y+1; i++)
    cout << 'U';
  for(i=0; i<x+1; i++)
    cout << 'R';
  cout << "DR";
  for(i=0; i<y+1; i++)
    cout << 'D';
  for(i=0; i<x+1; i++)
    cout << 'L';
  cout << 'U';
  return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;
int main() {
	int n, a;
	cin >> n;
	long long sum = 0;
	int	min = 1000000, max = -1000000;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (min > a)min = a;
		if (max < a)max = a;
		sum += a;
	}
	cout << min << " " << max << " " << sum << endl;
	return 0;
}

Measured memory_bytes: 1168
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <vector>

using namespace std;

#define R register
#define ll long long

const int MAXN=100+5;
const int MAXM=MAXN<<1;
const ll inf=(1ll<<60);

inline int min(int x,int  y) { return x<y?x:y; }
inline int max(int x,int  y) { return x>y?x:y; } 

int n;
int du[MAXN];

vector<int> Edge[MAXN];

inline void add(int x,int y)
{
	Edge[x].push_back(y);
	Edge[y].push_back(x);
}

inline void init()
{
	scanf("%d",&n);
	for(R int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		add(x,y);du[x]++;du[y]++;
	}
}

int ans1=1e9;
ll ans2=inf;
int dep[MAXN];
int son[MAXN];

inline void dfs1(int x,int fx)
{
	for(R int i=0;i<Edge[x].size();i++)
	{
		int y=Edge[x][i];
		if(y==fx) continue;
		son[x]++;
		dep[y]=dep[x]+1;
		dfs1(y,x);
	}
}

int md[MAXN];

inline void cal()
{
	int maxd=0;
	for(R int i=1;i<=n;i++) maxd=max(maxd,dep[i]);
	memset(md,0,sizeof(md));
	ll cnt=0;
	for(R int i=1;i<=n;i++)
	{
		md[dep[i]]=max(md[dep[i]],son[i]);
		if(dep[i]==1) cnt++;
	}
	for(R int i=1;i<maxd;i++) cnt=cnt*md[i];
	if(maxd<ans1) ans1=maxd,ans2=inf;
	if(maxd==ans1&&cnt<ans2) ans2=cnt;
}

inline void solve1() 
{
	for(R int i=1;i<=n;i++)
	{
		memset(son,0,sizeof(son));
		dep[i]=1;
		dfs1(i,0);
		cal();
	}
}

inline void dfs2(int x,int fx)
{
	for(R int i=0;i<Edge[x].size();i++)
	{
		int y=Edge[x][i];
		if(y==fx) continue;
		memset(son,0,sizeof(son));
		dep[x]=dep[y]=1;
		dfs1(x,y);dfs1(y,x);
		cal();
		dfs2(y,x);
	}
}

inline void solve2() { dfs2(1,0); }

inline void work() { solve1(); solve2();}

int main()
{
	init();
	work();
	for(R int i=1;i<=n;i++) //枚举直径端点加点
		if(du[i]==1)
		{
			Edge[i].push_back(++n);
			work();
			Edge[i].pop_back();
			n--;
		}
	printf("%d %lld\n",ans1,ans2);
	return 0;
}

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

#define ll long long int
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp pke_pair
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define minv(a) *min_element(all(a))
#define pxv(a) *px_element(all(a))
#define br cout<<"\n"
using namespace std;



int dr[]={1,-1,0,0};
int dc[]={0,0,1,-1};
ll mod=1000000007;

ll ceil(ll x,ll y)
{
    if(x%y==0)
        return x/y;
    else
        return(x/y)+1;
}
ll binomialCoeff(int n, int k)
{
    ll res = 1;
    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
ll sm(ll n) {
	ll res = 0;
	while (n > 0) {
		res += n % 10;
		n /= 10;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   ll n;
   cin>>n;
   if(n>0) cout<<0;
   else cout<<1;


	return 0;
}


Measured memory_bytes: 3632