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

int main(){
  int a, b, k;
  cin >> a >> b >> k;
  for(int i = 0; i < k; i++){
    if(a & 1) a--;
    a /= 2;
    b += a;
    swap(a, b);
  }
  
  if(k & 1) swap(a, b);
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    int n=s.size();
    int ans=1000;
    for (int i=0;i<=n-3;i++) {
        int a=stoi(s.substr(i,3));
        ans=min(ans,abs(a-753));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
template<typename T> class UpdateInterval
{
public:
using ptt = pair<T,T>;
    // 1の区間をsetで保持
    set<ptt> st;
    UpdateInterval(){};
    // [l,r) を k ({0,1})に更新
    void update(ptt a,int k){
        T l = a.first;
        T r = a.second + 1;
        T lb = l, rb = r;
        while(1){
            auto it = st.lower_bound(ptt(l, numeric_limits<T>::min()));
            if(it == st.end()){
                break;
            }
            ptt p = *it;
            if(p.first > r){
                break;
            }
            st.erase(it);
            if(p.second > r){
                rb = max(rb, p.second);
                if(!k) st.insert(ptt(r,p.second));
                break;
            }
        }
        auto it = st.lower_bound(ptt(l, numeric_limits<T>::min()));
        if(it != st.begin()){
            --it;
            ptt p = *it;
            if(p.second >= l){
                st.erase(it);
                if(!k) st.insert(ptt(p.first,l));
                lb = min(lb, p.first);
            }
            if(p.second > r){
                if(!k) st.insert(ptt(r,p.second));
                rb = max(rb, p.second);
            }
        }
        if(k) st.insert(ptt(lb,rb));
    }
};
int main(){
    ll n, x, d;
    cin >> n >> x >> d;
    if(d == 0){
        if(x == 0){
            cout << 1 << endl;
        }else{
            cout << n + 1 << endl;
        }
        return 0;
    }
    map<ll,UpdateInterval<ll>>mp;
    for(ll i = 0; i <= n; i++){
        auto p = minmax({x * i / d + (i - 1) * i / 2, x * i / d + ((n - 1) * n / 2 - (n - i - 1) * (n - i) / 2)});
        show(p);
        mp[x * i % d].update(p, 1);
    }
    ll ans = 0;
    for(auto x: mp){
        for(auto y : x.second.st)ans += y.second - y.first;
    }
    cout << ans << endl;
}


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

int main() {
    int N, M;
    auto exist = false;
    cin >> N >> M;

    vector<int> num(N, -1);
    for (int i = 0; i < M; ++i) {
        int s, c;
        cin >> s >> c;

        if (num[s - 1] == -1) {
            num[s - 1] = c;
        } else if (num[s - 1] != c) {
            goto error;
        }
    }

    if (1 < N && num[0] == 0) {
        goto error;
    }

    if (1 < N && num[0] == -1) {
        num[0] = 1;
    }

    for (auto v : num) {
        cout << (v == -1 ? 0 : v);
    }

    cout << endl;
    return 0;
error:
    cout << -1 << endl;
    return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[100005],b[100005];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	int ans=a[1];
	for(int i=2;i<n;i++)
	{
		if(i%2==0)
		{
			ans-=a[i];
		}
		else
		{
			ans+=a[i]; 
		} 
	}
	ans+=a[n];
	b[1]=ans;
	for(int i=1;i<n;i++)
	{
		b[i+1]=2*(a[i]-b[i]/2);
	}
	for(int i=1;i<=n;i++)
	{
		cout<<b[i]<<" ";
	}
	return 0;
}

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

int main() {
  for(;;) {    
    pair<int,int> v[5];
    
    for(int i = 0; i < 5; i++) {
      int a, b;
      cin >> a >> b;
      if( a == 0 && b == 0 ) goto END;
      v[i] = make_pair(a + b, i);
    }
    sort( v, v + 5 );
    cout << (char)('A' + v[4].second) << " " << v[4].first << endl;
  }

 END:
  return 0;

}

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

int main()
{
  int n;
  cin>>n;
  int a[n];
  int i,first,second;
  cin>>a[0]>>a[1];
  if(a[0]>=a[1]){
    first=a[0];second=a[1];
  }
  else{
    first=a[1];second=a[0];
  }
  for(i=2;i<n;i++){
    cin>>a[i];
    if(a[i]>=first){
      second=first;first=a[i];
    }
    else if(a[i]<first&&a[i]>=second){
      second=a[i];
    }
  }
  int j=0;
  for(i=0;i<n;i++){
    if(a[i]==first) j++;
  }
  for(i=0;i<n;i++){
    if(a[i]==first&&j==1){
      cout<<second<<'\n';
    }
    else{
      cout<<first<<'\n';
    }
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 2432
from numpy import*;B=searchsorted;a,b=split(int32(open(0).read().split()[1:]),2);c=0
for k in range(29):l=2**k;h=2*l;y=sort(hstack((b%h-h,b%h)));c+=sum(B(y,h-a%h)-B(y,l-a%h))%2*l
print(c)

Measured memory_bytes: 59252
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	switch s {
	case "SUN":
		fmt.Println("7")
	case "MON":
		fmt.Println("6")
	case "TUE":
		fmt.Println("5")
	case "WED":
		fmt.Println("4")
	case "THU":
		fmt.Println("3")
	case "FRI":
		fmt.Println("2")
	case "SAT":
		fmt.Println("1")
	default:
		fmt.Println("default")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define x first
#define y second
#define sz(a) ((int)(a.size()))
#define OTIMIZA 2
#define INSERE 1
#define REMOVE 0
#define move aslzxc
int main()
{
	int n , m;
	cin >> n >> m;
	vector<int> a(n);
	int tot = 0;
	for(auto &x : a)
	{
		cin >> x;
		tot += x;
	}
	sort(a.begin() , a.end());
	if(a[n - m] * 4 * m >= tot)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
}


Measured memory_bytes: 256
// ABC094 A
    #include <iostream> 
    #include <string>
    using namespace std;    
        
    int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c-a<=b&&c>=a){
    cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
}
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;

int main(){
    string s,t;
    cin >> s >> t;
    vector<vector<int>> a(26,vector<int>(0));
    vector<pair<int,string>> dp(3010);
    dp.at(0).first=-1;
        rep(j,3009) dp.at(j+1).first=inf;
    rep(i,s.size()) {
        int f=s.at(i)-'a';
        a.at(f).push_back(i);
    }
    rep(i,t.size()){
        rep(j,3005){
            int f=t.at(i)-'a';
            if (dp.at(3004-j).first==inf) continue;
            auto it=upper_bound(all(a.at(f)),dp.at(3004-j).first);
            if (it==a.at(f).end()) continue;
            if (dp.at(3005-j).first>*it){
                dp.at(3005-j).first=*it;
                dp.at(3005-j).second=dp.at(3004-j).second;
                dp.at(3005-j).second.push_back(t.at(i));
            }
        }
    }
    rep(i,3010) {
        if (dp.at(3009-i).first!=inf) {cout << dp.at(3009-i).second << endl; return 0;}
    }
}


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

class Team {
public:
  int time;
  int id;
  bool operator <(const Team &t) const {
    return time < t.time;
  }
};

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    Team t[n];
    for(int i = 0; i < n; i++) { 
      int c;
      cin >> c;
      t[i].id = c;
      t[i].time = 0;
      for(int j = 0; j < 4; j++) {
	int s, m;
	cin >> m >> s;
	t[i].time += s + m * 60;
      }
    }
    sort(&t[0], &t[n]);
    cout << t[0].id << endl;
    cout << t[1].id << endl;
    cout << t[n-2].id << endl;
  }
  return 0;
}

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

int main(void)
{
    using namespace std;
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;

    vector<int> A_apple(A);
    vector<int> B_apple(B);
    vector<int> C_apple(C);

    for (int i = 0; i < A; i++) {
        cin >> A_apple.at(i);
    }
    for (int i = 0; i < B; i++) {
        cin >> B_apple.at(i);
    }
    for (int i = 0; i < C; i++) {
        cin >> C_apple.at(i);
    }
    sort(A_apple.rbegin(), A_apple.rend());
    sort(B_apple.rbegin(), B_apple.rend());
    
    for (int i = 0; i < X; i++) {
        C_apple.push_back(A_apple.at(i));
    }
    for (int i = 0; i < Y; i++) {
        C_apple.push_back(B_apple.at(i));
    }

    sort(C_apple.rbegin(), C_apple.rend());

    long long int res = 0;
    for (int i = 0; i < X + Y; i++) {
        res += C_apple.at(i);
    }

    cout << res << "\n";

}

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

using namespace std;

int main(){
  int N,M,X; cin>>N>>M>>X;

  vector<int> cost(N+1,0);
  
  for(int i=0;i<M;i++){
    int temp; cin>>temp;
    cost[temp]=1;
  }

  int a=0,b=0;

  for(int i=X;i<=N;i++){
    a+=cost[i];
  }
  for(int i=X;i>=0;i--){
    b+=cost[i];
  }

  cout<<min(a,b)<<endl;

  return 0;
}


Measured memory_bytes: 256
fun main() {
    val input2 = rspint()
    function(input2)
}

fun function(in1: List<Int>) {
    var thp = in1[0]
    var ahp = in1[2]
    var tatk = true
    while (thp > 0 && ahp > 0) {
        if (tatk) {
            ahp -= in1[1]
        } else {
            thp -= in1[3]
        }
        tatk = !tatk
    }
    println(if (thp <= 0) "No" else "Yes")
}

inline fun rsp() = readLine()!!.split(" ")

inline fun rspint() = rsp().map(String::toInt)

Measured memory_bytes: 36376
#include <cstdio>
#include <algorithm>
using namespace std;

int read(){
	char c;while(c=getchar(),c<'0'||c>'9');
	int x=c-'0';while(c=getchar(),c>='0'&&c<='9')x=x*10+c-'0';
	return x;
}

const int Maxn=2*1e5+5;
int N,A[Maxn],f[Maxn],B[Maxn],Mx;
int main()
{
	N=read();for(int i=1;i<=N;i++)A[i]=read(),B[A[i]]=i;
		for(int i=1;i<=N;i++){
			if(B[i]>B[i-1])f[i]=f[i-1]+1;
			else f[i]=1;
		}
		for(int i=1;i<=N;i++)Mx=max(Mx,f[i]);
	printf("%d",N-Mx);
	return 0;
}

Measured memory_bytes: 2560
while True:
    n = input().split()
    a,b = int(n[0]),int(n[1])
    if a == 0 and b == 0:
        break
    elif a == 0 or b ==0:
        print()
    else:
        for i in range(a):
            if i == 0 or i == a-1:
                print('#' * b)
            else:
                print('#{0}#'.format('.'*(b-2)))
        print()
    

Measured memory_bytes: 7592
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string sa,sb,sc;
void input(){
    fast_io();
    cin >> sa >> sb >> sc;
}

string winner;

void rec(char x){
    if(x=='a') {
        if(sa.size()==0) {winner = "A";return;}
        char y = sa[0];
        sa = sa.substr(1);
        rec(y);
        }
    if(x=='b') {
        if(sb.size()==0) {winner = "B";return;}
        char y = sb[0];
        sb = sb.substr(1);
        rec(y);
        }
    if(x=='c') {
        if(sc.size()==0) {winner = "C";return;}
        char y = sc[0];
        sc = sc.substr(1);
        rec(y);
        }

}

int solve(){
    rec('a');
    cout << winner << endl;
    return 0;
}   

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------
ll gcd(ll x, ll y){
  if(x<y){return gcd(y,x);}
  if(y==0 || x==y) {return x;}
  else {return gcd(y, x%y);}
}

ll lcm(ll x, ll y){
  return x*y/gcd(x, y);
}

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

  prt(lcm(a,b));
}


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

long long int
gcd ( long long int a, long long int b )
{
  long long int c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}


int main(){
  long long int n,k;
  long long int g;
  cin>>n>>k;
  cin>>g;
  long long int m=g;
  for(long long int i=0;i<n-1;i++){
    long long int a;
    cin>>a;
    m=max(m,a);
    g=gcd(g,a);
  }

  if(k<=m&&k%g==0){
    cout<<"POSSIBLE"<<endl;
  }else{
    cout<<"IMPOSSIBLE"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
a=[int(i) for i in input().split()]
a.sort(reverse=True)

n1=a[0]-a[1]
n2=a[0]-a[2]
n0=a[1]-a[2]
if (n1 + n2) % 2 ==0:
  print(int((n1+n2)/2))
else:
  print(int((n1+n2+1)/2+1))

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

int main() 
{
    // Sort works on first element of pair
    ll n, m;
    cin >> n >> m;
    vector<pair<ll,ll>> v;
    ll min = 1000000;
    for (ll i=0; i<n; i++)
    {
        ll a,b;
        cin >> a >> b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(), v.end());
    ll sum=0, drinks=0;
    for (ll i=0; i<n; i++)
    {
        if (drinks+v[i].second>m)
        {
            ll diff = m-drinks;
            sum += v[i].first * diff;
            break;
        }
        sum += v[i].first * v[i].second;
        drinks += v[i].second;
    }
    cout << sum;
    return 0;
}

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

using namespace std;

int main(void)
{
    int N, diff_count = 0;
    cin >> N;
    vector<int> p(N);
    vector<int> tmp(N);
    for (int count = 0; count < N; count++)
    {
        cin >> p.at(count);
        tmp.at(count) = p.at(count);
    }
    sort(tmp.begin(), tmp.end());
    for (int count = 0; count < N; count++)
    {
        if (p.at(count) != tmp.at(count))
        {
            diff_count++;
        }
    }
    if (diff_count <= 2)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a, b;
	char op;
	for (; ; ) {
		cin >> a >> op >> b;
		if (op == '+') {
			cout << a + b << endl;
		}
		if (op == '-') {
			cout << a - b << endl;
		}
		if (op == '*') {
			cout << a * b << endl;
		}
		if (op == '/') {
			cout << a / b << endl;
		}
		if (op == '?') {
			break;
		}
	}
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

int x, y, z;
int v[4];
int e[60], a[60];

double dp[60][10010];
double calc(int p, int q)
{
	if (p >= y) return q;
	if (dp[p][q] != -1) return dp[p][q];
	double s = 0;
	rep(i, x){
		int np = p + v[i];
		int nq = q;
		if (e[np] == 1) np += a[np];
		else if (e[np] == 2) nq += a[np];
		else if (e[np] == 3) nq = max(0, nq - a[np]);
		s += calc(np, nq) / x;
	}
	return dp[p][q] = s;
}

int main()
{
	while (cin >> x >> y >> z, x){
		memset(e, 0, sizeof(e));
		rep(i, x) cin >> v[i];
		rep(i, z){
			int ni, ei, ai;
			cin >> ni >> ei >> ai;
			e[ni] = ei;
			a[ni] = ai;
		}
		fill_n(*dp, 60 * 10010, -1);
		cout << (int)calc(0, 0) << endl;
	}
}

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

using namespace std;

int main(){
    string S,T;
    cin >> S;
    cin >> T;
    int cnt = 0;

    int ans = T.length();
    for(int i=0;i<S.length()-T.length()+1;i++){
        cnt=0;
        for(int j=0;j<T.length();j++){
            if(S[j+i] == T[j]){
                cnt++;
            }
        }
        if(ans > T.length()-cnt){
            ans = T.length()-cnt;
        }
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3612
# -*- coding: utf-8 -*-
import math
import datetime
import itertools
import sys
import copy

# 入力
#N = int(input())
#S = str(input())
#N, A, B = map(int, input().split())
N = int(input())
L = list(map(int, input().split()))

#if N == 1 and L[0] == 1 :
#  print (0)
#  exit()

index = 1
cnt = 0
for i in range(N) :
  if L[i] == index :
    index += 1
    cnt += 1

if cnt == 0 :
  print (-1)
else :
  print (N-cnt)



Measured memory_bytes: 87788
N=gets.to_i
as=N.times.map{gets.split.map(&:to_i)}
sum=0
as.permutation(N) do |es|
    cnt=0
    (N-1).times do |i|
        cnt+=((es[i][0]-es[i+1][0])**2+(es[i][1]-es[i+1][1])**2)**(1/2.0)
    end
    sum+=cnt
end
puts sum/(1..N).to_a.inject(&:*)

Measured memory_bytes: 2172
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val d = Array(n) { Array(2) { sc.nextInt() } }
    for (i in 0 until n - 2) {
        if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1]) {
            println("Yes")
            return
        }
    }
    println("No")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 34404
a = int(input()) # 500
b = int(input()) # 100
c = int(input()) #  50
x = int(input())

ans = 0

for i in range(a+1):
    I = i*500
    for j in range(b+1):
        J = j*100
        for k in range(c+1):
            K = k*50
            if I+J+K == x:
                ans +=1

print(ans)


Measured memory_bytes: 3060
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	string ans;
	if (S[2] == S[3] && S[4] == S[5]) {
		ans = "Yes";
	} else {
		ans = "No";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		String S, T;
		int count= 0;
		Scanner scan = new Scanner(System.in);
		S=scan.nextLine();
		T=scan.nextLine();
		for (int i= 0; i<S.length();i++) {
			if(S.charAt(i)==T.charAt(i)) {
				++count;
			}
		}
		System.out.println(count);

	}

}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    int n,m;
    cin >> n >> m;
    cout << (n-1) * (m-1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath> //abs();
using namespace std;

int main(void)
{
    long long int a,b,c,d,i,j,k,n,x[10];
    string s;
    char C[5];

    cin >> a >> b;

    if(!(a%3) || !(b%3) || !((a+b)%3) ) cout << "Possible";
    else cout << "Impossible";

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

public static class QuickUnionUF {

    private int[] id;
    private int[] sz;

    public QuickUnionUF(int N) {
        id = new int[N];
        sz = new int[N];
        for (int i = 0; i < N; i++) {
            id[i] = i;
            sz[i] = 0;
        }
    }

    public void union(int p, int q) {
        int i = root(p);
        int j = root(q);

        if (i == j) return;
        if (sz[i] < sz[j]){
            id[i] = j;
            sz[j] += sz[i];
        }
        else {
            id[j] = i;
            sz[i] += sz[j];
        }
    }

    private int root(int i) {
        while (i != id[i])
            i = id[i];
        return i;
    }

    public boolean connected(int p, int q) {
        return root(p) == root(q);
    }
}


    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();
//        QuickFindUF uf = new QuickFindUF(N);
        QuickUnionUF uf = new QuickUnionUF(N);

        // input
        for (int i = 0; i < M; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            uf.union(p, q);
        }

        // Query
        int Q = scanner.nextInt();
        for (int i = 0; i < Q; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            if (uf.connected(p,q))
                System.out.print("yes\n");
            else
                System.out.print("no\n");
        }
    }
}

Measured memory_bytes: 102928
using System;

class Program
{
    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string[] inputArray = Console.ReadLine().Split(' ');
        int[] intArray = new int[n];
        for (int i = 0; i < n; i++)
        {
            intArray[i] = int.Parse(inputArray[i]);
        }
        Console.WriteLine(JudgeNum(intArray));
    }

    public static int JudgeNum(int[] ary)
    {
        if (ary.Length % 2 == 1)
        {
            return 0;
        }
        Array.Sort(ary);
        int half = ary.Length / 2;
        return ary[half] - ary[half - 1];
    }
}

Measured memory_bytes: 16864
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

bool gFlag[3];
int judge(int num, int depth) {
    if (num == 0) return 0;

    int p = num % 10;
    if (p == 3) {
        gFlag[0] = true;
        return judge(num / 10, depth + 1);
    }
    if (p == 5) {
        gFlag[1] = true;
        return judge(num / 10, depth + 1);
    }
    if (p == 7) {
        gFlag[2] = true;
        return judge(num / 10, depth + 1);
    }

    return depth;
}

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

    int step[10];
    step[0] = 1;
    for (int i = 1; i < 10; i++) {
        step[i] = 10 * step[i-1];
    }

    int ans = 0;
    int num = 1;
    while (num <= N) {
        gFlag[0] = false;
        gFlag[1] = false;
        gFlag[2] = false;
        int depth = judge(num, 1);
        if (depth == 0) {
            if (gFlag[0] && gFlag[1] && gFlag[2]) ans++;
            num += 2;
        } else {
            num += step[depth - 1];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
 
 
int main(){
	
	int n;
	cin >>n;
	
	vector<int> R(n);
	for(int i=0; i<n; i++){
		
		cin >>R.at(i);
		
	}
	
	int maxv = -1000000001;
	int minv =R.at(0);
	
	for(int j=1;j<n;j++){
		
		maxv=max(R.at(j)-minv,maxv);
		minv=min(minv,R.at(j));
		
	}
	
	cout <<maxv <<endl;
	return 0;
	
}


Measured memory_bytes: 3544
N = int(input())
A = sorted(list(map(int,input().split())))
ans = "YES"

for i in range(1,N,2):
    boollist = [ A[i-1] == A[i] ]
    if i < N-1 :
        boollist.append(A[i] == A[i+1])
    if any(boollist):
        ans = "NO"
        break
print(ans)

Measured memory_bytes: 31100
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def print_array(a):
    print(" ".join(map(str, a)))


def selectionsort(arr, n):
    a = arr[:]
    s = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            (a[i], a[minj]) = (a[minj], a[i])
            s += 1
    return (a, s)


def main():
    n = int(input())
    arr = list(map(int, input().split()))
    (a, s) = selectionsort(arr, n)
    print_array(a)
    print(s)


if __name__ == "__main__":
    main()

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

using namespace std;

int count(int now, int depth, vector<vector<bool>>& graph, vector<bool>& used){
  int n = (int)graph.size();
  if(n == depth) return 1;
  int ret = 0;
  for(int i = 0; i < n; i++){
    if(!used[i] && graph[now][i]){
      used[i] = true;
      ret += count(i, depth + 1, graph, used);
      used[i] = false;
    }
  }
  
  return ret;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<bool>> graph(N, vector<bool>(N, false));
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    graph[a][b] = graph[b][a] = true;
  }
  
  vector<bool> used(N, false);
  used[0] = true;
  cout << count(0, 1, graph, used) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
struct Top2Info {
	int first = 0;
	int max = 0, secondMax = 0;
};

Top2Info examineTop2(const std::array<int, 26>& candidates);

int main() {
	int n;
	while (std::cin >> n && n) {
		std::array<int, 26> candidates{0};
		bool isOk = false;
		for (int i = 0; i < n && !isOk; i++) {
			char vote;
			std::cin >> vote;
			vote -= 'A';
			candidates[vote]++;

			//?????????2????\¨??°??¨?????????????????????????£????????????????
			auto&& top2 = examineTop2(candidates);

			//??????????\¨?????¨???2???????????\????????????
			int assumedMax = top2.secondMax + (n - i - 1);

			//?¢????
			if (top2.max > assumedMax) {
				std::cout << static_cast<char>(top2.first + 'A') << " " << i + 1 << std::endl;
				isOk = true;
				//?????£????????\????????\??????
				for (int j = i; j < n - 1; j++) std::cin >> vote;
				break;
			}
		}
		//?¢???????????????£???
		if (!isOk) {
			std::cout << "TIE" << std::endl;
		}
	}

	return 0;
}

Top2Info examineTop2(const std::array<int, 26>& candidates)
{
	Top2Info info;

	//????????¢?????????????????¢???
	for (int i = 0; i < candidates.size(); i++) {
		if (info.max < candidates[i]) {
			info.max = candidates[i];
			info.first = i;
		}
	}

	//2??????
	for (int i = 0; i < candidates.size(); i++) {
		if (info.secondMax < candidates[i] && info.first != i) {
			info.secondMax = candidates[i];
		}
	}
	return info;
}

Measured memory_bytes: 3072
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
int main()
{
	int n;
	while(1)
	{
		cin >> n;
		if(n==0)break;
		vector<int> vec(n);
		for(int i=0;i<n;i++)cin >> vec[i];
		sort(all(vec));
		cout << accumulate(vec.begin()+1,vec.end()-1,0)/(n-2) << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n;cin>>n;
    ll a[n];
    map<ll,ll> mp;
    ll ma=0,num=-1;
    vector<ll> v;
    set<ll> st;
    rep(i,0,n){
        cin>>a[i];
        mp[a[i]]++;
        if(ma<a[i]){
            ma=a[i];
            v.push_back(i);
        }
        st.insert(a[i]);
    }
    ll ans[n];
    fill(ans,ans+n,0);
    auto itr=st.end();
    itr--;
    num=v.size()-1;
    ll sum=0;
    
    for(;;){
       // cout<<sum<<endl;
        if(num==0){
            ans[0]+=sum*(*itr);
            for(;;){
                
                ans[0]+=mp[*itr]*(*itr);
                //cout<<ans[0]<<" "<<" "<<mp[*itr]<<" "<<*itr<<endl;;
                if(itr==st.begin())break;
                itr--;
            }
            break;
        }
        ll y=a[v[num-1]];
        ans[v[num]]+=sum*(*itr-y);
       // cout<<*itr<<endl;
        while(*itr!=y){
            ans[v[num]]+=mp[*itr]*(*itr-y);
            //cout<<mp[*itr]*(*itr-y)<<" ";
            sum+=mp[*itr];
            itr--;
        }
        num--;
    }
    rep(i,0,n)cout<<ans[i]<<endl;
}



Measured memory_bytes: 14324
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

using Graph = vector<vector<int>>;

int main() {
    int n,m;
    cin>>n>>m;
    Graph G(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> dist(n,-1);
    queue<int> que;

    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    vector<int> ans(n,0);
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            ans[nv]=v+1;
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    cout<<"Yes"<<endl;
    for(int i=1;i<n;i++) cout<<ans[i]<<endl;

}



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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001
#define int ll
int N;
int A[maxn];
int32_t main(){
	fast;
	
	cin>>N;
	FOR(i,0,N-1) cin>>A[i];
	
	sort(A,A+N,greater<int>());
	
	priority_queue <int> pq;
	
	pq.push(A[0]);
	int ans = 0;
	FOR(i,1,N-1){
		ans += pq.top(); pq.pop(); pq.push(A[i]); pq.push(A[i]);
	}
	cout<<ans;
		
	
	
}


Measured memory_bytes: 6888
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0)
    return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1; // 分母
  ll numerator = 1;   // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
private:
  vector<ll> parents;

public:
  UnionFind(ll n) : parents(n, -1) {}

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

  bool merge(ll x, ll y) {
    if (issame(x, y))
      return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry])
      swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) {
    return -parents[root(x)];
  }

private:
  ll root(ll x) {
    if (parents[x] < 0)
      return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

void dfs(ll N, ll current, ll used, ll &ans) {
  if (current > N) {
    return;
  }
  if ((used & 0b111) == 0b111) {
    ans++;
  }

  dfs(N, current * 10 + 7, used | 0b001, ans);
  dfs(N, current * 10 + 5, used | 0b010, ans);
  dfs(N, current * 10 + 3, used | 0b100, ans);
}

int main() {
  ll N;
  cin >> N;
  ll ans = 0;
  dfs(N, 0, 0b000, ans);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
ans = 0
for i in range(n):
    if a_list[i] + a_list[i + 1] > b_list[i]:
        ans += b_list[i]
        a_list[i + 1] = min(a_list[i + 1], a_list[i] + a_list[i + 1] - b_list[i])
    else:
        ans += a_list[i] + a_list[i + 1]
        a_list[i + 1] = 0
print(ans)

Measured memory_bytes: 19156
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

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

    int x; cin >> x;
    cout<<(x^1)<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, m;
  cin >> n >> m;
  vi p(m), y(m);
  rep(i, m) cin >> p[i] >> y[i];
  vector<vi> pres(n + 1);
  rep(i, m) pres[p[i]].push_back(y[i]);
  rep(i, n + 1) sort(all(pres[i]));
  rep(i, m) {
    int cid = lower_bound(all(pres[p[i]]), y[i]) - pres[p[i]].begin();
    printf("%06d%06d\n", p[i], cid + 1);
  }
}

Measured memory_bytes: 7808
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ull i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;


int main() {
    #ifndef ONLINE_JUDGE
	// freopen("test.in", "r", stdin);
    #endif
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vi nums(n, -1);
    int m; cin >> m;
    bool valid = true;
    for_(i, 0, m) {
        int s, c; cin >> s >> c;
        s -= 1;
        if (nums[s] == -1 or nums[s] == c) nums[s] = c;
        else {
            valid = false;
            break;
        }
    }
    
    if (nums[0] == 0 and n != 1) valid = false;
    if (!valid) cout << -1 << endl;
    else {
        if (nums[0] == -1) {
            if (n > 1) nums[0] = 1;
            else nums[0] = 0;
        }

        for_(i, 0, n) cout << (nums[i] == -1 ? 0 : nums[i]);
        cout << endl;
    }


    return 0;
}

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

int main() {
    int a,b;
    std::cin >> a >> b;
    if(a == b)
        std::cout << "a == b" << std::endl;
    else if(a > b)
        std::cout << "a > b" << std::endl;
    else
        std::cout << "a < b" << std::endl;
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int R;
    cin >> R;
    std::cout << std::fixed << std::setprecision(15);
    cout << 2 * M_PI * R << endl;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
    cout<<"hon"<<endl;
  else if(n%10==0||n%10==1||n%10==6||n%10==8)
    cout<<"pon"<<endl;
  else if(n%10==3)
    cout<<"bon"<<endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005;
int now,n,son[N][2],sc,dep[N];
char s[N];
ll L,ans;
void ins(char *s)
{
	now=0;int len=strlen(s);
	for (int i=0;i<len;i++)
	{
		int c=s[i]-'0';
		if (!son[now][c]) son[now][c]=++sc,dep[sc]=dep[now]+1;
		now=son[now][c];
	}
}
ll sg(ll x){return x&(-x);}

void dfs(int now)
{
	int cnt=0;
	if (son[now][0]){
		dfs(son[now][0]);
		cnt++;
	}
	if (son[now][1]){
		dfs(son[now][1]);
		cnt++;
	}
	if (cnt==1){//切下一半的子树
		ans^=sg(L-dep[now]); 
	} 
}

int main()
{
	scanf("%d%lld",&n,&L);
	for (int i=1;i<=n;i++){
		scanf("%s",s);
		ins(s);
	}
	dfs(0);
	puts(ans==0?"Bob":"Alice"); 
	return 0;
}

Measured memory_bytes: 3072
s=input()

chk=0
  
for i in range(len(s)):
	if i%2==0 and s[i]=='L':
		print('No')
		chk=1
		break
	if i%2!=0 and s[i]=='R':
		print('No')
		chk=1
		break
    
if chk==0:
	print('Yes')

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N; cin >> N;
  vector<int> d(N); rep(i,N) cin >> d[i];
  ll ans = 0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      ans += d[i]*d[j];
    }
  }
  cout << ans << endl;
  return 0;
}


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 n, k;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    int dis = 0;
    rep(i, n)
    {
        if (i < n - 1)
            dis = max(dis, abs(a[i] - a[i + 1]));
        else
            dis = max(dis, abs(a[0] + k - a[i]));
    }
    cout << k - dis << endl;
    return 0;
}

Measured memory_bytes: 4040
#include<stdio.h>
typedef struct{
  int value;
  char moji;
}C;
main()
{
  int i,j,n,flag=0,x,minj,count;
  char c;
  C C[36],M[36];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&C[i].moji,&C[i].value);
    M[i]=C[i];
  }
  flag=1;
  i=0;
  while(flag){
    flag=0;
    for(j=n-1;j>=i+1;j--){
      if(C[j].value<C[j-1].value){
    x = C[j].value;
    c = C[j].moji;
        C[j].value= C[j-1].value;
    C[j].moji= C[j-1].moji;
    C[j-1].value= x;
    C[j-1].moji= c;
        flag=1; 
    count++;     
      }   
    }
    i++;  
  }
   
    for(i=0;i<n;i++){
    printf("%c%d",C[i].moji,C[i].value); 
  if(i==n-1)
      printf("\n");
    else
      printf(" ");
  }
  printf("Stable\n");
   
  for(i=0;i<=n-1;i++){
    minj=i;
    flag=0;
    for(j=i;j<=n-1;j++){
      if(M[j].value<M[minj].value){
    minj=j;
    flag=1;
      }
    }
    if(flag==1){
        x = M[i].value;
    c = M[i].moji;
        M[i].value= M[minj].value;
    M[i].moji= M[minj].moji;
    M[minj].value= x;
    M[minj].moji= c;
      count++;
    }
  }
  for(i=0;i<n;i++){
    printf("%c%d",M[i].moji,M[i].value);
    if(i!=n-1)
      printf(" ");
  }
  printf("\n");
  for(i=0;i<n;i++){
    if(C[i].moji!=M[i].moji)
      flag=1;
  }
  if(flag==1)
    printf("Not stable\n");
  else{
    printf("Stable\n");
  }
  return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  int f=0,s=0;
  cin>>a>>b>>c;
  if (a==5)
    f++;
  else
    s++;
  if (b==5)
    f++;
  else
    s++;
  if (c==5)
    f++;
  else
    s++;
  if (f==2 and s==1)
    cout<<"YES";
  else
    cout<<"NO";
}

