akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;

signed main() {
	int a, b; cin >> a >> b;
	if (a < b) {
		if (a <= 0 && b>=0)cout << min(b-a,abs(b+a) + 1) << endl;
		else cout << b - a << endl;
	}
	else if (a > b) {
		if (a >= 0 && b <= 0) {
			cout << min(a-b+2,abs(b + a) + 1) << endl;
		}
		else cout << a - b + 2 << endl;
	}
}

Measured memory_bytes: 256
//#define NDEBUG
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

struct rep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
struct revrep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) noexcept {
  if (a < b) {
    return b - a;
  } else {
    return a - b;
  }
}
template <class T> void chmin(T &a, const T &b) noexcept {
  if (b < a) {
    a = b;
  }
}
template <class T> void chmax(T &a, const T &b) noexcept {
  if (a < b) {
    a = b;
  }
}
template <class F> class fix_point : private F {
public:
  explicit constexpr fix_point(F &&f) : F(std::forward<F>(f)) {}

  template <class... Args>
  constexpr decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};
template <class F> constexpr decltype(auto) make_fix(F &&f) {
  return fix_point<F>(std::forward<F>(f));
}
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

namespace n91 {

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const u32 a = scan<u32>();
  const u32 b = scan<u32>();
  std::cout << (a ^ b) << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    ll n, m;
    cin >> n >> m;
    if(n == 1)  n += 2;
    if(m == 1)  m += 2;
    cout << (n - 2) * (m - 2) << endl;
}

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

// 入力
int N, M, Q;
vector<long long> a, b, c, d;

// 数列 A のスコアを計算
long long score(const vector<int> &A) {
    long long res = 0;
    for (int i = 0; i < Q; ++i) if (A[b[i]] - A[a[i]] == c[i]) res += d[i];
    return res;
}

// 数列 A に要素を付け加えて行って、最終的にできる数列のうちの
// スコアの最大値を返す
// 特に、最初の呼出しに対する返り値が答え
long long dfs(vector<int> &A) {
    if (A.size() == N) {
        return score(A);
    }
    long long res = 0;
    int prev_last = (A.empty() ? 0 : A.back());
    for (int add = prev_last; add < M; ++add) {
        A.push_back(add);
        res = max(res, dfs(A)); // 再帰呼出しながら、スコア最大値を更新
        A.pop_back();
    }
    return res;
}

int main() {
    cin >> N >> M >> Q;
    a.resize(Q); b.resize(Q); c.resize(Q); d.resize(Q);
    for (int q = 0; q < Q; ++q) {
        cin >> a[q] >> b[q] >> c[q] >> d[q];
        --a[q], --b[q];
    }
    vector<int> A;
    cout << dfs(A) << endl;
}

Measured memory_bytes: 3640
n = int(input())
a = list(map(int,input().split()))
c = 0
count4 = 0

for i in a:
  if i%4 == 0:
    count4 += 1
  if i%2 == 0:
    c += 1
only2 = c-count4
if only2 == 0 and count4 + 1 == len(a)-c:
  print('Yes')
elif count4 < len(a)-c:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 15020
import sys

n, y = map(int, input().split())

# n, y = 1000, 1234000

