akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int main()
{
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  ll ans = 2*c*(max(x,y));
  REP(i,0,max(x,y)){
    ll dou = 2*c*i + +a*max(0,x-i) + b*max(0,y-i);
    ans = min(ans,dou);
  }

  cout << ans << endl;

  //--debug : end_stoper
  string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;
template<typename T> T factorial(T n){
    if(n==1) return 1;
    else return n*factorial(n-1)%MOD;
}
template<typename T> T Pow(T x, T n, T m){
    if(n == 0) return 1;
    if(n % 2 == 0) return Pow(x * x % m, n / 2, m);
    else return x * Pow(x, n - 1, m) % m;
}
template<typename T> T combination(T n, T k, T m){
    return factorial<T>(n) * Pow<T>(factorial(k), m-2, m) % m * Pow<T>(factorial(n-k), m-2, m) % m;
}
struct edge{
    int to; // 辺の行き先
    int weight; // 辺の重さ
};

using graph = vector<vector<edge>>;
using Graph = vector<vector<int>>;

vector<vector<int>> warshall_floyd(vector<vector<int>> c, int x, int y){
    for(int i=0; i<c.size(); i++){
        for(int j=0; j<c.size(); j++){
            c[i][j] = min(c[i][j], c[i][x] + c[x][y] + c[y][j]);
        }
    }
    return c;
}

int main(){
    int n, x, y; cin >> n >> x >> y;
    vector<vector<int>> d(n, vector<int>(n, inf));
    rep(i, n){
        int count = 0;
        for(int j=i; j < n; j++){
            d[i][j] = count;
            d[j][i] = count;
            count++;
        }
    }
    d[x-1][y-1] = 1;
    d = warshall_floyd(d, x-1, y-1);
    vector<int> ans(n, 0);
    rep(i, n){
        for(int j=i+1; j<n; j++){
            ans[d[i][j]] += 1;
        }
    }
    for(int i=1; i<n; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 31616
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <string>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
using namespace std;
 
int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> map(1000000);
  int maxp=0, minp=map.size()-1;
  int temp;
  for(int i=0; i<n; i++){
    cin >> temp;
    maxp = max(maxp, temp);
    minp = min(minp, temp);
    map[temp]++;
  }
  
  int count=0;
  for(int i=minp; i<=maxp; i++){
    if(map[i]==1){
      count++;
      for(int j=2; (j*i)<=maxp; j++){
        map[i*j] = -2;
      }
      continue;
    }
    if(map[i]>1){
      for(int j=2; (j*i)<=maxp; j++){
        map[i*j] = -2;
      }
    }
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 7168
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  string s;cin>>s;
  int x=s.length();
  bool a=true;
  rep(i,x-1){
    if(s[i]==s[i+1]) a=false;
  }
  if(a) cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;


}


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

typedef long long int int64;

#define POS(i,j) ((i)*(m+1)+(j))

void run(void){
  const int m=1000;
  int64 *dp=(int64 *)calloc((m+1)*10,sizeof(int64));
  dp[POS(0,0)]=1;
  int i,j,k;
  for(i=0;i<=100;i++){
    for(j=10;j>0;j--){
      for(k=m;k>=i;k--){
	dp[POS(j,k)]+=dp[POS(j-1,k-i)];
      }
    }
  }
  int n,s;
  scanf("%d%d",&n,&s);
  while(!(n==0 && s==0)){
    printf("%lld\n",dp[POS(n,s)]);
    scanf("%d%d",&n,&s);
  }
}

int main(void){
  run();
  return 0;
}



Measured memory_bytes: 2052
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] L = new int[n];
    int sum = 0;
    for(int i = 0; i < n; i++) {
      L[i] = sc.nextInt();
      sum += L[i];
    }
    Arrays.sort(L);
    String ans = "No";
    if(L[n - 1] < (sum - L[n - 1])) ans = "Yes";
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	string s; int k;
	cin >> s >> k;
	set<string> substrings;
	for (int i = 0; i < s.length(); ++i) {
		for (int j = 1; j <= k; ++j) {
			substrings.insert(s.substr(i, j));
		}
	}
	for (int i = 0; i < k - 1; ++i) {
		substrings.erase(substrings.begin());
	}
	cout << *substrings.begin() << endl;
}

Measured memory_bytes: 1664
from math import cos
from math import sin
from math import sqrt
from math import pi
from math import radians
A, B, H, M = map(int, input().split())
rad_long = (-360 * (M / 60) + 90)
rad_long = radians(rad_long)
rad_short = -30 * H - (M / 12) * 6 + 90
rad_short = radians(rad_short)
#print(rad_long, rad_short)

short_plot = [A * cos(rad_short), A * sin(rad_short)]
long_plot = [B * cos(rad_long), B * sin(rad_long)]
#print(short_plot)
#print(long_plot)

x = (short_plot[0] - long_plot[0])
y = (short_plot[1] - long_plot[1])
#print(x, y)

print(sqrt(x ** 2 + y**2))


Measured memory_bytes: 9584
#include<bits/stdc++.h>
using namespace std; 
#define max(a, b) (a < b ? b : a) 
#define min(a, b) ((a > b) ? b : a) 
#define mod 1e9 + 7 
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++) 
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++) 
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--) 
#define INF 1000000000000000003 
typedef long long int ll; 
typedef vector<int> vi; 
typedef pair<int, int> pi; 
#define F first 
#define S second 
#define pb push_back 
#define POB pop_back 
#define MP make_pair 