Measured memory_bytes: 256
kn=input().split()
k=int(kn[0])
n=int(kn[1])
an=input().split()
num_list=[]
for a in an :
  num_list.append(int(a))
count_list=[]

for i in range(n) :
  value=num_list[i-1]-num_list[i]
  if value<0 :
    value+=k
  
  count_list.append(value)
  
print(min(count_list))

Measured memory_bytes: 86212
#include<iostream>
#include<algorithm>
#include<cstdint>

int const MAXN = 2e5;

int64_t const INF = 1e18+1;

int64_t pos[MAXN];
int64_t neg[MAXN];

int npos, nneg, nzer, N;
int64_t K;

int64_t countLE(int64_t v) {
  int64_t res = 0;
  if(v >= 0) {
    res = (int64_t)nzer*(N-nzer) + (int64_t)nzer*(nzer-1)/2; // count of zeroes
  }
  // count positive and <=v
  int i = 0;
  for(int p = npos-1; p > 0; --p) {
    if(i > p) i = p;
    while(i < p && pos[i]*pos[p] <= v) ++i;
    res += i;
  }
  i = nneg-1;
  for(int p = 0; p < nneg-1; ++p) {
    if(i < p) i = p;
    while(i > p && neg[i]*neg[p] <= v) --i;
    res += nneg-1 - i;
  }
  // count negative and <= v
  i = 0;
  for(int p = 0; p < npos; ++p) {
    while(i < nneg && neg[i]*pos[p] <= v) ++i;
    res += i;
  }
  return res;
}