flg = False
for i in range(y//10000 + 1):
    for j in range(n-i+1):
        k = n - i - j
        if i*10000+j*5000+k*1000 == y:
            print(i, j, k)
            sys.exit(0)
print('-1 -1 -1')

Measured memory_bytes: 3060
s=input()
if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:
  print("Yes")
elif s[0]==s[2] and s[0]!=s[1] and s[1]==s[3]:
  print("Yes")
elif s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
import java.util.Scanner;

class	Main {
  public static void main(String args[]){
	Scanner stdIn = new Scanner(System.in);
	int S = Integer.parseInt(stdIn.nextLine());	//??\???
	System.out.println( S/3600+":"+ (S%3600)/60 +":"+S%60);	//?????????????§???¢????????????		
	}
}

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

int main() {
  string a; cin>>a;
  if(a=="a"||a=="i"){cout<<"vowel"<<endl;}
  else if(a=="u"||a=="e"){cout<<"vowel"<<endl;}
   else if(a=="o"){cout<<"vowel"<<endl;}
  else{cout<<"consonant"<<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P  = pair<int, int>;
int main() {
    int h, w, k, r = 0;
    cin >> h >> w >> k;
    vector<vector<bool>> c(h, vector<bool>(w, false));
    for (int i = 0; i < h; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < w; ++j)
            if (s[j] == '#') c[i][j] = true;
    }
    for (int i = 0; i < (1 << h); ++i) {
        for (int j = 0; j < (1 << w); ++j) {
            int tk = 0;
            for (int row = 0; row < h; ++row) {
                for (int col = 0; col < w; ++col) {
                    if (((i >> row) & 1) && ((j >> col) & 1)) tk += c[row][col];
                }
            }
            if (tk == k) ++r;
        }
    }
    cout << r;
}

Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cstdio>
#include <string>
#include <utility>
#include <iomanip>
#include <numeric>
#include <functional>
#include <list>
#include <regex>
#include <sstream>
#include <unordered_set>
#include <unordered_map>
#include <climits>
using namespace std;


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

#define pb(c,num) c.push_back(num)

// loops
#define rep(i,n) for (int i = 0; i < n; ++i)
#define repi(i,k,n) for (int i = k; i <= n; ++i)
#define repr(i,k,n) for (int i = k; i >= n; --i)
#define tr(c, it) \
for(auto it = c.begin(); it != c.end(); ++it)


#define all(c) c.begin(), c.end()

// set,map
#define present(c, element) (c.find(element) != c.end())
//vectors
#define cpresent(c, element) (find(all(c), element) != c.end())


int main(){
    std::ios_base::sync_with_stdio(false);

//    ifstream input;
//    ofstream output;
//    input.open("input.in");
//    output.open("output.out");
    

    ll n;
    cin >> n;

    vector<ll> a;
    for(ll i = 1; i <= sqrt(n); ++i){
        if(n%i == 0)
            pb(a,i+n/i - 2);
    }
    cout << *min_element(all(a));



//    input.close();
//    output.close();
//
    
    return 0;
}
    


Measured memory_bytes: 384
/*  ex9_2
    takafumi_ueki */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 100001
//リストのノードの定義
typedef struct node{
    char elem;
    struct node *next;
}node;
//プロトタイプ宣言
void push(node **first, char elem);
char pop(node **first);

int main(void){
    char cubes[SIZE],top;
    int i,num;
    int count = 0;
    //リストの先頭が指す先
    node *first = NULL;
    //cubeの状態を入力する
    scanf("%s",cubes);
    num = strlen(cubes);
    //状態の読み込み
    for(int i=0; i<num; i++)
        //空であればpushする。
        //追加予定の要素が先頭の要素と同じであればスタックにノードを追加する
        if(first == NULL || first->elem == cubes[i]){
            push(&first, cubes[i]);
        }
        //異なっている場合はスタックの先頭ノードを取り出す
        else if(first->elem != cubes[i]){
            top = pop(&first);
            count += 2;
        }
    //結果を出力する
    printf("%d\n", count);
    return 0;
}
//スタックにデータを追加する
void push(node **first, char elem){
    //領域の確保
    node *new = calloc(1, sizeof(node));
    if (new == NULL){
        exit(1);
    }
    new->elem = elem;
    new->next = *first;
    *first = new;
}
//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if (tmp == NULL){
        exit(1);
    }
    elem = tmp->elem;
    *first = tmp->next;
    //メモリを解放する
    free(tmp);
    return elem;
}

Measured memory_bytes: 4952
program abc121d
  integer(8) a, b, x(0:3), y(0:3)
  read *, a, b
  if (a > 0) a = a - 1
  x = [a, 1_8, a + 1, 0_8]
  y = [b, 1_8, b + 1, 0_8]
  print *, xor(x(mod(a, 4)), y(mod(b, 4)))
end program abc121d


Measured memory_bytes: 256
r,c = map(int,input().split())

table =[[] for i in range(r) ]
Csum = [0 for j in range(c+1)] #ここのインデックスを決める意味は？

for i in range(r):
	Tbls = input()
	table[i] = list(map(int,Tbls.split()))
	#print(Tbls, end = '')
	#print(' ', sum(table[i]), sep = ' ')
	print(Tbls,sum(table[i]),sep=' ')
	
	for j in range(c):
		Csum[j] += table[i][j]
		
	Csum[c] += sum(table[i])
	
print(' '.join(map(str,Csum)))


