akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


int mx6[] = {1,0,-1,1,-1,0};
int my6[] = {1,1,1,0,0,-1};
const int N = 1000005;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int dp[N];
    rep(i,N) dp[i] = 0;

    rep(i,n) {
        if(dp[a[i]] <= 1){
            int A = a[i];
            for(int j = 1; j < 1000004 &&  j * a[i] < 1000004; j++){
                dp[A*j]++;
            }
        }
    }

    int ans = 0;
    rep(i,n){
        if(dp[a[i]] == 1) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 8004
# -*- coding: utf-8 -*-
X = int(input())

def factorize(target_number):
    factor = 2
    factor_list = []
    while factor * factor <= target_number:
        while target_number % factor == 0:
            target_number //= factor
            factor_list.append(factor)
        factor = factor + 1
    if target_number > 1:
        factor_list.append(target_number)
    return factor_list

ans = 0
for i in range(X, 100003 + 1):
    if len(factorize(i)) == 1:
        ans = i
        break

print(ans)

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

int main(){
  int k;
  cin >> k;
  long long total=0;
  // ぞろ目の時
  // k^3通りある
  for(int a=1;a<=k;++a){
    for(int b=1;b<=k;++b){
        for(int c=1;c<=k;++c){
            total += gcd(gcd(a, b) ,gcd(b, c));
        }
    }
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N+1); A[0]=0;
  rep(i,N) cin >> A[i+1];
  int count = 0;
  int now=1;
  for(int i=0;i<100000;i++){
    now = A[now];
    count++;
    if(now==2){cout << count << endl; return 0;}
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  ll a;
  double b;
  cin >> a >> b;
  b += 0.001;
  ll nb = b * 100;
  cout << a * nb / 100 << endl;
  return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

vector<int> mul(vector<int> a, vector<int> b){
	int c[4][4];
	rep(i,4){
		rep(j,4){
			c[i][j] = a[i] * b[j];
		}
	}
	//rep(i,4){ rep(j,4){ cout << c[i][j] << ' '; } cout << endl; }
	vector<int> res(4);
	res[0] = c[0][0] - c[1][1] - c[2][2] - c[3][3];
	res[1] = c[1][0] + c[0][1] - c[3][2] + c[2][3];
	res[2] = c[0][2] + c[2][0] + c[3][1] - c[1][3];
	res[3] = c[3][0] - c[2][1] + c[1][2] + c[0][3];
	return res;
}

signed main(){
	int n;
	while(cin >> n, n){
		while(n--){
			vector<int> a(4), b(4);
			rep(i,4) cin >> a[i];
			rep(i,4) cin >> b[i];

			auto ans = mul(a,b);
			rep(i,4){
				if(i) cout << ' ';
				cout << ans[i];
			}
			cout << endl;
		}
	}


}



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

//Euclid's algorithm
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll curr = 1;
    ll th,ah;
    th=a; ah=c;
    bool ans = false;
    while(1){
        if(curr==1){
            curr=2;
            ah-=b;
        }
        else{
            curr=1;
            th-=d;            
        }
        if(th<=0&&ah>0){
            break;
        }
        if(ah<=0&&th>0){
            ans = true;
            break;
        }
    }
    if(ans) cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 3620
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define inf -(1LL<<51)
#define int long long
typedef long long ll;
#define ld long double
#define N 701


int32_t main()
{
    IOS;
  
    string s;
    cin  >> s;
    string t = "keyence";
    int n = s.length();
    int m = t.length();
    if( n < m)
    {
    	cout << "NO";
    	return 0;
    }
    int pre = 0;
 
    for(int i = 0;i < n;i++)
    {
    	if(s[i] == t[pre])
    		pre++;
    	else
    		break;
    }
    int suff = m-1;
    for(int i = n-1;i >= 0;i--)
    {
    	if(s[i] == t[suff])
    		suff--;
    	else
    		break;
    }
    if(suff < pre)
    	cout << "YES";
    else
    	cout << "NO";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define rep(i,n) for(int i=0 ; i < n ; i++)
#define N 300000

using namespace std;

int main()
{

  int array[N] = {0};
  rep(i, N){
    array[i] = 1;
  }
  array[0] = 0;
  array[1] = 0;
  
  int end;
  end = (int)sqrt((double)N);
  for(int i = 2 ; i < end ; i++){
    if(array[i] == 1){
      for(int j = i*2 ; j <= N ; j+=i){
	array[j] = 0;
      }
    }
  }
  
  while(true){
    int n;
    cin >> n;
    if(n == 0) break;

   
    int num = 0;
    for(int i = n+1 ; i <= 2 * n ; i++){
      if(array[i] == 1){
	num++;
      }
    }
    cout << num << '\n';
  }

}

Measured memory_bytes: 2340
#include <iomanip>
#include <limits>
#include <thread>
#include <utility>
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <numeric>
#include <cassert>
#include <random>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <list>
#include <functional>
#include <bitset>
#include <complex>
#include <tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;
typedef complex<D> P;
const ll E = 1e18 + 7;
const ll MOD = 1000000007;
#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define fill(x, y) memset(x, y, sizeof(x))
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
template <class... A>
void prints() { cout << endl; }
template <class... A>
void prints_rest() { cout << endl; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

template <class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

    int N;
    cin >> N;
    vector<int> A, maxV;
    int a;
    rep(_, N) { 
        cin >> a;
        
        auto it = lower_bound(all(maxV), a);
        if (it == maxV.begin()) {
            maxV.insert(maxV.begin(), a);
        }
        else {
            *(--it) = a;
        }
    }

    prints(sz(maxV));    

    return 0;
}



Measured memory_bytes: 892
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <functional>
using namespace std;
#define int long long
signed main(void)
{
	int x;
	cin >> x;
	int ans = 0; int sum = 0;
	while (sum < x) {
		sum += ans; ans += 1;
	}
	cout << ans-1;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        int[] a = new int[A];
        int[] b = new int[B];
        int aans = 99999999;
        int bans = 99999999;
        int ans = 0;
        for(int i=0;i<A;i++){
            a[i] = scan.nextInt();
            aans = Math.min(aans, a[i]);
        }

        for(int i=0;i<B;i++){
            b[i] = scan.nextInt();
            bans = Math.min(bans, b[i]);
        }

        ans = aans+bans;

        for(int i=0;i<C;i++){
            int o = scan.nextInt();
            int p = scan.nextInt();
            int q = scan.nextInt();
            ans = Math.min(ans, a[o-1]+b[p-1]-q);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 133916
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = max(x)
y = min(y)
for i in range(x+1, y+1):
    if X<i<=Y:
        print("No War")
        exit()
print("War")


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

map<int64_t, int> prime_factor(int64_t n) {
  map<int64_t, int> ret;
  for (int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

void solve() {
  int64_t n;
  cin >> n;
  int64_t a = 1;
  for (int64_t i = 2; i * i <= n; i++) {
    if (n % i == 0) a = i;
  }
  const int64_t b = n / a;
  cout << a + b - 2 << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


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

int main()
{
	int k;
	string s;

	cin >> k;
	cin >> s;

	if (s.size() <= k)
	{
		cout << s << '\n';
	}
	else
	{
		for (int i = 0; i < k; ++i)
			cout << s[i];
		cout << "...\n";
	}
	return 0;
}

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

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    long long int n;
    scanf("%lld",&n);
    long long int total = 0;
 
    for (int i = 1; i <= n; i++)
    {
        if (i % 3 == 0 || i % 5 == 0) 
		{
			continue;
		}
        else 
		{
			total += i;
		}
    }
    printf("%lld", total);
    return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
#include <numeric>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l

unsigned gcd(unsigned a, unsigned b) {
	if (a < b) gcd(b, a);
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
char tolower(char c) {
	return (c + 0x20);
}
ld num(ld a,ld b) {
	ld c = 1;
	while (b > a) {
		a *= 2;
		c*=2;
	}
	return c;
}

int main() {
	string s;
	cin >> s;
	int xc = 0;
	rep(i, s.size()) {
		if (s[i] == 'x')xc++;
	}
	if (xc > 7)cout << "NO" << endl;
	else cout << "YES" << endl;
	cin >> s;
}

Measured memory_bytes: 256
#二つの文字列を渡すと、文字列rotationにより一致する文字列になるかどうかを調べ、
#'Yes'または'No'を返す関数、match_rotation()を定義
def match_rotation(s,t):
    for i in s:
        s = s[1::] + s[0]
        if s == t:
            return 'Yes'
            break
    else:
        return 'No'

#入力値読み込み
S = str(input())
T = str(input())

#関数呼び出し
print(match_rotation(S, T))

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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> data(H+2, vector<char>(W+2));
    for (int i = 0; i < H + 2;i++){
        for (int j = 0; j < W + 2;j++){
            data.at(i).at(j) = '#';
        }
    }
    for (int i = 1; i < H + 1; i++)
    {
        for (int j = 1; j < W + 1; j++)
        {
            cin>> data.at(i).at(j);
        }
    }
    for (int i = 0; i < H + 2; i++)
    {
        for (int j = 0; j < W + 2; j++)
        {
            cout << data.at(i).at(j);
        }
        cout << endl;
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  int n;
  while(cin>>n,n){
    map<char,char> m;
    for(int i=0;i<n;i++){
      char c,d;
      cin>>c>>d;
      m[c]=d;
    }
    string ans;
    int q;
    cin>>q;
    while(q--){
      char x;
      cin>>x;
      if(m.count(x)) ans+=m[x];
      else ans+=x;
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)  //  rep
#define repr(i,a,n) for(int i=a;i>n;i--)  //  repリバース
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9000000000000000000 //  巨大数INF
using namespace std;

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

signed main() {
  int a, b;
  cin >> a >> b;
  int h;
  h = ((b-a)*(b-a-1))/2;
  cout << h-a << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int ans = 0;
        for(int x=0;x<=K;x++)for(int y=0;y<=K;y++){
        	int z = S-x-y;
        	if(z>=0&&z<=K) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def divisor(n):
        i = 1
        table = []
        while i * i <= n:
            if n % i == 0:
                table.append(i)
                table.append(n // i)
            i += 1
        table = list(set(table))
        return table


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)

    def list(self):
        return self.__q


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    # sys.stdin = open("Sample.txt")
    N, M = Scanner.map_int()
    A = Scanner.map_int()
    A = PriorityQueue([-x for x in A])
    for _ in range(M):
        A.push(Math.roundUp(A.pop(), 2))
    print(-sum(A.list()))
    return


if __name__ == "__main__":
    main()


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

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

	string ans = "No";
	if( A == B && A != C ) ans = "Yes";
	if( B == C && B != A ) ans = "Yes";
	if( C == A && C != B ) ans = "Yes";

	cout << ans << endl;
}


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

int main(){
	int n;
	cin>>n;
    int a = n%10;
    int b = (n/10)%10;
    int c = (n/100)%10;
    int d = (n/1000)%10;
    if(a==b || b==c || c==d)
    	cout<<"Bad";
    else
    	cout<<"Good";
}

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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1e9+7;

int main() {
	string s;
	cin >> s;
	int wpos = 0;
	ll ans = 0;
	for (int i = 0;i < s.size();i++) {
		if (s[i] == 'W') {
			ans += i-wpos;
			wpos++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int r,d,x;
	cin>>r>>d>>x;
	for(int i=1;i<=10;i++)
	{
		 x=r*x-d;
		 cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import math

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

# nCkの導出
def comb(n,k):
    nCk = 1
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

n, a, b = map(int, input().split())
mod = 10**9+7

# ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)

print(ans%mod)

Measured memory_bytes: 40880
S = input()
size = len(S)
mod = 10**9+7

dp = [[0]*4 for _ in range(size + 10)]
dp[0][0] = 1

for i in range(size):
  cn = dp[i][0]%mod
  a = dp[i][1]%mod
  b = dp[i][2]%mod
  c = dp[i][3]%mod
  if(S[i] == 'A'):
    dp[i+1][0] += cn
    dp[i+1][1] += (a+cn)
    dp[i+1][2] += b
    dp[i+1][3] += c
  elif(S[i] == 'B'):
    dp[i+1][0] += cn
    dp[i+1][1] += a
    dp[i+1][2] += (b+a)
    dp[i+1][3] += c
  elif(S[i] == 'C'):
    dp[i+1][0] += cn
    dp[i+1][1] += a
    dp[i+1][2] += b
    dp[i+1][3] += (c+b)
  else:
    dp[i+1][0] += (3*cn)
    dp[i+1][1] += (3*a+cn)
    dp[i+1][2] += (3*b+a)
    dp[i+1][3] += (3*c+b)

print(dp[size][3]%mod)

    
    

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

int main(){
    
    int N;
    
    //　標準入力を行わせる
    cin>>N;

    // 配列の設定
    vector<int> A(N);

    for (int i= 0;i<N;i++)cin >> A[i];

    vector<int>rev(N);
    for (int i= 0;i<N;i++) rev[A[i]-1] = i + 1;
    
    for (int i= 0;i < N;i++) cout << rev[i] <<endl;
    
    return 0;

}

Measured memory_bytes: 1664
#include <stdio.h>
#include <algorithm>

using namespace std;

int nums[100];
int main() {
  int w, n;
  scanf("%d %d", &w, &n);
  for (int i = 1; i <= w; i++) {
    nums[i] = i;
  }
  while (n--) {
    int a,b;
    scanf("%d,%d", &a, &b);
    swap(nums[a], nums[b]);
  }
  for (int i = 1; i <= w; i++) {
    printf("%d\n", nums[i]);
  }
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        var a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var N = a[0];
        var M = a[1];
        
        var s = Math.Min(N,M / 2);
        var c = (M - s * 2) / 4;
        Console.WriteLine(s + c);
    }
}


Measured memory_bytes: 13396
K, S = map(int, input().split())

# counter = 0
# 
# for x in range(K + 1):
#     for y in range(K + 1):
#         z = S - x - y
#         if 0 <= z <= K:
#             counter += 1

counter = sum([1 for x in range(K + 1) for y in range(K + 1) if 0 <= S - x - y <= K])
print(counter)


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

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

string s;
int main()
{

    cin>>s;
    rep(i,0,s.length()-1)
    {
        if(s[i]!=',')
            cout<<s[i];
        else
            cout<<" ";
    }
}




Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = (100, 2, 5, 5, 4, 5, 6, 3, 7, 6)

dp = [[0 for _ in range(10)] for _ in range(N + 1)]
dp2 = [-100 for _ in range(N + 1)]
dp2[0] = 0

for i in range(2, N+1):
    x = -1
    opt = -1
    for a in A:
        c = C[a]
        if i >= c and (dp2[i - c] > opt or (dp2[i - c] == opt and a > x)):
            x = a
            opt = dp2[i - c]
    if x == -1:
        continue
    dp2[i] = dp2[i - C[x]] + 1
    c = C[x]
    for a in A:
        if x == a:
            dp[i][a] = dp[i - c][a] + 1
        else:
            dp[i][a] = dp[i - c][a]

ans = ''.join(str(a) * dp[N][a] for a in sorted(A, reverse=True))
print(ans)


Measured memory_bytes: 5844
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007;
#define pi 3.14159265358979323846
#define Endl endl
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
int fl[20][2000];
signed main(){
	int h,w,li;
	cin>>h>>w>>li;
	for(int i=0;i<h;i++){
		string st;
		cin>>st;
		for(int j=0;j<w;j++){
			fl[i+1][j+1] = st[j] - '0';
		}
	}
	int ans = 11451419;
	for(int i=0;i<(1<<(h-1));i++){
		int c = i;
		int res = 0;
		set<int> cu;
		for(int j=0;j<h-1;j++){
			if( c % 2 ){
				cu.insert( j+2 );
				res++;
			}
			c = c/2;
		}
		cu.insert( h+1 );
		vector<int> wc(cu.size());
		vector<int> zan(cu.size());
		for(int j=1;j<=w;j++){
			bool iscut = false;
			int cur = 1;
			for(int k=0;k<wc.size();k++){
				zan[k] = 0;
			}
			for(int k=0;k<wc.size();k++){
				if( cu.find(cur) != cu.end() ){
					if( fl[cur][j] == 1 ) zan[k]++;
					cur++;
				}
				while( cu.find(cur) == cu.end() ){
					if( fl[cur][j] == 1 ) zan[k]++;
					cur++;
				}
				if( wc[k] + zan[k] > li ) iscut = true;
			}
			if( iscut ){
				res++;
				for(int k=0;k<wc.size();k++){
					wc[k] = zan[k];
				}
			}
			else{
				for(int k=0;k<wc.size();k++){
					wc[k] += zan[k];
				}
			}
			for(int k=0;k<wc.size();k++){
				if( zan[k] > li ) res = 11451419;
			}
		}
		if( res < ans ){
			//cout<<"!"<<i<<" "<<res<<Endl;
			ans = res;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int a1,a2,a3;
    scanf("%d %d %d",&a1,&a2,&a3);
    if((a1+a2+a3)>=22)
    {
        printf("bust\n");
    }
    else
    {
        printf("win\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;

vector<int> temp;

void Compute(int num);

int main() {

	int n;
	cin >> n;
	int j = 1;

	while (n--) {

		int num;
		cin >> num;
		cout << "Case " << j << ":\n";

		for (int i = 0; i < 10; i++) {

			temp.clear();
			Compute(num);
			num = temp[5] * 1000 + temp[4] * 100 + temp[3] * 10 + temp[2];
			cout << num << "\n";

		}

		j++;

	}

	return 0;

}

void Compute(int num) {

	num *= num;
	while (num) {

		temp.push_back(num % 10);
		num /= 10;

	}

	int times = temp.size();
	for (int i = 0; i < 8 - times; i++)
		temp.push_back(0);
}



Measured memory_bytes: 3124
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <numeric>
#include <climits>

using namespace std;

int main()
{
    string S;
    cin >> S;

    bool ok = false;
    for (int i = 1; i <= 5; ++i)
    {
        string test = "";
        for (int n = 0;n<i;++n){
            test = test + "hi";
        }

        if( S == test){
            ok = true;
            break;
        }
    }

    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
ans = 0

if N%2 == 0:
  N //= 2
  for i in range(1,100):
    ans += N//(5**i)
print(ans)

Measured memory_bytes: 38256
// a template for main.cpp
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x;
    cin >> x;
    ll now = 100;
    int years = 0;
    while (now < x) {
    	now = now + now * 0.01;
    	years++;
    }
    cout << years << endl;
}


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

int main(){
  long long a,b,c,d;
  long long reta,retb,retc,retd;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
  reta = a*c;
  retb = a*d;
  retc = b*c;
  retd = b*d;
  //printf("%d %d %d %d\n",reta,retb,retc,retd);
  if(reta < retb){
    reta = retb;
  }
  if(reta < retc){
    reta = retc;
  }
  if(reta < retd){
    reta = retd;
  }
  printf("%lld\n",reta);
  return 0;
}

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

int main() {

  int A, B;
  cin >> A >> B;
  
  int count = 0;
  for (int i = A; i <= B; i++) {
    int _a, _b, _c, _d, _e, _i;
    
    _i = i;
    
    _a = _i % 10;
    _i /= 10;

    _b = _i % 10;
    _i /= 10;

    _c = _i % 10;
    _i /= 10;

    _d = _i % 10;
    _i /= 10;

    _e = _i % 10;
    _i /= 10;

    if (_a == _e && _b == _d) {
      count++;
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


    class Program
    {
        static void Main(string[] args)
        {
          string[] Input = Console.ReadLine().Split(' ');
          int N = int.Parse(Input[0]);
          int K = int.Parse(Input[1]);
          var D = Console.ReadLine().Where(x => x!=' ').ToArray();
            for(int i = N; i < 90000; i++)
            {
              var n = i.ToString().ToCharArray();
               var flag = true;
               for(int j = 0; j < n.Length; ++j)
               {
                if(D.Contains(n[j]))
                {
                 flag = false; 
                }
               }
              if(flag)
              {
                Console.WriteLine(i);
                return;
              }
            }
        }
    }


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

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

  int x = -1;
  for (int i = 1; i * (i+1) / 2 <= n; i++) {
    if ((i * (i+1)) / 2 == n) x = i;
  }
  if (x == -1) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  cout << x + 1 << endl;

  vector<vector<int>> ans;
  vector<int> pos;
  int last = 1;

  for (int i = 0; i < x + 1; i++) {
    vector<int> tmp;
    for (int j = 0; j < i; j++) if (pos[j] < x) {
      tmp.emplace_back(ans[j][pos[j]]);
      ++pos[j];
    }
    int m = tmp.size();
    pos.emplace_back(m);
    while (m < x) {
      tmp.emplace_back(last);
      ++last;
      ++m;
    }
    ans.emplace_back(tmp);
  }

  for (int i = 0; i < x + 1; i++) {
    cout << x;
    for (int j = 0; j < x; j++) {
      cout << ' ' << ans[i][j];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define pb push_back
const ll mod=1e9+7;
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
const ll N=1e6+8;
const ll INF=1e18;
ll dp[1002][1002];
ll ans=0,t=0,p=0;
string s[1002];
ll func(ll i,ll j,ll n,ll m){
  if(i>=n||j>=m)
  return 0;
  if(i==n-1&&j==m-1)
   return 1;
   if(dp[i][j]!=-1)
   return dp[i][j];
 if(s[i][j]=='#')
 return 0;
 else 
 return dp[i][j]=(func(i+1,j,n,m)+func(i,j+1,n,m))%mod;
}
int main(){
  ll n,m;
  cin>>n>>m;
  for(ll i=0;i<n;i++)
  cin>>s[i];
  memset(dp,-1,sizeof(dp));
  cout<<func(0,0,n,m);
}

Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b)<<endl;
    return 0;
}


Measured memory_bytes: 888
import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int day = 0;
        int coins = 0;
        while (coins < c) {
            day++;
            coins += a;
            if(day%7 == 0) {
                coins += b;
            }
        }
        System.out.println(day);
    }
}


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

#define vi vector<int>
#define vll vector<long long>
#define ll long long
#define ull unsigned long long
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define nl cout<<'\n'
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pll pair<long long,long long>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<ll,ll> >
#define si set<int>
#define sll set<long long>
#define all(v) (v).begin(),(v).end()
#define Unique(x)           (x).erase(unique(all(x)), x.end())
#define v_present(vec, x)  (find(all(vec),x)!=(vec).end())
#define present(myset, x)    ((myset).find(x)!=(myset).end())
#define Cprint(c)  for(auto i:(c)) { cout<<i<<" "; } nl
#define trace2(x, y) cout<<x<<" "<<y<<endl;
#define trace3(x, y, z) cout<<x<<" "<<y<<" "<<z<<endl;
#define trace4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<endl;
ll mod = 1e9 + 7;
const int MAX = 1e5 + 5;

using namespace std;

ll dp[105][100005];  // dp[i][j] represents ways to divide j candies among 1st i students
ll pre[105][100005];

int main() {
    FAST_IO;
    int n, k;
    cin >> n >> k;
    vll a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    dp[0][0] = 1;

    for (int i = 0; i < n; i++) {

        for (int j = 0; j <= k; j++) {

            if (i == 0) {
                if(j<=a[i])
                    dp[i][j] = 1;
                else
                    dp[i][j] = 0;
                if(j>0)
                pre[i][j] = (dp[i][j] + pre[i][j - 1]) % mod;
                else
                    pre[i][j]=dp[i][j];
            }
            else {
                dp[i][j] = pre[i-1][j];
                if(j>=a[i]+1)
                    dp[i][j] = (dp[i][j]-pre[i-1][j-a[i]-1]+mod)%mod;
                if(j > 0)
                pre[i][j] = (dp[i][j] + pre[i][j - 1]) % mod;
                else
                    pre[i][j]=dp[i][j];
            }
            //cout<<dp[i][j]<<" ";
        }
        //nl;
    }
    //nl;
    cout<<dp[n-1][k];


    return 0;

}

Measured memory_bytes: 160000
#include<iostream>
#include<cstdio>
using namespace std;
int smallw[4444][2222],smallb[4444][2222];
int dp[2222][2222],n,a[4444],pos[2][2222],cur;
char c[4444];
int main()
{
	scanf("%d",&n);
	n*=2;
	for (int i=1;i<=n;i++)
	{
		getchar();
		scanf("%c %d",&c[i],&a[i]);
		if (c[i]=='B') pos[0][a[i]]=i;
		else pos[1][a[i]]=i;
	}
	for (int i=n;i>=1;i--)
	{
		for (int j=1;j<=n/2+1;j++)
		{
			if (c[i]=='W') smallb[i][j]=smallb[i+1][j];
			else smallb[i][j]=smallb[i+1][j]+(a[i]<j);
		}
	}
	for (int i=n;i>=1;i--)
	{
		for (int j=1;j<=n/2+1;j++)
		{
			if (c[i]=='B') smallw[i][j]=smallw[i+1][j];
			else smallw[i][j]=smallw[i+1][j]+(a[i]<j);
		}
	}
	for (int i=0;i<=n/2;i++)
	{
		for (int j=0;j<=n/2;j++)
		dp[i][j]=1e9;
	}
	dp[0][0]=0;
	for (int i=0;i<=n/2;i++)
	{
		for (int j=0;j<=n/2;j++)
		{
			if (i)
			{
				cur=pos[0][i]+smallb[pos[0][i]][i]+smallw[pos[0][i]][j+1];
				dp[i][j]=min(dp[i][j],dp[i-1][j]+(cur-i-j));
			}
			if (j)
			{
				cur=pos[1][j]+smallb[pos[1][j]][i+1]+smallw[pos[1][j]][j];
				dp[i][j]=min(dp[i][j],dp[i][j-1]+(cur-i-j));
			}
		}
	}
	printf("%d\n",dp[n/2][n/2]);
	return 0;
}

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

long long cnt;
int l;
int A[1000000];
int n;
vector<int>G;
void insertionSort(int A[],int n,int g){
    for(int i=g;i<n;i++){
        int v=A[i];
        int j=i-g;
        while(j>=0&&A[j]>v){
            A[j+g]=A[j];
            j-=g;
            cnt++;
        }
        A[j+g]=v;
    }
}
void shellSort(int A[],int n){
    for(int h=1;;){
        if(h>n)break;
        G.push_back(h);
        h=3*h+1;
    }
    for(int i=G.size()-1;i>=0;i--){
        insertionSort(A,n,G[i]);
    }
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>A[i];
    cnt=0;
    shellSort(A,n);
    cout<<G.size()<<endl;
    for(int i=G.size()-1;i>=0;i--){
        cout<<G[i];
        if(i)cout<<" ";
    }
    cout<<endl;
    cout<<cnt<<endl;
    for(int i=0;i<n;i++)cout<<A[i]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 6980
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F();
		var A = G();
		Console.WriteLine(A.Min(F));
	}
	int F(int N)
	{
		var c = 0;
		while (N % 2 == 0)
		{
			N >>= 1;
			c++;
		}
		return c;
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define mx 100005
#define ll long long
#define mod 1000000007

int ar[mx];
char ch[mx];

int n,m;

void solve()
{
   cin>>n>>m;
   set<int>s;
   for(int i=1;i<=m;i++)
   {
       int d;
       cin>>d;
       while(d--)
       {
           int x;
           cin>>x;
           s.insert(x);
       }
   }
   cout<<n-s.size()<<endl;
}

int main()
{
    int t=1;
   // scanf("%d",&t);
    while(t--)solve();
    return 0;
}


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

#define DIV 1000000007
using namespace std;
using ll = long long;

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

    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    int yo;
    if (N % 2) yo = 3;
    else yo = 2;
    vector<vector<ll>> dp(N + 1, vector<ll>(yo, -1e16));
    for (int i = 0; i < yo; i++) dp[i + 1][i] = a[i];
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < yo; j++) {
            for (int k = 0; k < yo; k++) {
                if (i + 2 + k > N || j + k >= yo) {
                    continue;
                }
                dp[i + 2 + k][j + k] = max(dp[i + 2 + k][j + k], dp[i][j] + a[i + 1 + k]);
            }
        
        }
    }
    ll ans = -1e16;
    for (int i = 0; i < yo; i++) {       
        ans = max(ans, dp[N-(yo-1)+i][i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 15612
import java.util.Scanner;

public class Main {

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

		for (;;) {
			int a = stdIn.nextInt();
			String op = stdIn.next();
			int b = stdIn.nextInt();
			int ans = 0;
			
			if (op.equals("?")) break;
			
			switch (op) {
			case "+":
				ans = a + b;
				break;
	
			case "-":
				ans = a - b;
				break;
				
			case "*":
				ans = a * b;
				break;
				
			case "/":
				ans = a / b;
			}
			System.out.println(ans);
		}
	}
}



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

int main(){
  int a[3];

  int t,l,v,g;
  t = l = v = g = 0;
  while(cin >> a[0] >> a[1] >> a[2]){
    sort(a,a+3);
    if(a[0]+a[1]<=a[2]){
      cout << t << " " << v << " " << l << " " << g << endl;
      return 0;
    }else{
      t++;
      int s = a[0]*a[0]+a[1]*a[1]-a[2]*a[2];
      if(s<0)g++;
      else if(s==0)v++;
      else l++;
    }
  }
}

Measured memory_bytes: 1184
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: usize,
        b: usize
    };

    if a <= 5 {
        println!("0")
    } else if a <= 12 {
        println!("{}", b / 2)
    } else {
        println!("{}", b)
    }
}


Measured memory_bytes: 2204
#include<cstdio>
#include<cstring>

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

using namespace std;

int n,fixed[100];

int dp[100][4][3];
int dfs(int i,int pre,int con){ // 今何日目か, 前日のパスタ, pre が何回連続したか
	if(con==3) return 0;
	if(i==n) return 1;

	if(dp[i][pre][con]!=-1) return dp[i][pre][con];

	int res=0;
	if(fixed[i]==0){
		for(int j=1;j<=3;j++){
			res+=dfs(i+1,j,pre==j?con+1:1);
		}
	}
	else{
		res=dfs(i+1,fixed[i],pre==fixed[i]?con+1:1);
	}
	return dp[i][pre][con]=res%10000;
}

int main(){
	int k; scanf("%d%d",&n,&k);
	rep(i,k){
		int a,b; scanf("%d%d",&a,&b); a--;
		fixed[a]=b;
	}

	memset(dp,-1,sizeof dp);
	printf("%d\n",dfs(0,0,0));

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n;
int a[10001];
int b[10001];
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n)
	cin>>a[i];
	rep(i,n)
	cin>>b[i];
	ll ans1=0,ans2=0;
	rep(i,n){
		ans1+=b[i]-a[i];
		if(b[i]>a[i])
		ans2+=(b[i]-a[i]+1)/2;
	}
	if(ans2>ans1)
	cout<<"No";
	else
	cout<<"Yes";
	re 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
using namespace std;

int x, y;
bool a, b, c;
int ans;

int main(){
	scanf("%d %d", &x, &y);
	if(x > 0) a = true;
	if(y > 0) b = true;
	if(abs(y) > abs(x)) c = true;

	if((a && b && c) ||  (!a && !b && !c)) ans = y - x;
	else if((a && b && !c) || (!a && !b && c)) ans = x - y + 2;
	else if((a && !b && c) || (!a && b && !c))ans = - x - y + 1;
	else ans = x + y + 1;

	if(x == 0 && y > 0) ans = y;
	else if(x == 0 && y < 0) ans = 1 - y;

	if(x > 0 && y == 0) ans = x + 1;
	else if(x < 0 && y == 0) ans = -x;

	if(x == -y) ans = 1;

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

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

// Problem https://atcoder.jp/contests/abc065/tasks/abc065_b
// 1st C++ Try
// Reference https://atcoder.jp/img/arc076/editorial.pdf

int main(void){
    int answer;
    answer = -1;
    int N;
    cin >> N;
    vector<int> Ai;
    for(int j=0;j<N;j++){
        int shineNo;
        cin >> shineNo;
        shineNo = shineNo - 1;
        Ai.push_back(shineNo);
    }
    int nowShine ;
    nowShine = 1-1;
    int counter ;
    counter = 0;
    while(true){
        if(nowShine == (2-1)){
            answer = counter;
            break;
        }
        if(N <= counter){
            break;
        }
        nowShine = Ai.at(nowShine);
        counter = counter + 1;
    }
    cout << answer << endl;
    return 0;
}

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

void ume(int y, int x, vector<vector<int>> &field) {
    int dx[] = {1, 1, 1, 0, 0, -1, -1, -1};
    int dy[] = {0, 1, -1, 1, -1, 0, 1, -1};

    for (int d = 0; d < 8; d++) {
        if (field[y + dy[d]][x + dx[d]] == 1) {
            field[y + dy[d]][x + dx[d]] = 0;
            ume(y + dy[d], x + dx[d], field);
        }
    }
}

int solve(int w, int h) {
    vector<vector<int>> field(h + 2, vector<int>(w + 2, 0));
    for (int i = 0; i < h + 2; i++) {
        for (int j = 0; j < w + 2; j++) {
            if (i == 0 || i == h + 1 || j == 0 || j == w + 1)
                field[i][j] = -1;
            else
                cin >> field[i][j];
        }
    }
    // for (int i = 0; i < h + 2; i++) {
    //     for (int j = 0; j < w + 2; j++) {
    //         // if (i == 0 || i == h + 1 || j == 0 || j == w + 1)
    //         //     field[i][j] = -1;
    //         // else
    //         //     cin >> field[i][j];
    //         cout << field[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // queue<pair<int,int>> que;
    int island = 0;
    for (int i = 0; i < h + 2; i++) {
        for (int j = 0; j < w + 2; j++) {
            if (field[i][j] == 1) {
                field[i][j] = 0;
                ume(i, j, field);
                island++;
            }
        }
    }
    return island;
}

int main(void) {
    int w, h;
    vector<int> ans;
    while (1) {
        cin >> w >> h;
        if (!w && !h) break;
        ans.push_back(solve(w, h));
    }
    for (int a : ans) cout << a << endl;
}


Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
#define ll long long
using namespace std;
const int maxn=1e5+10;
void File(){
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
}
int k;
ll a[maxn];
ll ans=2ll,a1,a2;
int main(){
	//File();
	cin>>k;
	REP(i,1,k)
		cin>>a[i];
	if(a[k]>2){
		cout<<-1<<endl;
		return 0;
	}
	DREP(i,k-1,1){
		ll tmp=(ans+a[i+1]-1)/a[i]*a[i];
		if(tmp==0){
			cout<<-1<<endl;
			return 0;
		}
		ans=tmp;
	}
	a2=ans+a[1]-1;
	ans=2ll;
	DREP(i,k-1,1){
		ll tmp=ceil(ans*1.0/a[i]);
		tmp=tmp*a[i];
		ans=tmp;
	}
	if(ans>a2)cout<<-1<<endl;
	else cout<<ans<<" "<<a2<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 0
typedef long long LL;

int main() {
  int N, K; std::cin >> N >> K;

  std::vector<int> V(N);
  for (int i = 0; i < N; ++i) std::cin >> V[i];

  LL vmax = 0;
  int R = std::min(N, K);
  for (int l = 0; l <= R; ++l) {
    for (int r = 0; r <= R; ++r) {
      if (l + r > R) continue;

      LL sum = 0;
      std::vector<int> pos;
      std::priority_queue<int> neg;
      for (int i = 0; i < l; ++i) {
        LL v = V[i];
        sum += v;
        if (v >= 0) pos.push_back(v);
        else neg.push(-v);
      }
      for (int i = 0; i < r; ++i) {
        LL v = V[N - i - 1];
        sum += v;
        if (v >= 0) pos.push_back(v);
        else neg.push(-v);
      }

      int k = K - (l + r);
#if DEBUG
      std::cout << "l: " << l << ", r: " << r << ", k: " << k;
      std::cout << ", pos: ";
      for (int v : pos) std::cout << v << " ";
      std::cout << ", neg: ";
      auto q = neg;
      while (!q.empty()) {
        std::cout << q.top() << " ";
        q.pop();
      }
      std::cout << std::endl;
#endif

      for (int i = 0; i < k; ++i) {
        if (neg.empty()) break;
        sum += neg.top();
        neg.pop();
      }

#if DEBUG
      std::cout << "--> neg: ";
      q = neg;
      while (!q.empty()) {
        std::cout << q.top() << " ";
        q.pop();
      }
      std::cout << ", sum: " << sum << std::endl;
#endif

      vmax = std::max(vmax, sum);
    }
  }
  std::cout << vmax << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define R(i,a,n) for(int i=a;i<n;i++)
#define int long long
main(){
  int n,m;
  cin>>n>>m;
  int a[n][2],b[m][2];
  r(i,n){
      int p,o;
      cin>>p>>o;
      a[i][0]=p;
      a[i][1]=o;
  }
  r(i,m){
      int p,o;
      cin>>p>>o;
      b[i][0]=p;
      b[i][1]=o;
  }
  r(i,n){
    int c=100000000000,p;
      for(int l=0;l<m;l++){
        //cout<<abs(a[i][0]-a[j][k][0])+abs(a[i][l][1]-a[j][k][1])<<endl;
        if(c>abs(a[i][0]-b[l][0])+abs(a[i][1]-b[l][1])){
        c=min(c,abs(a[i][0]-b[l][0])+abs(a[i][1]-b[l][1]));
        p=l+1;
      }
    }
    cout<<p<<endl;
  }
}

Measured memory_bytes: 256