int main()

{
int a;
cin>>a;
cout<<a+pow(a,2)+pow(a,3)<<endl;

  return 0;

}

  



Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>
#include <sstream>
#include <iomanip>

using namespace std;


int main()
{
	int N, M;

	cin >> N >> M;

	vector<pair<int, int>> jobs(N);

	int a, b;
	for (int ni = 0; ni < N; ni++) {
		cin >> a >> b;
		jobs[ni] = make_pair(a,b);
	}

	sort(jobs.begin(), jobs.end());

	priority_queue< pair<int, int> > que;

	int ans = 0;
	int ni = 0;
	for (int di = 1; di <= M; di++) {
		for (; ni < N; ni++) {
			if (jobs[ni].first <= di) {
				que.push(make_pair(jobs[ni].second, jobs[ni].first));
			}
			else {
				break;
			}
		}
		if (!que.empty()) {
			ans += que.top().first;
			que.pop();
		}
	}

	cout << ans;


	/*
	while ( !que.empty() ) {
		cout << que.top().first << "," << que.top().second << endl;
		que.pop();
	}
	*/

	return 0;
}



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

struct Card{ char suit, value; };

void printArray(struct Card A[], int N){
  for (int i = 0; i < N; i++) {
    std::cout << A[i].suit << A[i].value;
    if (i!=N-1) {
      std::cout << " ";
    }
  }
  std::cout <<'\n';
}


struct Card* bubbleSort(struct Card A[], int n){
  int flag=1;
  int cnt=0;
  int sorted_i=0;
  while (flag) {
    flag=0;
    for (int i = n-1; i > sorted_i; i--) {
      if(A[i-1].value > A[i].value){
        std::swap(A[i-1], A[i]);
        cnt++;
        flag=1;
      }
    }
    sorted_i++;
  }
  return A;
}


struct Card* selectionSort(struct Card A[], int n){
  int min_j;
  int cnt=0;
  for (int i = 0; i < n; i++) {
    min_j = i;
    for (int j = i; j < n; j++) {
      if (A[j].value < A[min_j].value) {
        min_j = j;
      }
    }
    if(i!=min_j){
      std::swap(A[min_j], A[i]);
      cnt++;
    }
  }
  return A;
}

bool isStable(struct Card A[], struct Card B[], int n){
  for (int i = 0; i < n; i++) {
    if (A[i].suit != B[i].suit) {
      return false;
    }
  }
  return true;
}

int main(void){
  int n;
  std::cin >> n;
  Card* A = new Card[n];
  Card* B = new Card[n];

  for (int i = 0; i < n; i++) {
    std::cin >> A[i].suit >> A[i].value;
    B[i] = A[i];
  }

  A = bubbleSort(A,n);
  printArray(A,n);
  std::cout << "Stable" << '\n';

  B = selectionSort(B,n);
  printArray(B,n);


  if(isStable(A,B,n)){
    std::cout << "Stable" << '\n';
  }else{
    std::cout << "Not stable" << '\n';
  }


  return 0;
}



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

namespace AtCoderBeginnerContest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // A
            var line = Console.ReadLine().Split(' ');
            var A = int.Parse(line[0]);
            var B = int.Parse(line[1]);

            if (A + B >= 10) Console.WriteLine("error");
            else Console.WriteLine(A + B);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define For(i , j , k) for (int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i)
#define Fordown(i , j , k) for (int i = (j) , i##_end_ = (k) ; i >= i##_end_ ; -- i)
#define Set(a , b) memset(a , b , sizeof(a))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define Mod (1000000007)
#ifdef hany01
#define debug(...) fprintf(stderr , __VA_ARGS__)
#else
#define debug(...)
#endif 
using namespace std;
typedef long long LL;

inline void file()
{
#ifdef hany01 
	freopen("a.in" , "r" , stdin);
    freopen("a.out" , "w" , stdout);
#endif
}

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

char c_; int _ , __;
inline int read()
{
    for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-')  __ = -1;
    for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

const int maxn = 100010;

int n, a[maxn], b[maxn], c[maxn];
LL fb[maxn], Ans;

int main()
{
	file();
    n = read();
    For(i, 1, n) a[i] = read();
    For(i, 1, n) b[i] = read();
    For(i, 1, n) c[i] = read();
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n);
    sort(c + 1, c + 1 + n);
    For(i, 1, n) fb[i] = lower_bound(a + 1, a + 1 + n, b[i]) - a - 1 + fb[i - 1];
    For(i, 1, n) Ans += fb[lower_bound(b + 1, b + 1 + n, c[i]) - b - 1];
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))