Measured memory_bytes: 5680
from collections import  deque
n=int(input())
a=list(map(int,input().split()))
cnt=0
judge=[]
for i in range(n-1):
    if a[i]<a[i+1]:
        flag=0
    elif a[i]>a[i+1]:
        flag=1
    elif a[i]==a[i+1]:
        continue
    if judge==[]:
        judge.append(flag)
    else:
        ff=judge.pop()
        if flag==ff:
            judge.append(flag)
        else:
            cnt+=1

print(cnt+1)

Measured memory_bytes: 14636
#include<iostream>
#define N_MAX 10000
#define Q_MAX 500
int count = 0;

void search(int array[],int n,int k){
    for(int i=0;i<n;i++){
        if(array[i] == k){
            count++;
            return;
        }
    }
}



int main(){
    int n,q;
    int s_array[N_MAX],t_array[Q_MAX];
    
    std::cin >> n;
    for(int i=0;i<n;i++){
        std::cin >> s_array[i];
    }
    
    std::cin >> q;
    for(int i=0;i<q;i++){
        std::cin >> t_array[i];
        search(s_array,n,t_array[i]);
    }
    
    std::cout << count << '\n';
    
    return 0;
}
    



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define MOD (ll)(1e9 + 7)
#define MAX (ll)(2e5 + 4)
#define INF (ll)(1e17)
using namespace std;
using ll =  long long;
using ld = long double;

int main () {
	string st;
	int k;
	cin >> st >> k;
	vector<int> ve;
	ll ans = 0;
	int cc = 1, n = st.size ();
	for (int i = 1; i < n; i++) {
		if (st[i] != st[i - 1]) {
			ve.push_back (cc);
			ans += cc / 2;
			cc = 0;
		}
		cc++;
	}
	ve.push_back (cc);
	if (ve.size () == 1) {
		cout << (ve[0] * 1LL *  k) / 2 << "\n";
		return 0;
	}
	ans += cc / 2;
	ans *= k;
	if (st[0] == st.back () && (ve[0] & 1) && (ve.back () & 1)) {
		ans += k - 1;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;



int main(){
  int a, b, c, d; cin >> a >> b >> c >> d;
  ll dp[3010][3010] = {};
  dp[a][b] = 1;
  for(int i=a+1; i<=c; i++){
    dp[i][b] = dp[i-1][b]*b%mod;
  }
  for(int i=b+1; i<=d; i++){
    dp[a][i] = dp[a][i-1]*a%mod;
  }
  for(int i=a+1; i<=c; i++){
    for(int j=b+1; j<=d; j++){
      dp[i][j] = (dp[i][j-1]*i%mod + dp[i-1][j]*j%mod)%mod - ((dp[i-1][j-1]*(i-1))%mod*(j-1)%mod);
      dp[i][j]+=mod; dp[i][j]%=mod;
    }
  }
  cout << dp[c][d] << endl;
}


Measured memory_bytes: 74396
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    m=n%100;
    m=(m+4)/5;
    n/=100;
    cout<<(n>=m)<<endl;

}   aryanc403();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll x,y; cin>>x>>y;
	ll cur = x;
	ll ans = 1;
	while(cur*2<=y)
	{
		cur*=2; ans++;
	}
	cout<<ans<<'\n';
}


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

int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  int C[26];
  int S[26][365];
  int T[365];
  int res_do[26];
  
  int min_num=100;
  int min_c =0;
  for(int i=0;i<26;i++){
    cin >> C[i];
    if(min_num>C[i]){
      min_c=i+1;
      min_num=C[i+1];
    }
  }
  
  
  
  int max_num;
  int max_s;
  
  
  for(int j=0;j<26;j++){
    res_do[j]=0;
  }
  
  for(int i=0;i<365;i++){
    max_num = 0;
    max_s = 26;
    for(int j=0;j<26;j++){
      cin >> S[j][i];
      if(max_num<S[j][i]+C[j]*res_do[j]){
        max_num=S[j][i]+C[j]*res_do[j];
        max_s=j;
      }
    }
    //cout << max_s <<":"<<max_num<<endl;
    T[i]=max_s;
    res_do[max_s]=0;
  }
  
  
  
  
  for(int i=0;i<365;i++){
    cout << T[i]+1 <<endl;
  }
  
  return 0;
}


int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


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

using namespace std;