int main() {
  std::cin >> N >> K;
  npos = nneg = nzer = 0;
  for(int i = 0; i < N; ++i) {
    int64_t A; std::cin >> A;
    if(A < 0) neg[nneg++] = A;
    else if(A > 0) pos[npos++] = A;
    else ++nzer;
  }
  std::sort(pos, pos+npos);
  std::sort(neg, neg+nneg);
  int64_t vL = -INF, vH = INF;
  while(vL < vH) {
    int64_t vM = vL + (vH-vL)/2;
    if(countLE(vM) < K) vL = vM+1;
    else vH = vM;
 }
 std::cout << vL << std::endl;
 return 0;
}


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

int main()
{
    vector<int> t(5);
    cin >> t[0] >> t[1] >> t[2] >> t[3] >> t[4];
    int ans = t[0] + t[1] + t[2] + t[3] + t[4];
    int p = 0,q,r;
    for(int i=0;i<5;i++){
        q = (10-t[i]%10)%10;
        p = max(p,q);
    }
    for(int i=0;i<5;i++){
        q = (10-t[i]%10)%10;
        //cout << q << endl;
        ans += q;
    }
    cout << ans - p << endl;
}

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

using namespace std;

int main() {
  cout << fixed;
  cout << setprecision(10);
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  double kakudoA, kakudoB, kakudo, C;
  kakudoA = H*30 + 0.5*M;
  kakudoB = (360/60)*M;
  double pA;
  kakudo = kakudoA - kakudoB;
  pA = (2*3.1415926535)*(kakudo/360);
 /* double t;
  //double copA;
  if(cos(pA) < 0){
    t = -cos(pA);
  }else{
    t = cos(pA);
  }*/
  C = sqrt(A*A - 2*A*B*cos(pA) + B*B);
  cout << C << endl;
}


Measured memory_bytes: 4192