int main(void){
	int n,t,a;
	scanf("%d",&n);
	scanf("%d %d",&t,&a);
	double h[n],anst,tmp;
	int ans=0;
	rep(i,n){
		scanf("%lf",&h[i]);
		tmp = a - (t-h[i]*0.006); //AとHiの差
		if(tmp<0) tmp=tmp*-1;
		if(i==0) anst=tmp; //anstの初期値
		if(tmp<=anst){
			anst=tmp;
			ans=i+1;
		}
	}
	printf("%d",ans);
	return 0;
}



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

int main(){
    int N;
    cin >> N;
    int rank = 0,mi = 2e9;
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        if(rank<a){
            rank = a;
            mi = b; 
        }
    }
    cout << rank+mi << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=2e3+20;
const int inf=2e5;
int sx,sy,tx,ty;
int main()
{
	while(cin>>sx>>sy>>tx>>ty)
	{
		//s->t->s->t 要求路径为最短路&&一个点只能经过一个次
		//sx<tx  sy<ty 方向为4个 则最短路为曼哈顿距离
		//构造即可 
		int dx=tx-sx,dy=ty-sy;
		for(int i=1;i<=dy;i++)
		cout<<'U';
		for(int i=1;i<=dx;i++)
		cout<<'R';
		for(int i=1;i<=dy;i++)
		cout<<'D';
		for(int i=1;i<=dx;i++)
		cout<<'L';
		
		
		cout<<'L';
		for(int i=1;i<=dy+1;i++)
		cout<<'U';
		for(int i=1;i<=dx+1;i++)
		cout<<'R';
		
		cout<<'D';
		cout<<'R';
		for(int i=1;i<=dy+1;i++)	
		cout<<'D';
		
		for(int i=1;i<=dx+1;i++)
		cout<<'L';
		
		cout<<'U'; 
		cout<<endl;
		 
	}	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<string> vs;

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

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

	ll N, TM; cin >> N >> TM;
	vl T(N); FOR(i, 0, N) cin >> T[i];

	ll ans = 0;
	FOR(i, 0, N-1) {
		ans += min(TM, T[i+1] - T[i]);
	}
	ans += TM;

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * 実装方針:
 * 
 * @author glycine
 *
 */
public class Main {
	int M;
	List<Pair> pairs = new ArrayList<>();
	long result = 0;

	static class Pair {
		long c;
		int d;

		Pair(String line) {
			String[] tokens = line.split(" ");
			this.d = Integer.parseInt(tokens[0]);
			this.c = Long.parseLong(tokens[1]);
		}
	}

	void calc() {
		// 桁の合計値を求める
		long ketaSum = 0;
		for (Pair pair : pairs) {
			ketaSum += pair.c;
		}
		ketaSum--;

		// 出現する値の合計値を求める
		long valSum = 0;
		for (Pair pair : pairs) {
			valSum += pair.c * pair.d;
		}
		// System.out.println(ketaSum + ", " + valSum);
		valSum = (valSum - 1) / 9;
		result = ketaSum + valSum;

	}

	void showResult() {
		System.out.println(result);
	}

	Main(BufferedReader in) throws IOException {
		this.M = Integer.parseInt(in.readLine());
		for (int i = 0; i < M; ++i) {
			this.pairs.add(new Pair(in.readLine()));
		}
	}

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

}

Measured memory_bytes: 65396
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define ll long long
#define cpp boost::multiprecision::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
const double PI = 3.1415926535897932384626433832795;
struct edge {
	int to;
	ll cost;
};
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int N;
	cin >> N;
	vector<ll> L(N + 1);
	L[0] = 2, L[1] = 1;
	for (int i = 2; i <= N; i++) {
		L[i] = L[i - 1] + L[i - 2];
	}
	cout << L[N] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc=new Scanner(System.in);

		int n= sc.nextInt();

		long cnt =0;

		int[] arr= new int[n];

		for(int i =0;i<n;i++) {
			arr[i]=sc.nextInt();
		}

		for(int j=0;j<n-1;j++) {
			if(arr[j+1]<arr[j]) {
				cnt+=arr[j]-arr[j+1];
				arr[j+1]=arr[j];

			}
		}
		System.out.println(cnt);
	}

}


Measured memory_bytes: 60404
#include <stdio.h>

int main(void) {
   
   int P,Q,R;
   
   scanf("%d%d%d",&P,&Q,&R);
   
   int ans = P + Q;
   
   if (ans > P + R) {
      ans = P + R;
   }
   
   if (ans > R + Q) {
      ans = R + Q;
   }
   
   printf("%d\n",ans);
   
   
   return 0;
}


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

int main(){
    int n,x=0;
    cin >> n;
    //vector<int> a(n-1),b(n);
    int a[n],b[n];
    rep(i,n-1)cin >> a[i];
    a[n-1]=1e6;
    rep(i,n)b[i] = 0;
    //sort(a.begin(),a.end());
    sort(a,a+n);
    rep(i,n){
        
            while(a[x]==i+1){
                x++;
                b[i]++;
            }
        
    }
    rep(i,n)cout << b[i] << endl;
	return 0;
}


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