int main() {
  unsigned long long A, B, K;
  cin >> A >> B >> K;

  unsigned long long resultA, resultB;
  if (A >= K) {
    resultA = A - K;
    resultB = B;
  } else if ((A + B) >= K) {
    resultA = 0;
    resultB = B - (K - A);
  } else {
    resultA = 0;
    resultB = 0;
  }

  cout << resultA << " " << resultB << endl;

  return 0;
}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        int[] abm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var A = abm[0];
        var B = abm[1];
        var M = abm[2];

        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();

        int[] x = new int[M];
        int[] y = new int[M];
        int[] c = new int[M];
        for (int i = 0; i < M; i++)
        {
            int[] tmp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            x[i] = tmp[0];
            y[i] = tmp[1];
            c[i] = tmp[2];
        }

        var ans = a.Min() + b.Min();
        for (int i = 0; i < M; i++)
        {
            ans = Math.Min(ans,a[x[i] - 1] + b[y[i] - 1] -c[i]);
        }


        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 38108
#include <iostream>
#include <map>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

string S;
int W;
map<string, int> P;
int i;

int number() {
  int n = S[i++] - '0';
  if('0' <= S[i] && S[i] <= '9') n = n * 10 + (S[i++] - '0');
  return n;
}

int atom() {
  string name = "";
  name += S[i++];
  if('a' <= S[i] && S[i] <= 'z') name += S[i++];
  return P[name] > 0 ? P[name] : -1;
}

int molecular() {
  int weight = 0, w, n;
  while(S[i] != ')' && i < S.length()) {
    if(S[i] == '(') {
      i++;
      w = molecular();
      i++;
      n = number();
    } else {
      if((w = atom()) == -1) return -1;
      n = ('0' <= S[i] && S[i] <= '9' ? number() : 1);
    }
    weight += w * n;
  }
  return weight;
}

int main(void) {
  while(cin >> S, S != "END_OF_FIRST_PART") {
    cin >> W;
    P[S] = W;
  }

  while(cin >> S, S != "0") {
    i = 0;
    int ans = molecular();
    if(ans > 0) cout << ans << endl;
    else cout << "UNKNOWN" << endl;
  }

  return 0;
}

Measured memory_bytes: 3160
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        int m,f,r;
        while (sc.hasNext()) {
            m = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
 
            if(m==-1||f==-1) {
                if(m==f&&f==r)
                    return;
                else
                    System.out.println("F");
                continue;
            }
 
            if(m+f>=80)
                System.out.println("A");
            else if(m+f>=65)
                System.out.println("B");
            else if(m+f>=50)
                System.out.println("C");
            else if(m+f>=30) {
                if(r>=50)
                    System.out.println("C");
                else
                    System.out.println("D");
            }else
                System.out.println("F");
        }
    }
}



Measured memory_bytes: 26448
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
//const long long mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお


const int mod = 1000000007;
const int MAX = 300001;
 
ll fc[MAX];
ll fci[MAX];
 
long long powmod(ll a,ll b){
  return b?powmod(a*a%mod,b/2)*(b%2?a:1)%mod:1;
}
 
void init_fact() {
    fc[0] = fc[1] = 1;
    for (int i=2; i<MAX; ++i) {
        fc[i] = (fc[i-1] * i) % mod;
    }
    fci[1] = 1;
    for (int i=2; i<MAX; ++i) {
        fci[i] = (fci[i-1] * powmod(i, mod-2)) % mod;
    }
}
 
ll C(ll n, ll k) {
    if (k == 0 || n == k) return 1;
    if(k < 0 || k > n) return 0;
    return ((fc[n] * fci[k] % mod) * fci[n-k]) % mod;
}
 
ll add(ll a, ll b) { return (a + b) % mod; }
ll sub(ll a, ll b) { return (a - b + mod) % mod; }
ll mul(ll a, ll b) { return (a * b) % mod; }
 
