akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;

int n;

signed main(){

    cin >> n;
    int t[100010];
    int a[100010];
    rep(i,n)cin >> t[i];    
    rep(i,n)cin >> a[i];
    int tt[100010]= {0};    
    int aa[100010]= {0};   

    for(int i = 1;i < n;i++){
        if(t[i-1] < t[i])tt[i] = 1;
    }
    for(int i = 1;i < n;i++){
        if(a[i-1] > a[i])aa[i-1] = 1;
    }
    tt[0] = 1;
    aa[n-1] = 1;
    
    int ans = 1;
    for(int i = 0;i < n;i++){
        if(tt[i] == 1 && aa[i] == 1){
            if(t[i] != a[i]){
                cout << 0 << endl;
                return 0;
            }
        }
        if(tt[i] == 1 && aa[i] == 0){
            if(t[i] > a[i]){
                cout << 0 << endl;
                return 0;
            }
        }
        if(tt[i] == 0 && aa[i] == 1){
            if(t[i] < a[i]){
                cout << 0 << endl;
                return 0;
            }
        }
        if(tt[i] == 0 && aa[i] == 0){
            ans *= min(t[i],a[i]);
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;   
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://abc061.contest.atcoder.jp/tasks/abc061_d


Measured memory_bytes: 3328
s=[]
s=input()
a=[]
b=[]

a.append(s[0])
a.append(s[1])
b.append(s[2])
b.append(s[3])
a=int("".join(a))
b=int("".join(b))


if a>12 or a<1:
    if b>12 or b<1:
        print("NA")
    else:
        print("YYMM")
else:
    if b>12 or b<1:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(void)
{
	int n,i,j,a,ans,cnt=0;
	cin>>n;
	for(i=1;i<=n;i++){
		a=i;
		for(j=1;j<=6;j++){
			a=a/10;
			if(0<a) cnt=cnt+1;
		}
		if((cnt+1)%2==1) ans+=1;
		cnt=0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<iomanip>
#include"math.h"

#define MAX 1000000
typedef long long llong;

using namespace std;
llong T[MAX];
int n, k;

int check(llong p){
    int i = 0;
    for(int j=0;j<k;j++){
        llong sum = 0;
        while(sum+T[i]<=p){
            sum+=T[i]; 
            i++;
            if(i==n) return n;
        }
    }
    return i;
}

llong solve(){
    llong left = 0;
    llong right = 100000 * 10000;
    llong mid;
    while(right - left > 1){
        mid = (right + left)/2;
        int v = check(mid);
        if(v >= n)right = mid;
        else left = mid;
    }
    return right;
}
int main(){
    cin >> n >> k;
    for(int i=0;i<n;i++) cin >> T[i];
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 3868
object Main extends App {
  import scala.io.StdIn._
  val odd = "RUD"
  val even = "LUD"
  val str = readLine.trim
  println(if (str.indices.by(2).forall(i ⇒ odd.contains(str(i))) && str.indices.tail.by(2).forall(i ⇒ even.contains(str(i)))) "Yes" else "No")
}


Measured memory_bytes: 27328
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>

int main() {
	int a, b,m;
	cin >> a >> b;
	if (a < b) {
		m = b;
	}
	else {
		m = a;
	}
	vector<int>x(m);
	rep(i, m) {
		if (m == b) {
			cout << a;
		}
		else {
			cout<<b;
		}
		
	}
	return 0;
}

Measured memory_bytes: 256
import numpy as np

n = int(input())
x = list(map(int, input().split()))

m = int(np.median(x))
k = int(np.std(x))
ans = max(x) ** 2 * n

# pos = m + k
# print(pos)
# cost = 0

low = max(1, m - k)
high = min(m + k, np.max(x))

for i in range(low, high+1, 1):
  cost = 0
  for j in range (n):
    cost += (x[j] - i) ** 2
  # print(cost)
  if cost < ans:
    ans = cost

print(ans)

Measured memory_bytes: 12504
N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr

d = {}
for i in range(2,N+1):
    for j in factorization(i):
        if j[0] not in d:
            d[j[0]] = j[1]
        else:
            d[j[0]] += j[1]

ans = 0
#74
for k in d.keys():
    if d[k] >= 74:
        ans += 1
#2 24
c2 = 0
c24 = 0
for k in d.keys():
    if d[k] >= 2:
        c2 += 1
    if d[k] >= 24:
        c24 += 1
ans += c24*(c2-1)
#4 14 
c4 = 0
c14 = 0
for k in d.keys():
    if d[k] >= 4:
        c4 += 1
    if d[k] >= 14:
        c14 += 1
ans += c14*(c4-1)
#2 4 4
ans += c4*(c4-1)*(c2-2)//2

print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
  read(x), read(y...);
}
int n;
vector<int> A,B;
vector<pair<int,int> > G;
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n);
  for(int i=1;i<=n;++i) {
    int a; read(a);
    if(a<0) A.push_back(a);
    else B.push_back(a);
  }
  sort(A.begin(),A.end()); sort(B.begin(),B.end());
  int res;
  if(A.size()&&B.size()) {
    for(int i=1;i<(int)B.size();++i) {
      G.push_back(mp(A[0],B[i]));
      A[0]-=B[i];
    }
    for(int i=0;i<(int)A.size();++i) {
      G.push_back(mp(B[0],A[i]));
      B[0]-=A[i];
    }
    res=B[0];
  }
  else if(A.size()) {
    int t=A.size()-1;
    for(int i=t-1;~i;--i) {
      G.push_back(mp(A[t],A[i]));
      A[t]-=A[i];
    }
    res=A[t];
  }
  else {
    int t=B.size()-1;
    for(int i=1;i<t;++i) {
      G.push_back(mp(B[0],B[i]));
      B[0]-=B[i];
    }
    G.push_back(mp(B[t],B[0]));
    B[t]-=B[0];
    res=B[t];
  }
  printf("%d\n",res);
  for(auto t: G) printf("%d %d\n",t.Fst,t.Snd);
  return 0;
}


Measured memory_bytes: 3444
#include<stdio.h>
int main()
{
  int a,b,n,x;
  scanf("%d",&n);
  for(a=1; a<10; a++){
    if(n%a==0){
      b=n/a;
      if(b<=9){
        printf("Yes");
        a=11;
      }
    }
  }
  if(a==10)
    printf("No");
  return 0;
}

Measured memory_bytes: 128
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto XS = readln.split.to!(long[]);
    long r = long.max;
    foreach (long p; 0..101) {
        long rr;
        foreach (x; XS) rr += (p - x)^^2;
        r = min(r, rr);
    }
    writeln(r);
}

Measured memory_bytes: 256
/*
author : seryu
title : ABC167B_"Easy Linear Programming"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
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; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans;
	if(k <= a) ans = k;
	else if(k <= a + b)ans = a;
	else ans = a-(k-a-b);
	cout << ans << endl;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3640
using System;
using System.Collections;
using System.Linq;

class main {
	public static void Main(string[] args){
    	var input = Console.ReadLine().Split(' ');
      
      	int A = int.Parse(input[0]);
      	op operation = op.plus;
      	if(input[1] == "+")operation = op.plus;
      	else operation = op.minas;
      
      	int B = int.Parse(input[2]);
      
      	if(operation == op.plus)Console.WriteLine(A + B);
      	else Console.WriteLine(A-B);
    }
  
  	enum op{plus,minas,}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}

struct UnionFind
{
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}
  int find(int x)
  {
    if (d[x] < 0)
      return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if (x == y)
      return false;
    if (d[x] > d[y])
      swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

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

  UnionFind uf(n);
  vector<int> ans;

  rep(i, q)
  {
    int com, x, y;
    cin >> com >> x >> y;

    if (com == 0)
    {
      // unite
      uf.unite(x, y);
    }
    else if (com == 1)
    {
      // same
      if (uf.same(x, y))
        ans.push_back(1);
      else
        ans.push_back(0);
    }
  }

  for (auto i : ans)
  {
    cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 3340
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 998244353
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1010
ll n,m,k;
ll a[11][M];

int main(){
	IOS;
	

	cin>>n>>m>>k;
	rep(i,0,n){
		string s;cin>>s;
		rep(j,0,sz(s))
			a[i][j] = s[j] - '0';
	}
	ll ans = n + m - 2;
	rep(i, 0, (1 << (n-1))) {
		ll x = 0, y = -1, cnt = 0, cut = 0;
		bool ok = 1;
		vll pos;
		pos.pb(0);
		rep(j, 0, n - 1)
			if(i & (1 << j))
				pos.pb(j + 1);
		pos.pb(n);
		ll t = sz(pos);
		cnt = sz(pos) - 2;
		ll p[t] = {0}, b[t] = {0};
		rep(j, 0, m) {
			bool f = 1;
			rep(d, 0, t - 1){
				rep(kk, pos[d], pos[d + 1])
					b[d] += a[kk][j];
				if(b[d] > k) ok = 0;
				if(b[d] + p[d] > k) f = 0;
			}
			if(!f){ rep(j, 0, t) p[j] = b[j]; cut++;}
			else rep(j, 0, t) p[j] += b[j];
			rep(j, 0, t) b[j] = 0;
		}
		if(ok)ans = min(ans, cnt + cut);
		pos.clear();
	}
	cout << ans;
	
	
	
	return 0;
}



Measured memory_bytes: 384
from random import *
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
X=[0]*26
Y,Z=0,0
V,W=0,0
for i in range(D):
  for j in range(26):
    X[j]+=C[j]
  Y,Z=-1,-10**20
  for j in range(26):
    if Y==-1:
      V,W=Y,Z
      Y,Z=0,X[0]+S[i][0]
    if Z<X[j]+S[i][j]:
      V,W=Y,Z
      Y,Z=j,X[j]+S[i][j]
    elif W<X[j]+S[i][j]:
      V,W=j,X[j]+S[i][j]
  if randrange(0,20) or V==-1:
    X[Y]=0
    print(Y+1)
  else:
    X[V]=0
    print(V+1)

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

int main() {
    int A,B;
  cin>>A>>B;
  string ans;
  if(A==B) ans="Draw";
  else if(A==1) ans="Alice";
  else if(A>B&&B!=1) ans="Alice";
  else ans="Bob";
  cout<<ans<<endl;
}

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

int n, arr[102], mn = 2000000;

int main(){

    scanf("%d", &n);
    for(int i = 1, act; i <= n; i++){
        scanf("%d", &act);
        arr[i] = arr[i - 1] - act;
    }

    for(int i = 1; i < n; i++){
        mn = min(mn, abs((arr[n] - arr[i]) - arr[i]));
    }

    printf("%d\n", mn);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int i,n,m,x,y,mx,my,z;
  cin>>n>>m;
  int min[n];
  for(i=0;i<n;i++) min[i]=n;

  for(i=0;i<m;i++){
    cin>>x>>y>>z;
    x--;
    y--;
    if(y<x){//xを小さい方に
      z=x;
      x=y;
      y=z;
    }

    mx=min[x];
    my=min[y];
    if(mx!=n){
      while(1){
        if(mx==min[mx]) break;
        else mx=min[mx];
      }
    }
    else mx=x;
    if(my!=n){
      while(1){
        if(my==min[my]) break;
        else my=min[my];
      }
    }
    else my=y;

    if(mx<my){
      z=mx;
      min[my]=x;
    }
    else{
      z=my;
      min[mx]=my;
    }

    min[x]=z;
    min[y]=z;
  }

  x=0;
  for(i=0;i<n;i++){
//    cout<<i<<":"<<min[i]<<endl;
    if(min[i]==i||min[i]==n) x++;
  }
  cout<<x<<endl;
  return 0;
}

Measured memory_bytes: 640
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e8;
using namespace std;

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	string s;
	while(cin >> s){
		cout << s.substr(0,4) << ' ' << s.substr(4,8) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())


def convert(n):
    result = []
    while True:
        a = n // 2
        b = n % 2
        result.insert(0, b)
        if a == 0:
            break
        else:
            n = a
    return result


def sigma_1(m):
    Sum = 0
    for i in range(m):
        Sum += 2**i
    return Sum


def sigma_2(m):
    Sum = 0
    for i in range(m):
        Sum += 2**(2*i)
    return Sum


def sigma_3(m):
    Sum = 0
    for i in range(1, m+1):
        Sum += 2**(2*i-1)
    return Sum


if 0 <= N <= 1:
    print(N)
elif N > 1:
    digit = 3  # N >= 2
    while True:
        if 1 + sigma_2(digit//2) <= N <= sigma_2(digit//2+1):
            break
        digit += 2
    ans = N-(1+sigma_2(digit//2)) + 2**(digit-1)
    ans = convert(ans)
    idx = 0
    for k in ans:
        if idx % 2:
            if k == 0:
                ans[idx] = 1
            else:
                ans[idx] = 0
        idx += 1
    for j in ans:
        print(j, end="")
else:
    N *= -1
    digit = 2
    while True:
        if 1 + sigma_3(digit//2-1) <= N <= sigma_3(digit//2):
            break
        digit += 2
    ans = N-(1+sigma_3(digit//2-1)) + 2**(digit-1)
    ans = convert(ans)
    idx = 0
    for k in ans:
        if idx % 2:
            if k == 0:
                ans[idx] = 1
            else:
                ans[idx] = 0
        idx += 1
    for j in ans:
        print(j, end="")


Measured memory_bytes: 3064
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

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

  lint h;
  cin>>h;
  lint enemy=1;
  lint result=0;
  while(h>0){
    h/=2;
    result+=enemy;
    enemy*=2;
  }
  cout<<result<<endl;

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 

const ll large_P = 1e9 + 7;


int main(){
  ll H, N;
  cin >> H >> N;
  
  vector<ll> A(N);
  rep(i, N) cin >> A.at(i);
  
  ll sum = 0;
  rep(i, N) sum += A.at(i);
  
  if(sum >= H) cout << "Yes";
  else cout << "No";
  
  
  
  
}

Measured memory_bytes: 1024
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(c+1):
  ans = 0
  ans += i*50
  if ans == x:
    cnt += 1
  else:
    for j in range(b+1):
      ans = i*50
      ans += j*100
      if ans == x:
        cnt += 1
      else:
        for k in range(a+1):
          ans = i*50
          ans += j*100
          ans += k*500
          if ans == x:
            cnt += 1
print(cnt)      

Measured memory_bytes: 3064
import sys
from collections import deque

N, M = map(int, sys.stdin.readline().split())

edges = [[] for _ in range(N)]
for _ in range(M):
    u, v = map(int, sys.stdin.readline().split())
    edges[u-1].append(v-1)

S, T = map(int, sys.stdin.readline().split())
S -= 1
T -= 1

visited = {}
q = deque()
q.append((S, 0))
d = -1
while q:
    s, c = q.popleft()
    if s in visited and (c % 3) in visited[s]:
        continue
    if s not in visited:
        visited[s] = set()
    visited[s].add(c % 3)
    for n in edges[s]:
        if n == T and c % 3 == 2:
            d = c + 1
            break
        q.append((n, c+1))

    if d % 3 == 0:
        break

if d == -1:
    print(-1)
else:
    print(d // 3)

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= c && c <= b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	inputs := scanNums(N)

	res := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			res += inputs[i] * inputs[j]
		}
	}
	fmt.Println(res)

}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    int a, b, d, s;
    char o;
    scanf("%d %c %d", &a, &o, &b);
    if(o == '+'){
        d = a + b;
        printf("%d\n", d);
    }
    else{
    s = a - b;
    printf("%d\n", s);
    }
    return 0;
}




Measured memory_bytes: 128
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k = m()

po = [0 for i in range(n)]

for i in range(k):
    a,b = m()
    po[a-1] += 1
    po[b-1] += 1
if all(map(lambda x:x%2 == 0,po)):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 45296
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, k, q; cin >> n >> k >> q;
  vector<int> finalpoints(n, 0);
  int ai;
  for(int i = 0; i < q; i++) {
    cin >> ai;
    finalpoints.at(ai -1)++;
  }
  for(int i = 0; i < n; i++) {
    if(k -q + finalpoints.at(i) > 0) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}

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

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

    vector<int>A;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin>>a;
        A.push_back(a);
    }
    for (auto a:A)
    {
        H-=a;
    }
    
    if(H>0)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;   
    }
    

    return 0;
}


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

int main(void){
    ll n, m;
    cin>>n>>m;
    ll big=max(n, m);
    ll small=min(n, m);
    n=big;
    m=small;
    ll ans;
    if(n==1) ans=1;
    else if(m==1) ans=n-2;
    else {
        ans=(n-2)*(m-2);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	ll n; int cnt = 0; ll a = 1;
	cin >> n;
	while (a<n) {
		cnt++; a *= 3;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3092
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		// 初期化
		Scanner sc = new Scanner(System.in);
		// Streamを使用してint配列の作成
		int[] list = Stream.of(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		double T = (double)list[0];
		double X = (double)list[1];

		System.out.println(String.format("%.10f", T/X));
	}

}

Measured memory_bytes: 28372
x,y = [int(hoge) for hoge in input().split()]
if x==y:print(0);exit()
#K回…
#押して反転 or 反転して押す or 反転押して反転
#-x-K or -x + K or x + k or x-k
kouho =  [-x-y+1,x+y+1,y-x,x-y+2]
print(min([k for k in kouho if k>0]))

Measured memory_bytes: 38384
#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

using veci = vector<int>;
using pii = pair<int, int>;
using vecii = vector<pii>;
using ll = long long;
using vecl = vector<ll>;
#define fi first
#define se second
#define endl '\n'

bool dp[81][81][6401];

void solve() {
    int H, W;
    cin >> H >> W;
    vector<veci> a(H, veci(W));
    vector<veci> b(H, veci(W));
    for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) cin >> a[i][j];
    for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) cin >> b[i][j];

    fill(&(dp[0][0][0]), &(dp[0][0][0]) + 81 * 81 * 6401, false);
    dp[0][0][0] = true;

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            int diff = abs(a[i][j] - b[i][j]);
            for (int k = 0; k <= 6400; ++k) {
                if (dp[i][j][k]) {
                    if (k + diff <= 6400) {
                        dp[i][j + 1][k + diff] = true;
                        dp[i + 1][j][k + diff] = true;
                    }

                    if (abs(k - diff) <= 6400) {
                        dp[i][j + 1][abs(k - diff)] = true;
                        dp[i + 1][j][abs(k - diff)] = true;
                    }
                }
            }
        }
    }

    for (int k = 0; k <= 6400; ++k) {
        if (dp[H][W - 1][k] || dp[H - 1][W][k]) {
            cout << k << endl;
            return;
        }
    }
    return;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#if defined(LOCAL_TEST)
    (void)argc;
    freopen(string(argv[0]).append("-test.in").c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
        solve();
}


Measured memory_bytes: 41344
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    uli x, y, aa, bb, cc, ans = 0;
    cin >> x >> y >> aa >> bb >> cc;
    vector<uli> a(aa), b(bb), c(cc);
    rep(i, 0, aa)cin >> a.at(i);
    rep(i, 0, bb)cin >> b.at(i);
    rep(i, 0, cc)cin >> c.at(i);
    st(a); st(b); st(c);
    rep(i, 0, x)
        c.push_back(a.at(aa - i - 1));
    rep(i, 0, y)
        c.push_back(b.at(bb - i - 1));
    st(c);
    rep(i, 0, x + y)
        ans += c.at(cc + x + y - i - 1);
    cout << ans << endl;
}

Measured memory_bytes: 6000
program main
	implicit none
	integer i
	character(50) O, E
	read(*, *) O
	read(*, *) E
	do i = 1, len_trim(E)-1
		write(*, '(a1)', advance = 'No') O(i:i)
		write(*, '(a1)', advance = 'No') E(i:i)
	end do
	if(len_trim(O)-len_trim(E) == 0) then
		write(*, '(a1)', advance = 'No') O(len_trim(E):len_trim(E))
		write(*, '(a1)') E(len_trim(E):len_trim(E))
	else
		write(*, '(a1)', advance = 'No') O(len_trim(E):len_trim(E))
		write(*, '(a1)', advance = 'No') E(len_trim(E):len_trim(E))
		write(*, '(a1)') O(len_trim(E)+1:len_trim(E)+1)
	end if
end program main

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    vector<Pii> sections(n);
    for(int i=0;i<n;++i){
        cin >>sections[i].first >> sections[i].second;
    }

    int a, b, al = 0, ar = INF, bl = 0, br = INF;
    for(int i=0;i<n;++i) {
        if(sections[i].second < ar) {
            a = i;
            al = sections[i].first;
            ar = sections[i].second;
        }
        if(bl < sections[i].first) {
            b = i;
            bl = sections[i].first;
            br = sections[i].second;
        }
    }

    // a と b を同じ区間にする
    int c, cl = 0, cr = 0, dl = 0, dr = INF;
    for(int i=0;i<n;++i) {
        if(cr-cl < sections[i].second-sections[i].first) {
            c = i;
            cl = sections[i].first;
            cr = sections[i].second;
        }
    }
    for(int i=0;i<n;++i) {
        if(i == c) continue;
        dl = max(dl, sections[i].first);
        dr = min(dr, sections[i].second);
    }
    int ans = max(cr-cl+1, 0) + max(dr-dl+1, 0);

    if(a == b) {
        cout << ans << endl;
        return 0;
    }
    
    // a と b を違う区間にする
    sort(
        sections.begin(), sections.end(), 
        [&](Pii p, Pii q) { 
            int p_diff = max(0, p.second - bl), q_diff = max(0, q.second - bl);
            if(p_diff != q_diff) return p_diff > q_diff;
            return max(0, ar - p.first) < max(0, ar - q.first);
        }
    );

    // for(Pii p: sections) {
    //     cerr << p.first << " " << p.second << endl;
    // }
    // cerr << endl;

    vector<int> min_r_bl(n);
    min_r_bl[0] = sections[0].second;
    for(int i=1;i<n;++i) {
        min_r_bl[i] = min(min_r_bl[i-1], sections[i].second);
    }

    vector<int> max_l_ar(n);
    max_l_ar[n-1] = sections[n-1].first;
    for(int i=n-2;i>=0;--i) {
        max_l_ar[i] = max(max_l_ar[i+1], sections[i].first);
    }

    for(int i=1;i<n;++i) {
        // cerr << min_r_bl[i-1] << "-" << bl << " " << ar << "-" << max_l_ar[i] << endl;
        ans = max(ans, max(0, min_r_bl[i-1] - bl + 1) + max(0, ar - max_l_ar[i] + 1));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,t;
    cin>>n>>t;

    int c[n],tm[n];
    for(int i=0;i<n;i++){
        cin>>c[i]>>tm[i];
    }
    int a[n];
    //int a[n]={1001}; //配列のall初期化
    for(int i=0;i<n;i++){
        a[i]=1001;
        if(tm[i]<=t){
            a[i]=c[i];
            //cout<<a[i]<<endl;
        }
    }
    sort(a,a+n);
    
    if(a[0]==1001){
        cout<<"TLE"<<endl;
    }
    else
        cout<<a[0]<<endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
   string s,t;
   int N;
   
   cin >> s >>t;
   
  
   
   //アルファベット順にソートする
   sort(s.begin(),s.end());
   
   //逆順にソートする
   sort(t.begin(),t.end());
   reverse(t.begin(),t.end());
   
  
   if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
   
   
   
}


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

int main(){
  int N,A,B;
  cin >> N;
  vector<int> X(N),Y(N);
  for(int i=0; i<N; i++){
    cin >> X.at(i);
    Y[i]=X[i];
  }
  sort(Y.begin(),Y.end());
  A=Y[N/2-1];
  B=Y[N/2];
  
  for(int i=0; i<N; i++){
    if(X.at(i)<B){
      cout << B << endl;
    }
    else{
      cout << A << endl;
    }
  }
}

Measured memory_bytes: 3712
<?php
fscanf(STDIN, "%d%d", $n, $k);

if($k > ($n-1) * ($n-2) / 2){
  echo -1;
  exit;
}
for($i = 2; $i <= $n; $i++){
  $link[] = [1, $i];
}
$over = ($n-1) * ($n-2) / 2 - $k;
if($over > 0){
  for($i = 2; $i <= $n; $i++){
    for($j = $i+1; $j <= $n; $j++){
      $link[] = [$i, $j];
      $over--;
      if($over == 0)break;
    }
    if($over == 0)break;
  }
}
echo count($link)."\n";
foreach($link as $l){
  echo implode(" ", $l),"\n";
}



Measured memory_bytes: 6904
#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;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e8);
const int mod = 16714589;
const int N = 2e6 + 555; // TL MB
const double PI = acos(-1.0);
double eps = 1e-6;

// {l, r}

int n;
void solve(){      
	string s, t;
	cin >> s >> t;
	if(s + t.back() == t) cout << "Yes";
	else cout << "No";
}	// 0 1 2 2 3 3


 
 
int main()
{
	Red;
	//freopen("input.txt", "r", stdin);s
	//freopen("output.txt", "r", stdin);
  	int T = 1; 
 	//cin >> T; 
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

typedef long long ll;

const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return ((ll)a * b) % MOD;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (auto &t : a) {
		cin >> t;
	}	
	vector<int> less;
	vector<int> gr;
	for (int i = 0; i < n; i++) {
		if (a[i] < 0) {
			less.push_back(a[i]);
		} else {
			gr.push_back(a[i]);
		}
	}
	if ((k % 2 == 1 && (int)less.size() == n) || (k == n && less.size() % 2 == 1)) {
		sort(a.begin(), a.end(), [&](int i, int j) {
			return abs(i) < abs(j);
		});
		int ans = 1;
		for (int i = 0; i < k; i++) {
			ans = mul(ans, a[i] + MOD);
		}
		cout << ans << endl;
		exit(0);
	}
	sort(less.begin(), less.end());
	sort(gr.rbegin(), gr.rend());
	if ((int)less.size() & 1) less.pop_back();
	vector<pair<int, int>> tk;
	for (int i = 0; i + 1 < (int)less.size(); i += 2) {
		tk.push_back({less[i] * less[i + 1], -(i + 2)});
	}
	for (int i = 0; i + 1 + (k & 1) < (int)gr.size(); i += 2) {
		tk.push_back({gr[i] * gr[i + 1], (i + 2)});
	}
	sort(tk.rbegin(), tk.rend());
	int mx = 0;
	int ans = 1;
	for (auto t : tk) {
		if (k > 1) {
			ans = mul(ans, t.first % MOD);
			mx = max(mx, t.second);
			k -= 2;
		}
	}
	if (k) {
		ans = mul(ans, gr[mx]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 9404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
#define forout(out, n) for(int i=0; i<n; i++) cout<<out[i]<<endl
int main(){
    int X; cin>>X;
    if(X>=30){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  
  for(int i = 0; i < K; i++){
    if(C > B && B > A) break;
    else if ( B >= C)   C *= 2; 
    else if ( A >= B)   B *= 2;
    else if ( A >= C)   C *= 2;
  }
  
  if ( C > B && B > A ) cout << "Yes";
  else cout << "No";
  
}

Measured memory_bytes: 3628
import random

N = int(input())
A = list(map(int, input().split()))

S = A[0]+A[1]
X = 0
for a in A[2:]:
  X ^= a

D = (S-X)>>1
if S!=X+(D<<1) or D>A[0] or (X&D)!=0:
  print(-1)
  exit(0)

a = D
b = 2**64
while b>0:
  if (X&b)!=0 and (a|b)<=A[0]:
    a |= b
  b >>= 1
if a==0:
  print(-1)
  exit(0)
print(A[0]-a)


Measured memory_bytes: 9360
K, A, B = map(int, input().split())
if  B - A <= 2:
    print (K + 1)
    exit()

K -= A - 1 #ビスケットの枚数がA枚になるまでにする操作回数を引く
# print ('残り操作回数', K)
if K % 2 == 0: #残りの回数が偶数回 --> ビスケット --> お金 --> ビスケット　をK/2サイクル行う
    print (A + (B - A) * (K // 2))
else:
    print (A + (B - A) * (K // 2) + 1)

Measured memory_bytes: 2940
#include <iostream>
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    if(n % 2 != 0){
        cout << 0 << endl;
        return 0;
    }
    n /= 2;
    ll ans = 0;
    while(n >= 5)	ans += (n /= 5);
    cout << ans << endl;
}

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

using namespace std;

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

int n;
int arr[100100];
ll sum[100100];
pll ran[100100];
ll INF = 1LL<<50, ares;
pll mer(pll a, pll b) {return pll(max(a.first,b.first),min(a.second,b.second));}
ll dis(pll a, pll b) {return min(abs(a.first-b.second),abs(a.second-b.first));}
int main() {
    int i;
    scanf("%d",&n);
    ares = INF;
    for (i=1;i<=n;i++) scanf("%d",&arr[i]);
    for (i=1;i<=n;i++) sum[i] = sum[i-1]+arr[i];
    int s = 1;
    for (i=1;i<=n;i++,s=-s) {
        ran[i] = ((s>0)?pll(s-sum[i],s*INF):pll(s*INF,s-sum[i]));
    }
    ran[0] = pll(0,0);
    pll ret = ran[n];
    ll res = 0;
    for (i=n-1;i>=0;i--) {
        pll tmp = mer(ret,ran[i]);
        if (tmp.first>tmp.second) {
            res += dis(ret,ran[i]);
            if (ret.second<ran[i].first) ret = pll(ran[i].first,ran[i].first);
            else ret = pll(ran[i].second,ran[i].second);
        }
        else ret = tmp;
    }
    ares = min(ares,res);
    s = -1;
    for (i=1;i<=n;i++,s=-s) {
        ran[i] = ((s>0)?pll(s-sum[i],s*INF):pll(s*INF,s-sum[i]));
    }
    ret = ran[n];
    res = 0;
    for (i=n-1;i>=0;i--) {
        pll tmp = mer(ret,ran[i]);
        if (tmp.first>tmp.second) {
            res += dis(ret,ran[i]);
            if (ret.second<ran[i].first) ret = pll(ran[i].first,ran[i].first);
            else ret = pll(ran[i].second,ran[i].second);
        }
        else ret = tmp;
    }
    ares = min(ares,res);
    printf("%lld\n",ares);

    return 0;
}


Measured memory_bytes: 2944
def serect_sort(r, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if r[j] < r[minj]:
                minj = j
        r[i],r[minj] = r[minj],r[i]
        if i != minj:
            cnt +=1
    print(*r)
    print(cnt)

N = int(input())
A = list(map(int, input().split()))
serect_sort(A, N)

Measured memory_bytes: 7756
n=int(input())
f=[list(map(int,input().split())) for i in range(n)]
p=[list(map(int,input().split())) for i in range(n)]
inf=float("inf")
ans=-inf
for i in range(1,2**10):
    x=0
    data=[0]*n
    for j in range(10):
        if (i>>j)&1==1:
            for k in range(n):
                if f[k][j]==1:
                    data[k]+=1
    for i in range(n):
        u=data[i]
        x+=p[i][u]
    ans=max(ans,x)
print(ans)

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

int main(void) {
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == 'o') {
      ans++;
    }
  }
   cout << 700 + 100*ans << endl;
}


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

using namespace std;

string s;

int main(){
    long long int a; cin >> a >> s;

    long long int b = (s[0]-'0')*100 + (s[2]-'0')*10 + (s[3]-'0');
    
    cout << a*b/100 << endl;
    
    return 0;
}


Measured memory_bytes: 3636
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    N,Z,W = map(int, input().split())
    a = list(map(int, input().split()))
    if N>=2:
        print(max(abs(a[-1]-W), abs(a[-1]-a[-2])))
    else:
        print(abs(a[0]-W))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3572
#!/usr/bin/env python

n, m = [int(x) for x in raw_input().split()]
ret = []
pos = {}
pp = []
for i in xrange(m):
	p, y = [int(x) for x in raw_input().split()]
	ret.append((p, y, i))
	pp.append(p)

ret.sort()

last = 0
rank = 0
for p, y, i in ret:
	if last != p:
		rank = 0
		last = p
	rank += 1
	pos[i] = rank

for i in xrange(m):
	print '%06d%06d' % (pp[i], pos[i])


Measured memory_bytes: 30580
import sys
input = sys.stdin.readline

n = int(input())
roots = [[] for _ in range(n)]

for _ in range(n-1):
    u,v,w = map(int,input().split())
    roots[u-1].append((v-1,w))
    roots[v-1].append((u-1,w))

dis = [-1] * n
dis[0] = 0
stack = [0]

while stack:
    label = stack.pop(-1)
    for i,w in roots[label]:
        if dis[i] == -1:
            dis[i] = dis[label] + w
            stack.append(i)

for i in dis:
    if i % 2 == 0:
        print(0)
    else:
        print(1)


Measured memory_bytes: 68272
#include <stdio.h>

int main(){
	int i;
	long a[10000];
	int n;
	long max,min;
	long long int sum;
	scanf("%d",&n);
	for(i = 0;i < n;i++)
		scanf("%ld", &a[i]);
	sum = 0;
	max = -10000000;
	min = 10000000;
	for(i = 0;i < n;i++){
		sum += a[i];
		if(a[i] > max)max = a[i];
		if(a[i] < min)min = a[i];
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K; cin >> N >> K;
    vector<bool> have(N, false);
    rep(i, K){
        int d; cin >> d;
        rep(j, d){
            int a; cin >> a;
            have[a-1] = true;
        }
    }
    int ans = 0;
    rep(i, N) if(!have[i]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}
template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

void solve(){
    char a, b, c, d;
    read(a, b, c, d);
    a -= '0'; b -= '0'; c -='0'; d-='0';
    vi op={-1, 1};
    vector<char> tr={'-', '+'};
    for(int i = 0 ; i < 2 ; i++){
        for( int j = 0 ; j < 2 ; j++){
            for(int k = 0 ; k < 2 ; k++){
                int op1 = op[i], op2=op[j], op3=op[k];
                int sum = a + op1 * b + op2 * c + op3 * d;
                if(sum == 7){
                    printf("%d%c%d%c%d%c%d=7\n", a, tr[i], b, tr[j],  c, tr[k], d);
                    return;
                }
            }
        }
    }
} 

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}

//Thanks to CSES problemset
// I am trained with this kind of problem

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

const int asc = -1;
const int dsc = 1;
const int rnd = 0;

int main(){

  int n, ans = 1;
  cin >> n;

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

  int now = rnd;
  for(int i=0; i<n-1; i++){
    if((now == dsc && a[i] < a[i+1]) || (now == asc && a[i] > a[i+1])){
      ans++;
      now = rnd;
    }
    else if(a[i] > a[i+1]) now = dsc;
    else if(a[i] < a[i+1]) now = asc;
  }

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-14
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    long double a, b, c;
    cin >> a >> b >> c;
    (sqrt(a)+sqrt(b)+EPS < sqrt(c)) ? Yes() : No();
}

Measured memory_bytes: 256