akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int a[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++) cin>>a[i][j];
    }

    int n; cin>>n;
    for(int i=0; i<n; i++){
        int b; cin>>b;
        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){
                if(b == a[j][k]) a[j][k] = 0;
            }
        }
    }

    bool valid = false;
    for(int i=0; i<3; i++){
        valid |= (!a[0][i] && !a[1][i] && !a[2][i]);
        valid |= (!a[i][0] && !a[i][1] && !a[i][2]);
    }

    valid |= (!a[0][0] && !a[1][1] && !a[2][2]);
    valid |= (!a[0][2] && !a[1][1] && !a[2][0]);
    
    cout << (valid ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



int fn(vector<int> & a,vector<int> & p,int N,int X)
{
  if(N == 0)
  {
    if(X <= 0)
    {
      return 0;
    }
    else
    {
      return 1;
    }
    
  }
  else if( X <= 1 + a[N-1])
  {
    return fn(a,p,N-1,X-1);
  }
  else  return ( p[N-1] + 1 + fn(a,p, N- 1, X - 2-  a[N-1]));
}
void solve(void)
{
  int N,K; cin>>N; cin>>K; 
  vector<int> a = {1}; 
  vector<int> p = {1}; 
  for (int i = 0; i < N; i++)
  {
    a.push_back(a.back()*2 + 3);
    p.push_back(p.back()*2 + 1);
  }
  
  cout<<fn(a,p,N,K)<<endl;



  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;

int main(){
    int K ,X;
    cin >> K >> X;
    int ans[1000000];
    for(int i=1;i<K*2;i++)ans[i-1] = X - K + i;
    for(int i=0;i<K*2-1;i++)cout << ans[i] << " ";
    cout << endl;
}

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

signed main() {
  int N, M;
  cin >> N >> M;
  if( abs( N - M ) >= 2 ){
    cout << 0 << endl;
    return 0;
  }
  
  const int MOD = 1000000007;
  
  int ans = 1;
  if( N == M ){
    for( int i = N; i >= 1; i-- ){
      ans = ans * i % MOD;
    }
    for( int i = M; i >= 1; i-- ){
      ans = ans * i % MOD;
    }
    ans = ans * 2LL % MOD;
    cout << ans << endl;
  }else{
    for( int i = N; i >= 1; i-- ){
      ans = ans * i % MOD;
    }
    for( int i = M; i >= 1; i-- ){
      ans = ans * i % MOD;
    }
    cout << ans << endl;
  }
    

}







Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e7 + 555;
const double PI = acos(-1.0);


void solve()
{
	int a, b;
	cin >> a >> b;
	bool ok = (a < 10 && b < 10);
	cout << (ok ? a * b : -1);
}
 
int main()
{
    Red;
    solve();
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(R: int):
    if R < 1200:
        return 'ABC'
    if R < 2800:
        return 'ARC'
    else:
        return 'AGC'


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    print(solve(R))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;
 
#define Pr(f,...) //printf(f,##__VA_ARGS__),fflush(stdout)
 
typedef long long ll;
 
const int N=3e5+50,P=1e9+7;

void upd(int &a,int b) { a+=b; if(a>=P)a-=P; }
 
int n,a[N],ans,id;
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d",a+i);
	}
	sort(a+1,a+n+1);
	ans=min(a[n]-a[1],a[1]),id=1;
	rep(i,2,n-1){cmax(ans,min(a[n]-a[i],a[i]));if(ans== min(a[n]-a[i],a[i]))id=i;}
	printf("%d %d\n",a[n],a[id]); 
	return 0 ;
}

Measured memory_bytes: 640
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	int n;
	cin >> n;
	
	set<int> dou;
	vector<int> can;
	
	int a;
	for(int i = 0; i < n; i++){
		cin >> a;
		if(dou.find(a) != dou.end()){
			can.push_back(a);
			dou.erase(dou.find(a));
		}else{
			dou.insert(a);
		}
	}
	
	if(can.size() < 2){
		cout << 0 << endl;
	}else{
		sort(can.begin(), can.end());
		cout << (long long)(can[can.size()-1]) * can[can.size()-2] << endl;
	}
	
	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//code here;
	ll a1,a2,a3;
	cin>>a1>>a2>>a3;
	if(a1+a2+a3>=22) cout<<"bust"<<endl;
	else cout<<"win"<<endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;

int main() {
  int n, m;

  cin >> n >> m;

  vector<vector<int> > v_s(m);
  vector<int> v_p(m);

  rep(i, m) {
    int k;
    cin >> k;
    rep(j, k) {
      int s;
      cin >> s;
      v_s[i].push_back(s);
    }
  }
  rep(i, m) {
    int p;
    cin >> p;
    v_p[i] = p;
  }
  int p_n = pow(2, n);
  int ans = 0;

  rep(i, p_n) {
    vector<int> s_count(m, 0);
    rep(j, n) {
      if (i & (int)pow(2, j)) {
        rep(k, m) {
          if (v_s[k].end() != find(all(v_s[k]), j + 1)) {
            s_count[k]++;
          }
        }
      }
    }
    bool flag = true;
    rep(i, m) {
      if (s_count[i] % 2 != v_p[i]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans++;
    }
  }

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


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

int v[410][410];
long long ans = 0;
int x[4] = {1, -1, 0, 0};
int y[4] = {0, 0, 1, -1};
vector< vector<bool> > used;
long long c, d;

void search(int i, int j, int vi, int vj) {
  if (v[i][j] == 1) c++;
  else d++;
  used[i][j] = true;
  for (int k = 0; k < 4; k++) {
    if (used[x[k]+i][y[k]+j]) continue;
    if (v[x[k]+i][y[k]+j] == v[i][j] * -1) {
      search(x[k]+i, y[k]+j, vi, vj);
    }
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w; cin >> h >> w;
  for (int i = 0; i < h; i++) {
    string s; cin >> s;
    for (int j = 0; j < w; j++) {
      if (s[j] == '#') v[i+1][j+1] = 1;
      else v[i+1][j+1] = -1;
    }
  }
  used.assign(h + 2, vector<bool>(w + 2, false));
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (used[i][j]) continue;
      c = 0; d = 0;
      search(i, j, i, j);
      ans += c * d;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13440
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll>v(m,0);
  vector<ll>p(m,0);
  ll k;
  for(ll i=0;i<m;i++){
    cin>>k;
    ll kk;
    for(ll j=0;j<k;j++){
      cin>>kk;
      v[i]|=(1<<(kk-1));
    }
  }
  for(ll i=0;i<m;i++){
    cin>>p[i];
  }
  ll ans=0;
  for(ll i=0;i<(1<<n);i++){
    ll f=0;
    for(ll j=0;j<m;j++){
      ll ff=i&v[j];
      ll zz=0;
      for(ll q=0;q<n;q++){
        if(ff&(1<<q))zz++;
      }
      if((zz%2)!=p[j])f=1;
    }
    if(f==0)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
pA = [(-1)**(0)*A[0]]
mA = [(-1)**(0+1)*A[0]]
for i in range(1,N):
  pA.append((-1)**(i)*A[i] + pA[i-1])
  mA.append((-1)**(i+1)*A[i] + mA[i-1])

ansl = []
for s in range(N):
  if s == 0:
    ansl.append(pA[N-1])
  else:
    if s%2 == 0:
      ansl.append( pA[N-1]-pA[s-1] + mA[s-1] )
    elif s%2 == 1:
      ansl.append( mA[N-1]-mA[s-1] + pA[s-1] )
print(*ansl)    

Measured memory_bytes: 22048
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 0x7ffffff;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int ans = n / 3;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var Sd, T string
	fmt.Scan(&Sd, &T)

	notFound := strings.Repeat("{", len(Sd))
	ans := notFound
	for i := 0; i < len(Sd)-len(T)+1; i++ {
		match := true
		gen := []byte(Sd)
		for j := 0; j < len(T); j++ {
			if gen[i+j] == '?' {
				gen[i+j] = T[j]
			}
			if gen[i+j] == T[j] {
				continue
			}
			match = false
			break
		}
		if !match {
			continue
		}

		for j := 0; j < len(gen); j++ {
			if gen[j] == '?' {
				gen[j] = 'a'
			}
		}
		genS := string(gen)
		if ans > genS {
			ans = genS
		}
	}
	if ans == notFound {
		fmt.Println("UNRESTORABLE")
	} else {
		fmt.Println(ans)
	}
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    ll z,w; cin>>z>>w;
    vll a(n);
    rep(i,n) cin>>a[i];
    if (n==1){
        cout<<abs(w-a[0])<<endl;
        return 0;
    }
    cout<<max(abs(w-a[n-1]), abs(a[n-1]-a[n-2]))<<endl;
    return 0;
}


Measured memory_bytes: 256
N,L = map(int,input().split())
re = []
re_abs = []

for i in range(1,N+1):
  x = L+i-1
  re.append(x)

for j in re:
  re_abs.append(abs(j))

re.pop(re_abs.index(min(re_abs)))
print(sum(re))

Measured memory_bytes: 3060
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    val n = readInputLine().toLong()
    val aArr = readInputLine().split(" ").map { it.toLong() }

    val cnt = mutableMapOf<Long, Long>()

    var ans = 0L

    for (i in 0 until n.toInt()) {
        val tmp = aArr[i] - (i + 1).toLong()
        ans += cnt[tmp] ?: 0L

        val addTmp = -aArr[i] - (i + 1).toLong()
        cnt[addTmp] = (cnt[addTmp] ?: 0L) + 1L
    }

    pw.println(ans)

    pw.flush()
}

fun readInputLine(): String {
    return readLine()!!
}


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

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])
        return par[x]

    def unite(x,y):
        x = root(x)
        y = root(y)
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1
            
    n,q = LI()
    rank = [0]*n
    par = [i for i in range(n)]
    for _ in range(q):
        c,x,y = LI()
        x -= 1
        y -= 1
        if not c:
            if root(x) != root(y):
                unite(x,y)
        else:
            print([0,1][root(x) == root(y)])
    return

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



Measured memory_bytes: 7204
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main() {
  int N;
  cin>>N;
  string X;
  vector<string>s(N);
  vector<int>t(N);
  for(int i=0;i<N;i++){
    cin>>s[i]>>t[i];
  }
  cin>>X;
  int MIN=0;
  for(int i=0;i<N;i++){
    if(s[i]==X){MIN=i+1;break;}
  }
  int sum=0;
  for(int i=MIN;i<N;i++){
   sum+=t[i];
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int a,b;cin>>a>>b;
  cout<<max({a+b,a-b,a*b})<<endl;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<int, int> P;

int main(){
    int n, m;
    cin >> n >> m;
    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl
template<typename T>
T ncr(T left, T right) {
	right = min(left - right, right);
	T ans = 1;
	for (T i = 1; i <= right; i++) {
		ans = ans * (left - right + i) / i;
	}
	return ans;
}

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	vector<int> v(5);
	for (int i = 0; i < 5; i++) {
		cin >> v[i];
	}
	int mi = 0;
	for (int i = 1; i < 5; i++) {
		if (v[i] % 10 == 0)continue;
		if (v[mi] % 10 > v[i] % 10) {
			mi = i;
		}
	}
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		if (i == mi) {
			ans += v[i];
		}
		else {
			ans += v[i] % 10 > 0 ? ((v[i]/10) * 10) + 10 : v[i];
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define popcount(x) __builtin_popcountll(x)
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,n) for(ll i=a ; i<n ; i++)
#define ld long double
#define rall(a) (a).rbegin(),(a).rend()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
 
ll power(ll b,ll e,ll m)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}  
bool isPowerOfTwo(ll x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
}

bool isPrime(ll n)
{
  if(n==1) return 0;
  for(ll i=2;i*i<=n;i++)
    if(n%i==0)
      return 0;
  return 1;
}

vi adj[100001];
ll vis[100001];

void dfs(ll node)
{
  vis[node]=1;
  for(ll child:adj[node])
  {
    if(!vis[child])
    {
      vis[child]=1;
      dfs(child);
    }
  }
}

void solve()
{
  ll n,m;
  cin>>n>>m;
  rep(i,0,m)
  {
    ll a,b;
    cin>>a>>b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  ll ans=0;
  rep(i,1,n+1)
  {
    if(!vis[i])
    {
      ans++;
      dfs(i);
    }
  }
  cout<<ans-1;
}

int main()
{
  ll tt=1;
  // cin>>tt;
  while(tt--)
  {
    solve();
    cout<<"\n";
  }
}

Measured memory_bytes: 11096
using System;
using System.Collections.Generic;
using System.Text;

struct Chemical
{
    public int a;
    public int b;
    public int c;
}
class Program
{
    int N;
    int Ma;
    int Mb;
    int Price;

    public static int Main()
    {
        bool loop = false;
#if ES_DEBUG
        loop = true;
#endif
        do
        {
            new Program().solve();
        } while (loop);
        return 0;
    }
    void calc(Chemical[] chem, int A, int B, int C, int depth)
    {
        if (depth >= N) return;

        calc(chem, A, B, C, depth + 1);

        if (C + chem[depth].c < Price)
        {
            if ((A + chem[depth].a) * Mb == (B + chem[depth].b) * Ma)
            {
                Price = C + chem[depth].c;
            }
            else
            {
                calc(chem, A + chem[depth].a, B + chem[depth].b, C + chem[depth].c, depth + 1);
            }
        }
    }
    public void solve()
    {
        string[] str = Console.ReadLine().Split(' ');
        N = int.Parse(str[0]);
        Ma = int.Parse(str[1]);
        Mb = int.Parse(str[2]);

        Chemical[] chem = new Chemical[N];
        for (int i = 0; i < N; ++i)
        {
            str = Console.ReadLine().Split(' ');
            chem[i].a = int.Parse(str[0]);
            chem[i].b = int.Parse(str[1]);
            chem[i].c = int.Parse(str[2]);
        }

        Price = 10000;
        calc(chem, 0, 0, 0, 0);
        if (Price == 10000)
        {
            Console.WriteLine(-1);
        }
        else
        {
            Console.WriteLine(Price);
        }
    }
}


Measured memory_bytes: 2648
#include <iostream>
#include <string>
using namespace std;
int main(void) {
    // Here your code !
    string a, b, c;
    cin >> a >> b >> c;

    char n = 'a';

    //cout << a <<":"<< b <<":"<< c << endl;


    while (true) {
        
        if (n == 'a') {
            if (a.size() == 0) {
                cout << 'A' << endl;
                break;
            }

            n = a[0];
            a.erase(a.begin());
        }
        else if (n == 'b') {
            if (b.size() == 0) {
                cout << 'B' << endl;
                break;
            }

            n = b[0];
            b.erase(b.begin());
        }
        else if (n == 'c') {
            if (c.size() == 0) {
                cout << 'C' << endl;
                break;
            }

            n = c[0];
            c.erase(c.begin());
        }
    }


}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    string t = "";
    for(int i=0;i<4;i++){
        t += s.at(i);
    }
    t += ' ';
    for(int i=0;i<8;i++){
        t += s.at(i+4);
    }
    cout << t << endl;
 }

Measured memory_bytes: 256
# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b
# Python 2nd Try


def solver(string):
    result = 200000
    aposi = 0
    zposi = len(string)
    for j in range(0, len(string), 1):
        if string[j] == 'A':
            aposi = j
            break
    for j in range(len(string)-1, -1, -1):
        if string[j] == 'Z':
            zposi = j
            break
    result = zposi - aposi + 1
    return result


if __name__ == "__main__":
    s = input()
    print('{}'.format(solver(s)))


Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
int H,W,d[22][22],D,r,i,j,k,l,t[22][22];
char c;
void move(int i,int j,int n){
	if(t[i][j]&&(d[i][j]>n||d[i][j]==-1)){
		d[i][j]=n;
		move(i+1,j,n+1);
		move(i-1,j,n+1);
		move(i,j+1,n+1);
		move(i,j-1,n+1);
	}
}
main(){
	cin>>H>>W;
	for(i=1;i<=H;i++)for(j=1;j<=W;j++){
		cin>>c;
		t[i][j]=(c=='.');
	}
	for(i=1;i<=H;i++)for(j=1;j<=W;j++){
		memset(d,-1,sizeof(d));
		move(i,j,0);
		D=0;
		for(k=1;k<=H;k++)for(l=1;l<=W;l++)D=max(D,d[k][l]);
		r=max(D,r);
	}
	cout<<r;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define el "\n" 
#define insert it
#define lb lowerbound
#define up upperbound
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7,siz = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;
 
void test(){
    int r,g,b,k;
    cin >> r >> g >> b >> k;
    while(k--){
    	if(g <= r){
    		g = g*2;
    		continue;
    	}
    	if(b <= g){
    		b = b*2;
    		continue;
    	}
    }
    if(r >= g  or g >= b){
    	cout << "No";
    }
    else
    	cout << "Yes";
}  
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tt = 1;
    // cin >> tt;
    f(i,0,tt) test();   
    return 0;
}



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

#define int long long
#define ll unsigned long long
#define pb push_back
#define mp make_pair
#define veci vector<int>
#define pii pair<int,int>
#define reset(a, b) memset(a, b, sizeof(a))
#define rep(i,b) for(int i=0; i<b; i++)
#define repi(i,a,b) for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define fi first 
#define se second
#define all(v) v.begin(),v.end()

int mod=1e9+7;

int powerm(int x,int y, int M){ int res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
int  power(int x,int y){ int res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int T;
    T=1;
//    cin>>T;
while(T--){
    int n;
    cin>>n;
    int a[n];
    int zero=0;
    rep(i,n){
        cin>>a[i];
        if(a[i]==0) zero++;
    }
    if(zero){
        cout<<0;
        continue;
    }
    int prod=1;
    bool flag=true;
    rep(i,n){
        if(a[i]<=1000000000000000000/prod) prod*=a[i];
        else{
            flag=false;
            cout<<-1;
            break;
        }
    }
    if(flag) cout<<prod;
}
    
    return 0;
}

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

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

using ll = long long;
ll INF = 1LL << 60;
 
using vc = vector<char>;
using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using piii = tuple<int, int, int>;

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

    int H, W, K; cin >> H >> W >> K;
    vector<vb> grid (H, vb (W));

    int sx, sy;
    F0R(i, H) {
        F0R(j, W) {
            char c; cin >> c;
            grid[i][j] = (c == '#');
            if (c == 'S') {sx = j; sy = i;}
        }
    }
    vector<vector<piii>> dist (H, vector<piii> (W, make_tuple(H*W+2, 0, 0)));
    dist[sy][sx] = make_tuple(1, 0, 0);

    priority_queue<pair<piii, pii>, vector<pair<piii, pii>>, greater<pair<piii, pii>>> q;
    q.push({{dist[sy][sx]}, {sx, sy}});
    while (!q.empty()) {
        piii d = q.top().first;
        pii pos = q.top().second;
        q.pop();
        
        int px, py; tie(px, py) = pos;
        

        if (d != dist[py][px]) continue;

        int d_m, d_n, d_k;
        d_m = get<0>(d); d_n = get<1>(d); d_k = get<2>(d);

        // printf("Searching: (%d, %d), (%d, %d, %d)\n", px, py, d_m, d_n, d_k);

        if (px == 0 || px == W - 1 || py == 0 || py == H - 1) {
            cout <<d_m << endl; return 0;
        }

        for (auto delta : vector<pii> {{-1, 0}, {1, 0}, {0, 1}, {0, -1}}) {
            int dx, dy; tie(dx, dy) = delta;
            piii newDist;
            if (grid[py+dy][px+dx]) {
                if (d_k == 0) 
                    newDist = make_tuple(d_m + 1, 1, K - 1);
                else if (d_n == K) {
                    newDist = make_tuple(d_m + 1, 1, d_k + K - 1);
                } else {
                    newDist = make_tuple(d_m, 1 + d_n, d_k - 1);
                }
            } else {
                if (d_n == K) {
                    newDist = make_tuple(d_m+1, 1, d_k + K);
                } else {
                    newDist = make_tuple(d_m, 1+d_n, d_k);
                }
            }
            if (newDist < dist[py+dy][px+dx]) {
                dist[py+dy][px+dx] = newDist; 
                q.push({newDist, {px+dx, py+dy}});
            }
        }
    }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll H,N,A;		cin>>H>>N;
	FOR(i,0,N){
		cin>>A;
		H-=A;
	}
	
	if(H<1)	Yes();
	else No();

    return 0;
}




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

int main() {
	int n;
	cin >> n;
	
	vector<int> a(n);
	for (int i=0; i<n; i++) {
		cin >> a[i];
	}
	
	vector<int> dp(n);
	int pos = a[0];
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for (int i=2; i<n; i++) {
		dp[i] = min(dp[i-1]+abs(a[i-1] - a[i]), dp[i-2]+abs(a[i-2] - a[i]));
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define foreach(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define all(c) begin(c),end(c)
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(ll a,b,d;cin>>a>>b>>d,a|b|d;){
		assert(d%__gcd(a,b)==0);
		pair<int,int> res(INFTY,INFTY);
		for(ll x=-100000;x<=100000;x++){
			ll y=(a*x-d)/b;
			if(a*x-b*y==d)
				if(abs(x)+abs(y)<abs(res.first)+abs(res.second)
				|| abs(x)+abs(y)==abs(res.first)+abs(res.second)
				&& abs(a*x)+abs(b*y)<abs(a*res.first)+abs(b*res.second))
					res=mp(x,y);
		}
		cout<<abs(res.first)<<' '<<abs(res.second)<<endl;
	}
}

Measured memory_bytes: 1160
#include<stdio.h>

#define N 100000

typedef struct process{
  char name[10];
  int tim;
}proceses;

proceses Q[N+1];
int length,quantum;
int head,tail;

void enqueue(proceses);
proceses dequeue(void);
void printqueue(void);

main(){
  int i;
  proceses p;
  int t_time=0;
  int count=0;
  
  scanf("%d %d",&length,&quantum);
  
  head = length/2;
  tail = length/2;
  
  for(i=0; i<length; i++){
    scanf("%s %d",p.name,&p.tim);
    enqueue(p);
  }

  while(count != length){
    
    p = dequeue();  
    if(p.tim > quantum){
      t_time += quantum;
      p.tim -= quantum;
      enqueue(p);
    }else{
      t_time += p.tim;
      printf("%s %d\n",p.name,t_time);     
      count++;
    }
    
  }
  
  return 0;
  
  
}

void enqueue(proceses p){
  
  Q[tail] = p;
  if(tail == length){
    tail = 0;
  }
  else 
    tail += 1;
}

proceses dequeue(){
  proceses x;  

  x = Q[head];
  if(head == length)
    head = 0;
  else 
    head++;
  
  return x;
}

void printqueue(void){
  int i;
  
  for(i=head; i!=tail; i++){
    if(i==length){
      printf("%s %d ",Q[i].name,Q[i].tim);
      i=0;
      printf("\n");
    }
    printf("%s %d ",Q[i].name,Q[i].tim);
    printf("\n");
  }

}

Measured memory_bytes: 1384
trans = []
for i in range(6):
    trans.append(int(input()))

delay = 0
bottle_neck = trans[0]
for i in range(1,6):
    if bottle_neck > trans[i]:
        delay += int(trans[0] / trans[i]) - 1 - delay
        if trans[0]%trans[i] != 0:
            delay += 1
        bottle_neck = trans[i]

print(delay+5)

Measured memory_bytes: 3060
#include <iostream>

void call(int n);

int main()
{
	int n;
	std::cin >> n;
	call(n);
	return 0;
}

void call(int n)
{
	int i = 1;
	while (i <= n) 
	{
		int x = i;
		if (x % 3 == 0 || x % 10 == 3)
		{
			std::cout << " " << i;
		}
		else
		{
			while (x % 10 != 3)
			{
				x /= 10;
				if (x == 0)
				{
					break;
				}
				else
				{
					if (x % 10 == 3)
					{
						std::cout << " " << i;
					}
				}
			}
		}
		i++;
	}
	std::cout << '\n';
}

Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n, k;
int v[50];

signed main() {
	int i, j, l;
	
	cin >> n >> k;
	rep(i, n) cin >> v[i];
	
	int ans = 0;
	rep(i, n + 1) {
		rep(j, n + 1) {
			if (i + j > n || i + j > k) continue;
			
			vector<int> vec;
			rep(l, i) vec.push_back(v[l]);
			rep(l, j) vec.push_back(v[n - 1 - l]);
			sort(vec.begin(), vec.end());
			
			rep(l, k - (i + j)) {
				if (l >= vec.size()) break;
				if (vec[l] >= 0) break;
			}
			
			int sumV = 0;
			for (; l < vec.size(); l++) {
				sumV += vec[l];
			}
			ans = max(ans, sumV);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long X;
  cin >> X;

  long i;
  long accum = 0;
  for (i = 0; accum < X; i+=1, accum+=i);

  cout << i << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<char> &s, char a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;

const int MAX = 4040404;

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

    ll all = accumulate(v.begin(), v.end(), 0ll);

    bitset<MAX> dp;
    dp[0] = true;


    rep(i, n) dp |= (dp << v[i]);


    for (ll i = (all + 1) / 2; i <= all; i++) {
        if (dp[i]) {
            cout << i << endl;
            ret();
        }
    }

}

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

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int R;
    cin >> R;
    if(R<1200)
        cout << "ABC";
    else if (R<2800)
        cout << "ARC";
    else
        cout << "AGC";
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std; 
int n,a,s; 
int main(){map<int,int>m;cin>>n;for(int i=0;i<n;++i){int a,b;cin>>a>>b;++m[a];--m[b];}for(auto i:m){s+=i.second;a=max(a,s);}cout<<a<<endl;}


Measured memory_bytes: 12500
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a<b) 
	{
		if(b<c)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

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

class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextLong();
        }
        long[] b = new long[n];
        for (int i = 0; i < n; i++) {
            b[i] = scanner.nextLong();
        }
        scanner.close();
        long[] sa = new long[n];
        for (int i = 0; i < n; i++) {
            sa[i] = a[i] - b[i];
        }
        Arrays.sort(sa);
        long countOfhu = 0;
        long amountOfhu = 0;
        for (int i = 0; i < n; i++) {
            if (sa[i] < 0) {
                countOfhu++;
                amountOfhu += sa[i];
            }
        }
        if (countOfhu == 0) {
            System.out.println(0);
            return;
        }

        long genjitendenosei_count = 0;
        long genjitendenosei_amount = 0;

        for (int i = 0; i < sa.length - countOfhu; i++) {
            genjitendenosei_amount += sa[sa.length - i - 1];
            genjitendenosei_count++;
            if (genjitendenosei_amount >= amountOfhu * -1) {
                System.out.println(genjitendenosei_count + countOfhu);
                return;
            }
        }
        System.out.println(-1);
    }

}


Measured memory_bytes: 66584
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001000
#define mod 1000000007
#define pi 3.1415926535
using namespace std;

int main(void){
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right


def count(i, j):
    l1, l2 = L[i], L[j]
    low = l2 - l1
    high = l2 + l1
    start = bisect_right(L, low, j + 1)
    end = bisect_left(L, high, j + 1)
    return end - start


if __name__ == '__main__':
    input()
    L = [int(x) for x in input().split()]
    L.sort()
    total = 0
    for i in range(len(L)):
        for j in range(i + 1, len(L)):
            total += count(i, j)
    print(total)

Measured memory_bytes: 45916
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

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

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, m = map(int, input().split())
uf = UnionFind(N)
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a, b)
print(uf.group_count() - 1)


Measured memory_bytes: 12884
#include<bits/stdc++.h>
using ll = long long;
using ld = double;
using namespace std;
int main() {
//	doin();
	ll t;
	cin >> t;
	while (t--) {
		set<int> s;
		ll a, b, ans = 0;
		cin >> a >> b;
		if (a > b)
			swap(a, b);
		ll t = ceil(2.0*sqrt((a *1.0* b)));
		t -= 2;
		if(a == 1 ||(((a*b - 1) / a) != ((a*b - 1) / (a-1)) && ((a*b - 1) / a) != ((a*b - 1) / (a+1))))t--;
		cout << max(0ll, t) << "\n";
	}
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, M: int, A: "List[int]"):

    sumA = sum(A)
    sortA = sorted(A, reverse=True)

    thresh = sumA / (4*M)

    for a in range(M):

        if sortA[a] < thresh:
            print(NO)
            return
    print(YES)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	long long n, k;
	cin >> n >> k;
	if(n == k){
		cout << 0 << endl;
		return 0;
	}
	long long ost = n % k;
	long long raz = abs(ost - k);
	cout << min(ost, raz);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from fractions import gcd


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


a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input()) - 1])


Measured memory_bytes: 66156
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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 (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll N;
        cin >> N;
        vector<pll> v(N);
        rep(i, 0, N) cin >> v[i].second >> v[i].first;
        
        sort(all(v));
        ll tmp = v.front().second;
        ll ans = tmp + v.front().first;

        cout << ans << endl;
}


Measured memory_bytes: 4836