int main() {
    init_fact();
    int n, K; cin >> n >> K;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a));

    ll res = 0;
    // A[i]が最大値として選ばれる
    for (int i=K-1; i<n; ++i) {
        res = add(res, mul(a[i], C(i, K-1)));
    }
 
    // A[i]が最小値として選ばれる
    reverse(a.begin(), a.end());
    for (int i=K-1; i<n; ++i) {
        res = sub(res, mul(a[i], C(i, K-1)));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5376
#ABC126C-DiceAndCoin.py

from sys import stdin
import random

N,K = list(map(int, stdin.readline().split()))

result = 0
i,j = 0, N
X = []

while True:
    if j >= K/(2**i):
        k = int(j-(K/(2**i)-1))
        X.append(k)
        j -= k
    else:
        X.append(0)
    if K/(2**i) < 1:
        break
    i += 1

for i in range(len(X)):
    result += 0.5 ** i * X[i]
result = result * 1/N

print(result)


Measured memory_bytes: 3316
#include <cstdio>

const int MaxN = 100 + 5, MaxK = 100000 + 5;

int N, K;
int A[MaxN];
bool Dp[MaxK];

void init() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
}

void solve() {
  Dp[0] = false;
  for (int i = 1; i <= K; ++i) {
    Dp[i] = false;
    for (int j = 1; j <= N; ++j)
      if (i >= A[j] && Dp[i - A[j]] == false)
        Dp[i] = true;
  }
  puts(Dp[K] == true ? "First" : "Second");
}

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

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
	int a,b[3],c=0;
	cin >> a;
	b[2] = a % 10;
	a /= 10;
	b[1] = a % 10;
	a /= 10;
	b[0] = a % 10;
	for (int i = 0;i < 3;i++)
	{
		if (b[i] == 7)
		{
			cout << "Yes\n";
			c = 1;
			break;
		}
	}
	if (c == 0)cout << "No\n";
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    char ans;
    switch(N % 10){
        case 3:
            ans = 'b';
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            ans = 'p';
            break;
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            ans = 'h';
            break;
    }
    cout << ans << "on";
}

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

int n, counts = 0;
vector<int> a(500000);
vector<int> b(500000);

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a.at(i);

    int r = 1;

    for (int i = 0; i < n; ++i)
    {
        r = a.at(i);

        while(r%2 == 0) {
            r /= 2;
            counts++;
        }

        b.at(i) = counts;
    }

    cout << counts << endl;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;

int main(){
    string s;cin>>s;
    int n=s.size(),t=n;
    REP(i,s.size()-1) if(s[i]!=s[i+1]){
        t=min(t,max(i+1,n-i-1));
    }
    cout<<t<<endl;
}

Measured memory_bytes: 512
from itertools import product
V,E = map(int,input().split())
edges = [tuple() for _ in range(E)]
dist = [[float("inf")]*V for _ in range(V)]
for i in range(V):
    dist[i][i] = 0
for _ in range(E):
    s,t,d = map(int,input().split())
    dist[s][t] = d
for k,i,j in product(range(V),range(V),range(V)):
    if dist[i][k] != float("inf") and dist[k][j] != float("inf"):
        dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])
for i in range(V):
    if dist[i][i] < 0:
        print("NEGATIVE CYCLE")
        exit()
for i in range(V):
    ans = ["INF" if dist[i][j] == float("inf") else dist[i][j] for j in range(V)]
    print(" ".join(map(str, ans)))



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

int main(){
    string s;
    cin >> s;
    int n = s.length();
    vector<int> res(n,0);

    rep(i,n){
        if(s[i] == 'R'){
            int cnt = 0;
            int j = i;
            while(s[j] != 'L' && j < n){
                cnt++;
                j++;
            }
            while(cnt > 0){
                if(cnt%2==0)res[j]++;
                else res[j-1]++;
                cnt--;
            }
            i = j;
        }
    }
    reverse(s.begin(),s.end());

    rep(i,n){
        if(s[i] == 'L'){
            int cnt = 0;
            int j = i;
            while(s[j] != 'R' && j < n){
                cnt++;
                j++;
            }
            while(cnt > 0){
                if(cnt%2==0)res[n-(j+1)]++;
                else res[n-j]++;
                cnt--;
            }
            i = j;           
        }
    }    

    for(auto e : res){
        cout << e << " ";
    }                                                                                                                                                                   
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
#define PI 3.1415926535L

int main(){
	int a, b, h, m;
	long double csq, cosab;
	scanf("%d %d %d %d\n", &a, &b, &h, &m);
	csq = a*a + b*b -2.0L*a*b*(cosl((2.0L*PI*(h+m/60.0L)/12.0L)-(2.0L*PI*m/60.0L)));
	printf("%.16Lf\n", sqrtl(csq));
	return 0;
}


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

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

#define mx 10000007
#define inf 9000000000000000000

ll dp[mx];

int main() {
    int h, n; cin >> h >> n;
    vector <pii> vec;
    for (int i = 0; i < n; i++) {
        pii x; cin >> x.first >> x.second;
        vec.push_back(x);
    }

    dp[0] = 0;
    for (int i = 1; i <= h; i++) {
        dp[i] = inf;
        for (auto pp : vec) {
            ll a = pp.first;
            ll b = pp.second;
            if (i - a <= 0) dp[i] = min(dp[i], b);
            else dp[i] = min(dp[i], b + dp[i - a]);
        }
    }

    cout << dp[h] << endl;     
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(18);

	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
	return 0;
}

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

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

    vector<int> h(n), dp(n, 0x3f3f3f3f);
    for (int i = 0; i < n; i++)
        cin >> h[i];

    dp[0] = 0;
    for (int i = 1; i < n; i++){
        if (i - 2 >= 0)
            dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
        else
            dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
    }

    cout << dp[n - 1] << '\n';

    return 0;
}