using namespace std;

const int N = 1e5 + 9;

int n, m, k, a[N], used[N], num[N];

vector<int> G[N];

void dfs(int x) {
	used[x] = k; 
	num[a[x]] = k;
	for (int i = 0; i < G[x].size(); ++i) {
		int y = G[x][i];
		if (used[y]) continue;
		dfs(y);
	}
}

void solve() {
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		if (!used[i]) {
			k++;
			dfs(i);
		}
	}
	for (int i = 1; i <= n; ++i) {
		if (used[i] == num[i]) 
			ans++;
	}
	printf("%d\n", ans);
}

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; ++i) 
		scanf("%d", &a[i]);
	for (int i = 0, u, v; i < m; ++i) {
		scanf("%d %d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	solve();
	return 0;
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}

int x[10],y[10];

double dis (int i, int j){
    int dx = abs(x[i]-x[j]);
    int dy = abs(y[i]-y[j]);

    return  sqrt(dx*dx + dy*dy);
 }
 //あとで取る
 
 
int main(){
    int N;
    cin >> N;

    vector<int>A(N);

    rep(i,N){
        int a;
        cin >> a;
        A[a-1] = i+1;
    }

    for(auto x:A){
        cout << x << " "; 
    }
    cout << endl;
 
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>>;
using GraphEdge = vector<vector<int>>;
long long modinv(long long a, long long m=MOD) {long long b = m, u = 1, v = 0;while (b) {    long long t = a / b;    a -= t * b; swap(a, b);    u -= t * v; swap(u, v);}u %= m; if (u < 0) u += m;return u;}
//MODの割り算の際にa/＝b;をa *= modinv(b,MOD);とする。
int gcd(int a, int b){if (a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int main(){
    int N;cin >> N;
    if(N==2){
        int a,b;cin >> a >> b;
        cout << a + b << endl;
    }else{
        puts("Hello World");
    }
    return 0;
}

Measured memory_bytes: 3560
#include<stdio.h>
int main(void)
{
    int n,a[10000],b[10000],z=0,x=0,i;
	scanf("%d",&n);
	while(n!=0){
	    for(i=0;i<n;i++){
		    scanf("%d %d",&a[i],&b[i]);
		}
		for(i=0;i<n;i++){
		    if(a[i]>b[i]){
			    z=z+a[i]+b[i];
			}
			else if(a[i]<b[i]){
			    x=x+a[i]+b[i];
			}
			else{
			    z=z+a[i];
				x=x+b[i];
			}
		}
		printf("%d %d\n",z,x);
		z=0;
		x=0;
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 2628
#include<cstdio>
#include<iostream>
using namespace std;
int a,b,k[5],check[4];
int main(){
	for(register int i=1;i<=3;i++)
		scanf("%d%d",&a,&b),k[a]++,k[b]++;
	for(register int i=1;i<=4;i++)check[k[i]]++;
	if(check[1]==2&&check[2]==2)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
use std::collections::HashMap;
use std::io::stdin;

fn main() {
    let mut is = String::new();
    stdin().read_line(&mut is).ok();
    let mut itr = is.split_whitespace().map(|e| e.parse().unwrap());
    let h1: usize = itr.next().unwrap();
    let m1: usize = itr.next().unwrap();
    let h2: usize = itr.next().unwrap();
    let m2: usize = itr.next().unwrap();
    let k: usize = itr.next().unwrap();
    let t = (h2 - h1) * 60 + m2 - m1;

    println!("{}", t - k);
}


Measured memory_bytes: 2128
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
bool p[55555];
vector<int>prime;
int main(){
    rep(i,55555)p[i] = true;
    p[2] = true;
    vector<int>ans;
    for(int i = 2;i < 55555; i++){
        if(p[i]){
            if(i%5==4){
                ans.push_back(i);
            }
            for(int j = 2; i*j < 55555;j++){
                p[i*j] = false;
            }
        }
    }
    int n;
    cin >> n;
    rep(i,n){
        if(i!=n-1)cout << ans[i] << " ";
        else cout << ans[i] << endl;
    }
}

Measured memory_bytes: 384
def main():
  while True:
    n = int(input())
    if not n:
      break
  
    start = int(input()) - 1 #開始の位置
    goal = int(input()) - 1  #あたりの位置
    d = int(input())
    
    nums = [[i for i in range(n)]] #各段での数字の並び
    bars = [] #横棒リスト
    
    for i in range(d):
      s = input()
      bars.append(s)
      new = nums[-1][:]
  
      for j in range(n - 1):
        if s[j] == "1": #横棒があれば入れ替え
          new[j], new[j + 1] = new[j + 1], new[j]
  
      nums.append(new)
      
    to_goal = nums[-1][goal] #あたりにたどり着く初期位置
    
    if to_goal == start: #元からあたりにたどり着く場合
      print(0)
  
    else: #各段について、to_goalとスタートが隣り合うかチェック
      for i, status in enumerate(nums[1:]):
        to_goal_ind = status.index(to_goal) #to_goalの位置
        start_ind = status.index(start)     #startの位置
        ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)
    
        if ind2 - ind1 == 1:  #隣あっていた場合
          if (bars[i][ind1] == "0") and (ind1 == 0 or bars[i][ind1 - 1] == "0") and (ind2 == n - 1 or bars[i][ind2] == "0"):  #隣り合う横棒がなければ(入れ替え可能ならば)出力
            print(i + 1, ind1 + 1)
            break
      else:
        print(1)

main()


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  long double x[n];
  string u[n];
  long double sum = 0;
  for(int i=0;i<n;i++){
    cin >> x[i] >> u[i];
    if(u[i] == "JPY"){
      sum += x[i];
    }
    else{
      sum += 380000.0*x[i];
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n, m;
  cin >> n >> m;
  ll ans = min(n, m/2);
  m -= ans*2;
  ans += m/4;
  cout << ans << endl;
}


Measured memory_bytes: 256
import numpy as np


def check_bingo(A):
    for i in range(3):
        if np.all(A[i] == -1) or np.all(A[:, i] == -1):
            return 'Yes'
    if np.all(A[list(range(3)), list(range(3))] == -1) \
            or np.all(A[list(range(3)), list(range(3))[::-1]] == -1):
        return 'Yes'

    return 'No'


def main():
    A = np.array([list(map(int, input().split())) for _ in range(3)])
    n = int(input())
    for i in range(n):
        b = int(input())
        A = np.where(A == b, -1, A)
    ans = check_bingo(A)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27292
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int d;
	cin>>d;
	if(a<=b)
	swap(a,b);
	if(a<=c)
	swap(a,c);
	for(int i=1;i<=d;i++)
	a*=2;
	cout<<a+b+c;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
string to_string(string s) {
  return '"' + s + '"';
}
string to_string(const char* s) {
  return to_string((string) s);
}
string to_string(bool b) {
  return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)
#else
#define show(...) 42
#endif
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define  oo 1e15
#define limit 1000000007
#define two pair<int,int>
#define ll long long int
#define int long long int
#define mod(x,m) ((x%m+m)%m)
#define all(v) v.begin(),v.end()
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define fori(x,n) for(int i = x; i < n; i++)
#define forj(y,m) for(int j = y; j < m; j++)
#define fork(z,p) for(int k = z; k < p; k++)
#define speedforces std::ios::sync_with_stdio(false)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file  freopen("output.txt", "w", stdout);

signed main(){
  //input_from_file;
  speedforces;
  int n; cin>>n;
  vector<int> v(n+1);
  fori(1,n+1) cin>>v[i];
  int dp[n+1];
  memset(dp,0,sizeof dp);
  dp[1] = 0; dp[2] = abs(v[2]-v[1]);
  fori(3,n+1) dp[i] = min(abs(v[i]-v[i-1])+dp[i-1],abs(v[i]-v[i-2])+dp[i-2]);
  cout<<dp[n]<<endl;
 }


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
	
double dp[301][301][301];

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

	int n; cin >> n;
	vector<int> a(n);
	int o = 0, tw = 0, tr = 0;

	for (auto &i : a) {
		cin >> i;
		if (i == 1) o++;
		else if (i == 2) tw++;
		else tr++;
	}


	for (int k = 0; k < 301; ++k)
		for (int j = 0; k + j < 301; ++j)
			for (int i = 0; i + j + k < 301; ++i) {
				if (i + j + k == 0) continue;

				double w = 1.0 * n / (i + j + k);
				double pi = 1.0 * i / (i + j + k);
				double pj = 1.0 * j / (i + j + k);
				double pk = 1.0 * k / (i + j + k);

				if (i) dp[i][j][k] += dp[i - 1][j][k] * pi;
				if (j) dp[i][j][k] += dp[i + 1][j - 1][k] * pj;
				if (k) dp[i][j][k] += dp[i][j + 1][k - 1] * pk;
				dp[i][j][k] += w;
			}

	cout << setprecision(10) << fixed << dp[o][tw][tr] << "\n";

	return 0;
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n, a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d >> s;
  a--;
  b--;
  c--;
  d--;
  bool canGoA = true;
  bool canGoB = true;
  bool previousIsIwaA = false;
  bool previousIsIwaB = false;
  int cnt = 0;
  bool canChange = false;
  rep(i, n) {
    // 岩が並んでいたら駄目
    // ACBDの順番のときはCとBの間に岩が並んでいても良い
    if (i > a && i < c) {
      if (s[i] == '#') {
        if (previousIsIwaA) {
          canGoA = false;
        }
        previousIsIwaA = true;
      } else {
        previousIsIwaA = false;
      }
    }
    if (i > b && i < d) {
      if (s[i] == '#') {
        if (previousIsIwaB) {
          canGoB = false;
        }
        previousIsIwaB = true;
      } else {
        previousIsIwaB = false;
      }
    }
    // すぬけ君とふぬけ君の順番変われるか
    // c > d の場合のみ考慮
    if (i >= b - 1 && i <= d + 1) {
      if (s[i] == '.') {
        if (cnt >= 2) {
          canChange = true;
        }
        cnt++;
      } else {
        cnt = 0;
      }
    }
  }
  bool ok = canGoA && canGoB;
  if (c > d) {
    ok = ok && canChange;
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3768
// #include <iostream>
// #include <string>
// #include <math.h>
// #include <map>
// #include <vector>
// #include <tuple>
// #include <algorithm>
// #include <queue>
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define pii pair<int, int>
#define plli pair <lli, lli>
#define F(i,n) for(lli (i)=0;(i)<(n);(i)++)
#define FR(i,n) for(lli (i)=(n)-1;(i)>=0;(i)--)
#define FSG(i,a,b) for(lli (i)=(a);(i)<(b);(i)++)
#define FSGR(i,a,b) for(lli (i)=(b)-1;(i)>=(a);(i)--)
#define VAL(n) cout << n << endl;
#define VALD(n) cout << #n << ": " << n << endl;
int main(){
  int N, K;
  cin >> N >> K;
  lli cnt = 0;
  F(i, N){
    lli tmp = 0;
    cin >> tmp;
    if(tmp >= K){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		int x, y;
		cin >> x >> y;
		if (x == y) a[i] = 1;
	}
	int cnt = 0;
	rep(i, n) {
		if (a[i] == 0) cnt = 0;
		else {
			cnt += a[i];
			if (cnt == 3) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3628
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-6;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
const char nl = '\n';

template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }

// (Integer/Long).bitCount(x)
int pct(int x) { return __builtin_popcount(x); }
int pctll(ll x) { return __builtin_popcountll(x); }

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}

// Binary Exponentiation
ll pow(ll b, ll e, ll m = 0LL, ll ans = 1LL) { while (e) { if (e & 1LL) { ans *= b; if (m) ans %= m; } b *= b, e >>= 1LL; if (m) b %= m; } return ans; }



void solve(int tcn) {
	int n;
	cin >> n;
	vector<int> a(n);
	F0R(i, n) cin >> a[i];
	reverse(all(a));
	vector<int> suffixMax(n, 0);
	suffixMax[n-1] = a[n-1];
	R0F(i, n-1) {
		suffixMax[i] = max(a[i], suffixMax[i+1]);
	}
	ll ans = 0LL;
	F0R(i, n) {
		if (a[i] < suffixMax[i]) {
			ans += suffixMax[i] - a[i];
		}
	}
	cout << ans << nl;
}

int main() {
    setIO();

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

Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
int main()
{
	cout<<setprecision(10);
	double a, b, h, m;
	cin>>a>>b>>h>>m;
	// 12 hours of the hour hand sweeps 360 degrees
	// So h hours will sweep h*360/12 + m*30/60
	// m*30/60 bcoz as hour hand moves, the minute hand also moves.
	// Between any two minutes there is an angle of 30 degree.
	// We hv to find how many degrees out of the 30 degrees the minute hand has moved.
	double deg_H=((h*360)/12)*(M_PI/180.0) + ((m*30)/60)*(M_PI/180.0);

	// minute hand sweeps 360 degrees in 60 minutes.
	// So m minutes will sweep m*360/60 degrees.
	double deg_M=((m*360)/60)*(M_PI/180.0);

	// Finding coordinates of the minute hand and hour hand
	double hours_x=a*cos(deg_H);
	double hours_y=a*sin(deg_H);
	double min_x=b*cos(deg_M);
	double min_y=b*sin(deg_M);

	// Apply distance formula
	double res=sqrt((hours_x-min_x)*(hours_x-min_x) + (hours_y-min_y)*(hours_y-min_y));
	cout<<res;
	return 0;
}

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

using namespace std;

typedef pair<int, int> p;
typedef long long ll;
const int inf = 1000000007;

int n, m, q, ans;
vector<int> a, b, c, d;

void dfs(vector<int> A) {
  if (A.size() == n + 1) {
    int now = 0;
    rep(i, q) {
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }
  A.push_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}

int main() {
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q, 0);
  rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];
  dfs(vector<int>(1, 1));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3608
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,b,c=mp()
for i in range(10**7):
    if (a*i)%b==c:
        print("YES")
        exit()
print("NO")

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

using namespace std;

const int inf = 1000000007;

int main(){
    int n;
    cin >> n;
    int p[n];
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int i=1;i<n-1;i++){
        if(min(p[i-1],p[i+1]) < p[i] && p[i] < max(p[i-1],p[i+1])){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
static const int M = 22370000;
bool Hash[M];

inline int convertChartoNum(char c)
{
	if (c == 'A')
	{
		return(1);
	}
	else if (c == 'C')
	{
		return(2);
	}
	else if (c == 'G')
	{
		return(3);
	}
	else if (c == 'T')
	{
		return(4);
	}
}

inline int getKey(string s)
{
	int sum = 0;
	int p = 1;
	for (int i = 0; i < s.size(); ++i)
	{
		sum += p * convertChartoNum(s[i]);
		p *= 4;
	}
	return(sum);
}

inline int find(string s)
{
	int key = getKey(s);
	if (Hash[key])
	{
		return(1);
	}
	else
	{
		return(0);
	}
}

inline void insert(string s)
{
	int key = getKey(s);
	if (Hash[key])
	{
		return;
	}
	else
	{
		Hash[key] = true;
		return;
	}
}

void solve()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		string command, str;
		cin >> command >> str;
		if (command[0] == 'i')
		{
			insert(str);
		}
		else
		{
			if (find(str) == 1)
			{
				printf("yes\n");
			}
			else
			{
				printf("no\n");
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

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



int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int s,w;//testcases
    cin>>s >> w;
    if(w>=s){
		cout << "unsafe";
	}
	else cout << "safe";
	return 0;
}



Measured memory_bytes: 3608
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

const int N = 2e5 + 20 ;
int n , q , ans ;
char t[N] , d[N] ;
string s ;

inline bool check (int x) {
	for (int i = 0 ; i < q ; i ++) {
		if (0 <= x && x < n && s[x] == t[i]) {
			if (d[i] == 'L') x -- ;
			else x ++ ;
		}
	}

	return !(0 <= x && x < n) ;
}

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

	cin >> n >> q ;
	cin >> s ;

	for (int i = 0 ; i < q ; i ++) cin >> t[i] >> d[i] ;

	int low = 0 , high = n + 1 ;

	while (high - low > 1) {
		int mid = (low + high) / 2 ;

		if (check(mid - 1)) low = mid ;
		else high = mid ;
	}

	ans = low ;

	if (ans == n) return cout << n - ans << '\n' , 0 ;

	low = 0 , high = n ;

	while (high - low > 1) {
		int mid = (low + high) / 2 ;

		if (check(n - mid)) low = mid ;
		else high = mid ;
	}

	ans += low ;

	cout << n - ans << '\n' ;
}


Measured memory_bytes: 976
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<string,int> P;
const ll MOD=1e9+7;

int main()
{
	string s;
	string ans;
	cin>>s;
	int ct[26];
	fill(ct,ct+26,0);
	for(int i=0;i<s.size();i++)
	{
		ct[s[i]-'A']++;
	}
	if((ct['N'-'A']>0 && ct['S'-'A']==0)||(ct['N'-'A']==0 && ct['S'-'A']>0))
		ans="No";
	else if((ct['E'-'A']>0 && ct['W'-'A']==0)||(ct['E'-'A']==0 && ct['W'-'A']>0))
		ans="No";
	else
		ans="Yes";
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k[200000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>k[i];
  }
  if(n%2==1){
  for(int i=n-1;i>=0;i-=2){
    cout<<k[i]<<" ";
  }
  for(int i=1;i<=n-1;i+=2){
    cout<<k[i]<<" ";
  }
  }
  else{
    for(int i=n-1;i>=1;i-=2){
      cout<<k[i]<<" ";
    }
    for(int i=0;i<=n-2;i+=2){
      cout<<k[i]<<" ";
    }
  }
  cout<<endl;
}


Measured memory_bytes: 2944
#include <iostream>
#include <string.h>

using namespace std;

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

  if (a == b || b == c || c == a) {
    if (a == b && b == c) {
      cout << "No";
    } else {
      cout << "Yes";
    }
  } else {
    cout << "No";
  }

  return 0;
}


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

int a[50][6];
int main(){
	vector<int>v[3];
	int n;scanf("%d",&n);
	rep(i,n)rep(j,6){
		int c,d;scanf("%d%d",&c,&d);
		a[i][j]=c*60+d;
		if(j%2==0)v[j/2].push_back(a[i][j]);
	}
	int Max=0;
	rep(i,v[0].size())rep(j,v[1].size())rep(k,v[2].size()){
		int b[]{v[0][i],v[1][j],v[2][k]};
		int cnt=0;
		rep(t,n){
			bool flag=true;
			rep(l,3){
				if(!(a[t][l*2]<=b[l]&&b[l]<=a[t][l*2+1]))flag=false;
			}
			cnt+=flag;
		}
		Max=max(Max,cnt);
	}
	cout<<Max<<endl;
}

Measured memory_bytes: 3224
import sys
import math
input = sys.stdin.readline

used = []
connect = []
N = 0
M = 0


def main():
    global used
    global connect
    global N
    global M
    sc = Scan()
    N, M = sc.intarr()
    a = [0] * M
    b = [0] * M
    for i in range(M):
        aa, bb = sc.intarr()
        a[i] = aa - 1
        b[i] = bb - 1
    connect = [[0] * N for i in range(N)]
    used = [0] * N
    for i in range(M):
        connect[a[i]][b[i]] = 1
        connect[b[i]][a[i]] = 1

    print(dfs(0, 1))


def dfs(now, depth):
    global used
    global connect
    if used[now] == 1:
        return 0

    if depth == N:
        return 1
    ans = 0
    used[now] = 1
    for i in range(N):
        if connect[now][i] == 1:
            ans += dfs(i, depth+1)
    used[now] = 0
    return ans


class Scan():

    def intarr(self):
        num_array = list(map(int, input().split()))
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


def gcd(a, b):  # 最大公約数
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):  # 最小公倍数
    return a * b // gcd(a, b)


main()


Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
using namespace std;
inline char nc() {
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x) {
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
} 
int A, B, K;
int main() {
//	freopen("testdata.in", "r", stdin);
	read(A), read(B), read(K);
	for(int i = A; i >= 1; --i) {
		if(A % i || B % i) continue;
		if(--K == 0) {
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
//#include<algorithm>
using namespace std;
int n, cnt = 0;
void dfs(long long num, bool have3, bool have5, bool have7)
{
    if(num <= n)
    {
        if(have3 && have5 && have7)
            cnt++;
        dfs(num*10+3, true, have5, have7);
        dfs(num*10+5, have3, true, have7);
        dfs(num*10+7, have3, have5, true);
    }
}
int main()
{
    cin >> n;
    dfs(0,0,0,0);
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int sum=abs(h2*60+m2-h1*60-m1);
	if (sum<=k)   cout<<0<<endl;
	else   cout<<sum-k<<endl;
	return 0;
} 

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int h, n, a, mag;
int main() {
    cin>>h>>n;
    for (int i = 0; i<n; i++){
        cin>>a;
        mag +=a;
    }
    if (h <= mag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, j, k, l, n, cnt;

	while(scanf("%d", &n) != EOF){
		cnt = 0;
		for(i=0; i<=9; i++){
			for(j=0; j<=9; j++){
				for(k=0; k<=9; k++){
					for(l=0; l<=9; l++){
						if(i+j+k+l == n){ cnt++; break; }
					}
				}
			}
		}
		printf("%d\n", cnt);
	}
    return 0;
}

Measured memory_bytes: 596
#include <cstdio>   /* printf, scanf */
#include <utility>  /* pair, make_pair */
#include <vector>   /* vector */

using namespace std;
int GetContainsNumber(const vector<pair<int, int>> v, const int e) {

    int i = 0;
    for (vector<pair<int, int>>::const_iterator it = v.begin(); it != v.end(); it++) {
        if (e == it->first) {
            return i;
        }
        i++;
    }
    return -1;
}

int main()
{
    int n = 0, e = 0, p = 0, q = 0;
    vector<pair<int, int>> vec;
    while (true) {
        scanf("%d", &n);
        if(0 == n)
            break;

        bool isFind = false;
        for (int i = 0; i < n; i++) {
            scanf("%d%d%d", &e, &p, &q);
            int idx = GetContainsNumber(vec, e);
            if (-1 == idx) {
                vec.push_back(make_pair(e, p * q));
            }
            else {
                vec[idx].second += p * q;
            }
        }

        for (vector<pair<int, int>>::iterator it = vec.begin(); it != vec.end(); it++) {
            if (1000000 <= it->second) {
                printf("%d\n", it->first);
                isFind = true;
            }
        }

        if (!isFind) {
            printf("NA\n");
        }
        vec.clear();
    }

    return 0;
}



Measured memory_bytes: 2704
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class arc096_d {
public:
    void solve(istream& in, ostream& out) {
        int N;
        long long C;
        in >> N >> C;
        vector<long long> x(N), v(N);
        for (int i = 0; i < N; ++i) {
            in >> x[i] >> v[i];
        }
        vector<long long> dp1(N), dp2(N);
        long long cur = 0;
        for (int i = 0; i < N; ++i) {
            cur += v[i];
            dp1[i] = max((i > 0 ? dp1[i - 1] : 0), cur - x[i]);
        }
        
        vector<long long> x2(N);
        for (int i = 0; i < N; ++i) {
            x2[i] = C - x[i];
        }
        cur = 0;
        for (int i = N - 1; i >= 0; --i) {
            cur += v[i];
            dp2[i] = max((i < N - 1 ? dp2[i + 1] : 0), cur - x2[i]);
        }
        
        long long ans = max(dp2[0], dp1[N - 1]);
        for (int i = 0; i + 1 < N; ++i) {
            ans = max(ans, dp1[i] + dp2[i + 1] - min(x[i], x2[i + 1]));
        }
        out << ans << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc096_d solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4224
while True:
    H, W = list(map(int, input().split()))
    if H == 0 and W == 0:
        break

    for h in range(H):
        line = ''
        for w in range(W):
            if h % 2 == 0:
                if w % 2 == 0:
                    line += '#'
                else:
                    line += '.'
            else:
                if w % 2 == 0:
                    line += '.'
                else:
                    line += '#'
        print(line)

    print()



Measured memory_bytes: 5612