Measured memory_bytes: 3924
import sys


def read():
    return sys.stdin.readline().rstrip()


def main():
    h, w = map(int, read().split())
    a = [[int(i) for i in read().split()] for _ in range(h)]
    b = []
    for i in range(1, h + 1):
        for j in range(1, w + 1):
            if a[i - 1][j - 1] % 2 == 0:
                continue
            if j < w:
                # a[i - 1][j - 1] -= 1
                a[i - 1][j] += 1
                b.append((i, j, i, j + 1))
            elif i < h:
                # a[i - 1][j - 1] -= 1
                a[i][j - 1] += 1
                b.append((i, j, i + 1, j))
    print(len(b))
    for bi in b:
        print(*bi)


if __name__ == '__main__':
    main()

Measured memory_bytes: 22688
K, N = map(int, input().split())
A = list(map(int, input().split()))

max_length = K + A[0] - A[N-1]
for i in range(N-1):
  length = A[i+1] - A[i]
  if max_length < length:
    max_length = length

answer = K - max_length
print(answer)

Measured memory_bytes: 26420
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef double db;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll qsm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n,m,k,rt;
int a[N];

int main(){
    scanf("%d",&n);
    int mn=n, ans=0;
    rep(i,1,n){
        scanf("%d",&a[i]);
        if(a[i]<=mn){
            ++ans;
            mn=a[i];
        }
    }
    printf("%d\n", ans);
    return 0;
}
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX (lld)1e18+7
#define lim (lld)1e9+7
#define MAX2 (lld)2e5+9
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

const lld mod=lim;

lld power(lld x, lld y, lld p)  
{   lld res = 1;     x = x % p; if (x == 0) return 0;  
  
    while (y > 0)  
    { if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;   }  
    return res;  } 


lld extend_gcd(lld a, lld b, lld& x, lld& y) {
    if (b == 0) { x = 1;y = 0;return a;}
    lld x1, y1;
    lld d = extend_gcd(b, a % b, x1, y1);
    x = y1; y = x1 - y1 * (a / b);return d;	}

lld rowNum[]={-1,0,0,1};
lld colNum[]={0,-1,1,0};

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

	std::vector<int> d1(n);
	std::vector<int> d2(n);

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

	int flag=0;
	for(int i=0;i<n-2;i++)
	{
		if(d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2]==d2[i+2])
			flag=1;
	}

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

Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
typedef struct node {
  long key;
  struct node *left;
  struct node *right;
} Node;
 
Node *root = NULL;
 
void insert(long key) {
  Node *newNode, *current;
 
  newNode = (Node *)malloc(sizeof(Node));
  newNode->key = key;
  newNode->left = NULL;
  newNode->right = NULL;
 
  if (root == NULL) {
    root = newNode;
    return;
  }
 
  current = root;
  while (1) {
    if (newNode->key < current->key) {
      if (current->left == NULL) {
    current->left = newNode;
    break;
      } else {
    current = current->left;
      }
    } else {
      if (current->right == NULL) {
    current->right = newNode;
    break;
      } else {
    current = current->right;
      }
    }
  }
  current = newNode;
 
}
 
void inorderTreeWalk(Node* node) {
  if (node != NULL) {
    inorderTreeWalk(node->left);
    printf(" %ld", node->key);
    inorderTreeWalk(node->right);
  }
}
 
void preorderTreeWalk(Node* node) {
  if (node != NULL) {
    printf(" %ld", node->key);
    preorderTreeWalk(node->left);
    preorderTreeWalk(node->right);
  }
}

int find(Node* node, int key) {
	if (node == NULL) {
		return 0;
	} else if (node->key == key) {
		return 1;
	} else if (node->key > key) {
		return find(node->left, key);
	} else {
		return find(node->right, key);
	}
}
 
int main(void) {
  int n, i;
  long arg;
  char command[80];
 
  scanf("%d", &n);
 
  for (i = 0; i < n; i++) {
    scanf("%s", command);
    if (strcmp(command, "insert") == 0) {
      scanf("%ld", &arg);
      insert(arg);
    } else if (strcmp(command, "find") == 0) {
    	scanf("%ld", &arg);
    	if (find(root, arg) == 1) {
    		printf("yes\n");
    	} else {
    		printf("no\n");
    	}
    } else {
      inorderTreeWalk(root);
      printf("\n");
      preorderTreeWalk(root);
      printf("\n");
    }
  }
 
 
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    char t;
    cin>>t;
    char ans;
    if (t == 'A') ans = 'T';
    if (t == 'T') ans = 'A';
    if (t == 'G') ans = 'C';
    if (t == 'C') ans = 'G';
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b,c;
  cin >> a >> b >> c;
  int ans = a+b;
  ans = min(ans,b+c);
  ans = min(ans,c+a);
  cout << ans;
  return 0;
}


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

int mod = 1000000007;
int n, m;
int a;
bool ng[100002];
int dp[100002];

signed main() {
	int i;
	
	cin >> n >> m;
	rep(i, m) {
		cin >> a;
		ng[a] = true;
	}
	
	dp[0] = 1;
	rep(i, n) {
		if (ng[i + 1] == false) (dp[i + 1] += dp[i]) %= mod;
		if (ng[i + 2] == false) (dp[i + 2] += dp[i]) %= mod;
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1152
# B - Trick or Treat
# https://atcoder.jp/contests/abc166/tasks/abc166_b
n, k = map(int, input().split())
snk = [0] * n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in range(d):
        snk[a[i] - 1] += 1

c = 0
for i in snk:
    if i == 0:
        c += 1
print(c)


Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<vector<int> > cnt;
vector<vector<int> > cnt2;
vector<string> field;

int main() {
    int H, W;
    cin >> H >> W;
    cnt.assign(H, vector<int>(W, -1));
    cnt2.assign(H, vector<int>(W, -1));
    field.resize(H);
    
    for(int h=0; h<H; h++) {
        cin >> field[h];
    }
    
    for(int h=0; h<H; h++) {
        for(int w=0; w<W; w++) {
            if(field[h][w]=='#') continue;
            if(w>=1 && field[h][w-1]!='#') {
                cnt[h][w] = cnt[h][w-1];
                continue;
            }
            int curw=w+1;
            int curcnt=1;
            while(curw<W) {
                if(field[h][curw]!='#') {
                    curcnt++;
                } else {
                    break;
                }
                curw++;
            }
            cnt[h][w] = curcnt;
        }
    }
    for(int w=0; w<W; w++) {
        for(int h=0; h<H; h++) {
            if(field[h][w]=='#') continue;
            if(h>=1 && field[h-1][w]!='#') {
                cnt2[h][w] = cnt2[h-1][w];
                cnt[h][w] += cnt2[h][w];
                continue;
            }
            int curh=h+1;
            int curcnt=0;
            while(curh<H) {
                if(field[curh][w]!='#') {
                    curcnt++;
                } else {
                    break;
                }
                curh++;
            }
            cnt2[h][w] = curcnt;
            cnt[h][w] += cnt2[h][w];
        }
    }
    int ans=0;
    for(int h=0; h<H; h++) {
        for(int w=0; w<W; w++) {
            ans = max(cnt[h][w], ans);
        }
    }
    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

void print_vec(vector<ll> &v){
    for(int i = 0; i < v.size()-1; i++){
        cout << v[i] << " ";
    }
    cout << v[v.size()-1] << endl;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i = 0; i < n; i++){
        a[i] = 2*n*i+1;
        b[i] = 2*n*(n-1-i)+1;
    }
    for(int i = 0; i < n; i++){
        ll p;
        cin >> p;
        p--;
        b[p] += i+1;
    }
    print_vec(a);
    print_vec(b);
    return 0;

}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int n,b,d,k,i,a;
string s;
int main()
{
	cin>>s;
	for(i=0;i<s.length();i++)
	  if(s[i]=='C') break;
	for(i;i<s.length();i++)
	  if(s[i]=='F') 
	  {
	    cout<<"Yes"<<endl;
	    return 0;
	  }
	cout<<"No"<<endl;
	return 0;
}

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

#include <boost/multiprecision/cpp_bin_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
using namespace boost::multiprecision;
using mydouble = cpp_bin_float_100;

int main() {
  mydouble a, b;
  cin >> a >> b;
  ll ans = (ll)(a * b);

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


Measured memory_bytes: 3836
import sys


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


C = iml(3)
b = [C[0][0], C[0][1], C[0][2]]
a = [0, C[1][0] - C[0][0], C[2][0] - C[0][0]]
for i in range(1, 3):
    for j in range(1, 3):
        if a[i] + b[j] != C[i][j]:
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 3064
import java.util.*;

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

    System.out.println( A % 3 == 0 || B % 3 == 0 || (A + B) % 3  == 0  ? "Possible":"Impossible" );
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;
const int MAXN = 100005;

int n; 
pi a[MAXN];

bool on(lint x, lint y){
	bool ans = 0;
	for(int i=0; i<n; i++){
		lint px = x - a[i].first;
		lint py = a[i].second - y;
		if(py >= 0 && px >= 0 && (px & py) == px) ans ^= 1;
	}
	return ans;
}

int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%lld %lld",&a[i].first,&a[i].second);
	}
	lint p = 1e17;
	lint y = (1ll << 60) - 1;
	for(int i=60; i>=0; i--){
		if(on(p + (1ll << i), -y)) p += (1ll << i);
	}
	cout << p - y << endl;
	
}


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

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

using namespace std;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    int X, N;
    cin >> X >> N;
    set<int> s;
    REP(_, N) {
        int p;
        cin >> p;
        s.insert(p);
    }
    int result;
    int min_d = INT_MAX;
    REP(i, 101 + 1) {
       if (s.count(i) == 0 && min_d > abs(X - i)) {
           min_d = abs(X - i);
           result = i;
       }
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, vs, n, m) vector<vector<T>> vs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cin(int, m);
    Cin(int, x);
    Cins(int, m, a);
    a.push_back(x);
    Sort(a);
    auto p = find(Range(a), x);
    Cout(min(distance(a.begin(), p), distance(p, a.end())-1));
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i, m, s, e;
    int S, T;

    scanf("%d%d%d%d", &i, &m, &s, &e);
    S = i + m + s + e;
    
    scanf("%d%d%d%d", &i, &m, &s, &e);
    T = i + m + s + e;

    if (S > T){
        printf("%d\n", S);
    }
    else{
        printf("%d\n", T);
    }
    
    return (0);
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

using namespace std;
const int maxi = 3005;
ll dp[maxi][maxi]={0};


/**

dp[l][r] = max( arr[l] + dp[l-1][r] , arr[r] -dp[l][r-1] )

maximum of difference of if we choose left and the opponents choice or if we choose right  and opponents choice

dp[i][j] is storing the maximum difference for every j in arr.
so the answer will be dp[0][n-1]

**/


int main()
{
    fast;
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }

    for(int l=n-1;l>=0;l--)
    {
        for(int r =l;r<n;r++)
        {
            if(l==r)
            {
                dp[l][r] =arr[l];
            }
            else
            {
                dp[l][r] = max(arr[l] - dp[l+1][r] , arr[r] - dp[l][r-1]);
            }
        }
    }
    cout<<dp[0][n-1];

}



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

int main(){
	
	int W, H, x, y, r ;
	int tmp;
	cin >> W >> H >> x >> y >> r;
	
	if(x-r < 0 || x + r > W || y - r < 0 || y + r >H){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using llu = long long unsigned int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

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

    if( a == 1 || b == 1 ){
        printf ("%d\n", 1);
        return 0;
    }
    ll ans = 0;
    ans += ((a+1)/2)*((b+1)/2);
    ans += (a/2)*(b/2);
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 256