akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;



int main(void){
	int n; cin>>n;
	vector<ll> vx(n), vy(n), vh(n);
	int si = -1;
	for (int i = 0; i < n; i++) {
		cin>>vx[i]>>vy[i]>>vh[i];
		if (vh[i] > 0) si = i;
	}

	ll resx = -1, resy = -1, resh = -1;
	for (ll x = 0; x <= 100; x++) {
		for (ll y = 0; y <= 100; y++) {
			ll h = vh[si] + abs(x - vx[si]) + abs(y - vy[si]);
			bool ok = true;
			for (int i = 0; i < n; i++) {
				if (vh[i] > 0 && h - vh[i] != abs(x - vx[i]) + abs(y - vy[i])) ok = false;
				if (vh[i] == 0 && h > abs(x - vx[i]) + abs(y - vy[i])) ok = false;
			}
			if (ok) resx = x, resy = y, resh = h;
		}
	}

	cout<< resx << " " << resy << " " << resh <<endl;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [[int(i) for i in input().split()] for i in range(n)]
A.append([0, 0, 0])
A.sort()

ans = 'Yes'
count = 0
for i in range(n):
    count += abs(A[i][1] - A[i+1][1]) + abs(A[i][2] - A[i+1][2])
    time = A[i+1][0]
    if time < count:
        ans = 'No'
    elif (time - count) % 2 != 0:
        ans = 'No'
    else:
        count += (time -count)
            
print(ans)

Measured memory_bytes: 21156
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    string n; 
    cin >> n;
    rep(i,n.size()){
        if(n[i]=='7'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

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


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

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

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

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

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

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


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

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

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

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

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


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    S = Scanner.string()
    for s in S:
        if s == '7':
            print('Yes')
            return
    print('No')


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 10580
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
#include <iomanip>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int N;
double p[3000];

double dp[3000][6001];
double solve(int now, int diff){
	if(now == N-1 && diff == 1) return p[now];
	if(now == N-1 && diff == -1) return 1-p[now];
	if(now == N-1) return 0;
	if(dp[now][diff+3000] != -1) return dp[now][diff+3000];
	return dp[now][diff+3000] = solve(now+1,diff-1)*p[now] + solve(now+1,diff+1)*((double)1-p[now]);
}

int main(){
	ios::sync_with_stdio(false);
	
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> p[i];
		for(int j=0; j<=6001; j++) dp[i][j] = -1;
	}

	double ans = solve(0, 1);
	for(int i=3; i<=N; i+=2) ans += solve(0, i);
	cout << std::setprecision(14) << ans << endl;

	return 0;
}

Measured memory_bytes: 141056
#include <stdio.h>

int main(void)
{
	int paid;
	int change;
	int money;
	
	while (1) {
		scanf("%d", &paid);
		if (paid == 0) {
			break;
		}
		
		change = 1000 - paid;
		money = 0;
		if (change >= 500) {
			money++;
			change -= 500;
		}
		if (change >= 100) {
			money += change / 100;
			change -= (change / 100) * 100;
		}
		if (change >= 50) {
			money += change / 50;
			change -= (change / 50) * 50;
		}
		if (change >= 10) {
			money += change / 10;
			change -= (change / 10) * 10;
		}
		if (change >= 5) {
			money += change / 5;
			change -= (change / 5) * 5;
		}
		if (change >= 1) {
			money += change;
		}
		printf("%d\n", money);
	}
	
	return (0);
}

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

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

    vector<double> p(N);
    for (int i = 0; i < N; i++)cin >> p[i];

    double ans = 0;
    double num = 0;
    for (int i = 0; i < K; i++)num += p[i];
    ans = num;
    for (int i = 1; i < N - K + 1; i++) {
        num = num - p[i - 1] + p[i + K - 1];
        if (ans < num)ans = num;
    }
    ans = (ans+(double)K)/(double)2;
 
    cout << fixed << setprecision(13) << (double)ans << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <deque>
#define pb push_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;

int main(void){
  ll n;
  cin>>n;
  cout<<(n*(n+1))/2<<endl;  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
int main(){
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;
    bool fl;
    vector<int> a;
    vector<int> b;
    if(s[0] == '0'){
        fl = true;
        a.push_back(0);
    }
    else{
        fl = false;
    }
    for(int i= 1;i<n;i++){
        if(fl){
            if(s[i] == '1'){
                b.push_back(i);
                fl = false;
            }
        }
        else{
            if(s[i] == '0'){
                a.push_back(i);
                fl = true;
            }
        }
    }
    if(s[n-1] == '0'){
        b.push_back(n);
        a.push_back(n);
    }
    else{
        a.push_back(n);
    }
    int tem = a[k];
    if(b.size()>=k){
        for(int i = k+1;i<a.size();i++){
            tem = max(tem,a[i]-b[i-k-1]);
        }
        cout << tem << endl;
    }
    else{
        cout << n << endl;
    }
}

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

int main() {
  int N,A,B,M,ans,c,d;
  ans=1000000;
  d=1000000;
  c=1000000;
  cin>>A>>B>>M;
  int f[A];
    int b[B];
  int x[M];
 int y[M];
int z[M];
  for(int i=0;i<A;i++){
    cin>>f[i];
    c=min(c,f[i]);
  }
    for(int i=0;i<B;i++){
    cin>>b[i];
      d=min(d,b[i]);
  }
    for(int i=0;i<M;i++){
    cin>>x[i]>>y[i]>>z[i];
      ans=min(ans,f[x[i]-1]+b[y[i]-1]-z[i]);
  }
  ans=min(ans,c+d);
  cout <<ans<< endl;
}

Measured memory_bytes: 2176
N = int(input())
A = list(map(int, input().split()))
count = 0

for i in range(N-1):
    minj = i
    for j in range(i, N):
        if A[j]<A[minj]:
            minj = j
    if A[i] != A[minj]:
        A[i], A[minj] = A[minj], A[i]
        count += 1
print(*A)
print(count)



Measured memory_bytes: 5604
from operator import itemgetter

n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
s = [i[0]-i[1] for i in a]
t = [i[0]+i[1] for i in a]

st = sorted([(s[i], t[i]) for i in range(n)], key=itemgetter(1))
ans = 0
last = -10**10

for i in range(n):
    if last <= st[i][0]:
        ans += 1
        last = st[i][1]

print(ans)


Measured memory_bytes: 72024
import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

N,K=map(int,readline().split())
A=list(map(int,readline().split()))
F=list(map(int,readline().split()))
#print(N,K)
#print("A:",A)
#print(F)

A.sort()
F.sort(reverse=True)
#print("A:",A)
#print("F:",F)

left=-1
right=10**18
#right=10**3

while left+1<right:
  mid=(left+right)//2
  tmp=0
  for i in range(N):
    tmp+=max(A[i]-mid//F[i],0)
    
  if tmp<=K:
    right=mid
  else:
    left=mid
  #print("mid:",mid,",tmp:",tmp)
#print("left:",left,",mid:",mid,",right:",right)
print(right)

Measured memory_bytes: 83736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double acc = 1e-6;
//#define brudeforce 1;
main(){
   ll n,k;
   cin >> n>> k;
   ll result ;
#ifdef bruteforce 
   while( abs(n-k) < n)
      n = abs(n-k) ;
#endif
    if( n >= k){
        n = n%k;
    }

    result = ( n < k-n) ? n : k-n;
    cout << result << endl;
    return 0;
}
  
  

Measured memory_bytes: 256
N = int(input())
A = map(int,input().split())

flag = True
for a in A:
    if a%2==0:
        if(a%3 == 0 or a%5 == 0):
            pass
        else:
            flag = False
if(flag):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 9108
S=input()
T=input()


for i in range(len(S)-len(T)+1):
    cnt=0
    for j in range(len(T)):
        if S[len(S)-len(T)-i+j]=="?":
            cnt+=1
        else:
            if S[len(S)-len(T)-i+j]==T[j]:
                cnt+=1
    if len(T)==cnt:
        ANS=S[:len(S)-len(T)-i]+T+S[len(S)-i:]
        ANS=ANS.replace("?","a")
        print(ANS)
        exit()
    
print("UNRESTORABLE")

Measured memory_bytes: 3064
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 1e6+2 , limit = 9*1e18 , MOD=1e9+7;
int32_t main(){
    int k;cin>>k;
    string s;;
    cin>>s;
    if(s.size() <= k){
        cout<<s<<endl;
    }else{
        cout<<s.substr(0,k);
        // for(int i= k ; i < s.size();i++){
            cout<<"...";
        // }
    }
}

Measured memory_bytes: 3616
N = int(input())
alist = list(map(int, input().split()))
c2 = 0
c4 = 0
kisuu = 0
for a in alist:
    if a % 4 == 0:
        c4 += 1
    elif a % 2 == 0:
        c2 += 1
    else:
        kisuu += 1

if c4 >= (kisuu + (1 if c2 else 0)) - 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 15020
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;
static const cc MAX = 200000;

cc N, M, i, j, k, sub = 0, n = 0, A[MAX], B[MAX];
cc judge = 0, Ans = 0;
string S;
char vec[10];
char T;
/*
vector<cc> vec1(MAX), vec2(MAX);
vector<pair<cc, cc>> pairs(MAX);
*/



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

	if (N >= 3200)
		cout << S << endl;
	else
		cout << "red" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<cmath>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define llong long long
#define INF 999999999
using namespace std;

int main(){
  int N,M;
  scanf("%d %d",&N,&M);

  int mt,e;

  N = N-M;

  mt = 100*N + 1900*M;
  e = mt*pow(2,M);

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


Measured memory_bytes: 128
import math
A,B ,K= map(int,input().split(" "))
def gcd (a: int,b: int) -> int:
    if a < b: a,b = b,a
    return a if b == 0 else gcd(b,a%b)
def lcm (a: int,b: int) -> int:
    return a // gcd(a,b) * b

g = gcd(A,B)

itermx = math.sqrt(g)+1
lst = []
for j in range(1,int(itermx+1)):
    if g % j == 0:
        lst.append(j)
        if g // j != j:
            lst.append(g//j)
lst.sort(reverse=True)
print(lst[K-1])


Measured memory_bytes: 38552
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int s,w;
    cin>>s>>w;
    if(w>=s)cout<<"unsafe";
    else cout<<"safe";
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		System.out.println(Math.max(A*B, C*D));
	}
}


Measured memory_bytes: 21844
# C - Anti-Division

from fractions import gcd

A, B, C, D = map(int, input().split())

CxD = C * D // gcd(C, D)

total_C = B // C
total_D = B // D
total_CxD = B // CxD

sub_C = (A - 1) // C
sub_D = (A - 1) // D
sub_CxD = (A - 1) // CxD

print((B - (A - 1)) -
        (total_C + total_D - total_CxD) + (sub_C + sub_D - sub_CxD))


Measured memory_bytes: 5372
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  ll sum=0,n;
  stringstream ss;
  ss << s;ss >> n;
  rep(i,s.size()) sum+=s[i]-'0';
  if(n%sum==0) pr("Yes");
  else pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


N,M = map(int,input().split())
a = []
for i in range(M):
    x,y = map(int,input().split())
    a.append([x,y])

ans = False
routes_s = []
routes_g = []

for ai in range(len(a)):
    if 1 in a[ai]:
        inx = a[ai].index(1)
        routes_s.append(a[ai][inx-1])
    if N in a[ai]:
        inx = a[ai].index(N)
        routes_g.append(a[ai][inx-1])

# print(routes)
if 1 in routes_g or N in routes_s:
    print("POSSIBLE")
    exit()

s_reach = list(set(routes_s))
g_reach = list(set(routes_g))
sg_reach = list(set(g_reach+s_reach))

if len(s_reach)+len(g_reach) != len(sg_reach):
    print("POSSIBLE")
    exit()

print("IMPOSSIBLE")


Measured memory_bytes: 55236
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int r, d, x;
	cin >> r >> d >> x;

	for (int i = 0; i < 10; ++i) {
		cout << r * x - d << endl;
		x = r * x - d;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p[100505];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    p[0]=p[1]=1;
    for(ll i=2;i*i<=100500;i++)
    if(!p[i])
    for(ll j=i*i;j<=100500;j+=i)
    p[j]=1;
    ll x;
    cin>>x;
    for(ll i=x;i<=100500;i++)
    if(!p[i]){
        cout<<i;
        exit(0);
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#define ll long long
#define vi vector<ll>
#define vs vector<string>
#define fr(i, k, n) for (ll i = k; i < n; i++)
#define rep(i, n) fr(i, 0, n)
#define alll(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)
#define rdd(a) ll a; cin >> a
#define rrd rdd(a); rep(i, a)
//min({a,b,c,d})などの記法
using namespace std;
template <class X> void pr(X x) { cout << x << endl; }
template <class X> void prr(X x) { for (auto it : x) { cout << it<< endl; } }

int main() {
    ll h,w,n;
    cin>>h>>w>>n;
    vector<ll> a(n),b(n);
    rep(i, n)cin>>a[i]>>b[i];
    vector<pair<ll, ll>> vv;
    rep(i, n){
        rep(j, 3){
            rep(k, 3){
                if (a[i] + j - 1 >= 2 &&a[i] + j - 1 <= h-1 &&
                    b[i] + k - 1 >= 2 &&b[i] + k - 1 <= w-1) {
//                    pr("hello");
                    ll aa=a[i] + j - 1,bb=b[i] + k - 1;
                    vv.push_back(mp(aa, bb));
//                    cout <<aa<<" "<<bb<<endl;
                }
            }
        }
//        pr("");
        //        if(m.count(mp(a[i], b[i]))==0){
        //
        //        }
        
    }
    sort(alll(vv));
//    prr(vv);
    vector<ll> vvv(10,0);
    ll tmp=0,ta=0,tb=0,summ=0;
    rep(i, vv.size()){
        if (vv[i].first == ta &&vv[i].second == tb) {
            tmp++;
        }
        else{
//            cout<<ta<<" "<<tb<<endl;
//            pr(tmp);
            vvv[int(tmp)]++;
            tmp=1;
            ta=vv[i].first;
            tb=vv[i].second;
        }
    }
//    cout<<ta<<" "<<tb<<endl;
    
    vvv[int(tmp)]++;
//    pr(tmp);
    rep(i, 10) summ+=vvv[i];
    vvv[0]=(h-2)*(w-2)-summ+1;
    prr(vvv);
    return 0;
}


Measured memory_bytes: 18280
#include <iostream>

using namespace std;

typedef long long int lli;

lli solve(lli a, lli b, lli c, lli k)
{
    lli r = 0;
    if(k > a) {
        r += a;
        k -= a;
    } else {
        return k;
    }

    k -= b;

    if(k <= 0) {
        return r;
    } else {
        r -= k;
    }

    return r;
}

int main()
{
    lli a, b, c, k;
    cin >> a >> b >> c >> k;

    cout << solve(a, b, c, k) << endl;

    return 0;
}


Measured memory_bytes: 3676
#include "bits/stdc++.h"
#define int long long
#define all(c) (c).begin(), (c).end()
#define cpresent(c,x) ((c).find(x) != (c).end()) // present in container?
#define vpresent(c,x) (find(all(c),x) != (c).end()) // present in vector?
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr), cout.tie(nullptr)
#define endl '\n'
using namespace std;

long double a, b;

void solve(){   
    cin >> a >> b;
    int ans = (int) a*(b*1000)/1000;
    printf("%lld",ans);
}
signed main(){
	fastio;
	// int t; cin >> t;
	// while(t--)
		solve();
	return 0;
}


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


int main(){
                                                                     

    int a, b;


    cin >> a >> b;


    if( a + b == 15 ){

         cout << "+" << endl;

         return 0;

         }


    if( a * b == 15 ){

         cout << "*" << endl;

         return 0;

         }


    else  cout << "x" << endl;

    return 0;

    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define lb(x) ((x)&(-(x)))
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define pii pair<int,int> 
#define dalao 1000000007
#define inf 0x3f3f3f3f
#define N 100010
using namespace std;
typedef long long ll;
int n,a[N],r[N];
bool t[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]>a[i-1])t[i]=1,r[i]=a[i];else r[i]=a[i];
	}
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=n;i;i--){
		if(a[i]>a[i+1]){
			if(t[i]&&r[i]!=a[i])return puts("0"),0;
			else if(!t[i])t[i]=1,r[i]=a[i];
		}else if(t[i]&&r[i]>a[i])return puts("0"),0;
		else if(!t[i])r[i]=min(r[i],a[i]);
	}
	int ans=1;
	for(int i=1;i<=n;i++)if(!t[i])ans=1ll*ans*r[i]%dalao;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1152
/*
START BY THE NAME OF ALMIGHTY ALLAH


THIS WONT BE ACCEPTED
STOP_GIVING_UP

*/
#include<bits/stdc++.h>
#define l(n)for(int i=0;i<n;i++)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r,r1=0,r2=0,x=0,k,a=0,b,c=0,m,d=0,n,e,f=0,g,p=0,q=0,y=0,z=0,o=0,t1=0;

    vector<long long>v;
    vector<long long>u;
    vector<long long>s;
    std::vector<int>::iterator it;

    cin>>n>>m;
    if(n<=m)
    {
        cout<<"unsafe";
    }
    else{cout<<"safe"<<endl;}

}


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


#define ll long long
#define pb push_back
#define mp make_pair
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const int inf = 2e18+5;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n,k;
  cin>>n>>k;
  int h[n+1];
  ll dp[n+1];
  loop(i,1,n+1){
    cin>>h[i];
    dp[i]=inf;
  }
  dp[1]=0;
  loop(i,1,n){
    loop(j,i+1,i+k+1)
        if(j<=n) dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
  }
  cout<<dp[n];
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
/********************************************************************************/
int n,m,k;
int a,b,c,d;
int a2[100010];
string s;
vi v;
int main()
{
	cin>>a>>b>>c>>d;
	while(a>0&&c>0)
	{
		c-=b;
		if(c<=0) break;
		a-=d;
	}
	if(a<=0)
	{
		cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int n,m;
	cin>>n>>m;
	int i,j,res=0;
	for(i=0;i<n;i++){
		int k=0;
		for(j=0;j<m;j++){
			k+=in();
		}
		chmax(res,k);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 0
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    r,d,x=map(int,input().split())
    for i in range(10):
        x=r*x-d
        print(x)
    
    
if __name__ == '__main__':
    resolve()

Measured memory_bytes: 9012
#include <iostream>
#include <string>
#include <unordered_map>

int main()
{
  std::unordered_map<std::string, int> m;

  int n;
  std::cin >> n;

  for (int i = 0; i < n; ++i)
  {
    std::string s;
    std::cin >> s;
    ++m[s];
  }
  std::cout << m.size() << std::endl;
}


Measured memory_bytes: 17056
def resolve():
    N = int(input())
    L = sorted(list(map(int, input().split())))
    # print(L)
    ans = 0
    import bisect
    for i in range(N):
        for j in range(i+1, N):
            a, b = L[i], L[j]
            idx1 = bisect.bisect_left(L,b+a)
            idx2 = bisect.bisect_right(L,b-a)
            cnt = idx1 - idx2
            if idx2 <= i <= idx1:
                cnt -= 1
            if idx2 <= j <= idx1:
                cnt -= 1
            if cnt > 0:
                ans += cnt
            # print("a: {} b: {} i: {} j: {} idx1: {}, idx2: {}".format(a, b, i, j, idx1, idx2))
            # print(ans)
    print(ans//3)
    

if '__main__' == __name__:
    resolve()

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


void solve(ll K, ll N, vector<ll> A)
{
    ll ans = LLONG_MAX;
    for(int i=0;i<N;++i)
    {
        ans = min(ans,(A[(i-1+N)%N]-A[i] + K) % K);
    }
    cout<<ans<<endl;
}


int main()
{
    ll K;
    cin >> K;
    ll N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0 ; i < N ; i++)
    {
        cin >> A[i];
    }
    solve(K, N, move(A));
    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()

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

  string ans;
  REP(i,s.size()){
    if(i%2 == 0) ans += s[i];
  }

  cout <<ans <<endl;
}


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

#define endl '\n'
#define int ll
using namespace std;
typedef long long ll;

int a, b;

void init();
void process();

int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    init();
    process();
    cout.flush();
    return 0;
}

void init()
{
    int tmp; cin >> tmp;
    a = tmp/100;
    b = tmp%100;
}

void process()
{
    bool a_m = false, b_m = false;
    if(1 <= a && a <= 12) a_m = true;
    if(1 <= b && b <= 12) b_m = true;

    if(a_m && b_m) cout << "AMBIGUOUS" << endl;
    else if(a_m) cout << "MMYY" << endl;
    else if(b_m) cout << "YYMM" << endl;
    else cout << "NA" << endl;
}



Measured memory_bytes: 256
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    S = stdin.readline().rstrip()
    if N % 2 != 0:
        print('No')
    else:
        if S[: N // 2] == S[N // 2:]:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int data[3] = {1, 0, 0};
  char d, e, f;
  while (cin >> d >> e >> f)
    swap(data[int(d-'A')], data[int(f-'A')]);

  for (int i = 0; i < 3; ++i)
    if (data[i] == 1)
      cout << char(i + 'A') << endl;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    long long int ans=0,tmp=0;
    vector<long long int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }

    sort(A.begin(),A.end());

    if(N%2==0){
        for(int i=0;i<N/2;i++){
            if(i==N/2 -1){
                ans -= A[i];
            }else{
                ans -= 2*A[i];
            }
        }

        for(int i=N/2;i<N;i++){
            if(i==N/2){
                ans += A[i];
            }else{
                ans += 2*A[i];
            }
        }
    }else{
        for(int i=0;i<=N/2;i++){
            if(i==N/2 -1 || i==N/2){
                ans -= A[i];
            }else{
                ans -= 2*A[i];
            }
        }

        for(int i=N/2 + 1;i<N;i++){
            ans += 2*A[i];
        }

        for(int i=0;i<N/2;i++){
            tmp -= 2*A[i];
        }

        for(int i=N/2;i<N;i++){
            if(i==N/2 || i==N/2+1){
                tmp += A[i];
            }else{
                tmp += 2*A[i];
            }
        }
    }

    cout << max(tmp,ans) << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    int m, d;
    cin >> m >> d;
    int cnt = 0;
    for(int i = 2; i <= 9; i++)
    {
        for(int j= 2; j <= 9; j++)
        {
            if(i * 10 + j <= d && i * j <= m)
            {
                cnt++;
            }
        }
    }
    cout << cnt;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int>a(n);
    double sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    int cnt=0;
    rep(i,n){
        if(a[i]>=sum/(4*m)){
            cnt++;
        }
    }
    if(cnt>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,i,M,j,k,x;
  int c=1;
  cin>>N;
  M=N;
  int b[N]={0};
  int a[N]={0};
  for(i=0;i<N;i++){
  cin>>b[i];
  }
  for(k=0;k<N;k++){
  for(i=0;i<M;i++){
    
    x=M-i;
    
  if(b[M-i-1]==x){

  a[N-c]=x;
    c++;
    M--;
    for(j=M-i;j<M;j++){

    b[j]=b[j+1];

    }
    break;
  }
  }
}
//  cout<<c<<endl;
  if(c>N){
  for(i=0;i<N;i++){
  cout<<a[i]<<endl;
  }
  }else{
  cout<<"-1"<<endl;
  }
  }


Measured memory_bytes: 256
M,D = map(int,input().split())
ans = 0
for m in range(1,M+1) :
    for d in range(1,D+1) :
        if d < 10 :
            continue
        d1 = int(str(d)[0])
        d10 = int(str(d)[1])

        if d1 <= 1 or d10 <= 1 :
            continue
        
        if d1 * d10 == m :
            ans += 1
print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<30;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

int main() {
    string s; cin >> s;
    if (s.back() != 's') s += "s";
    else s += "es";
    cout << s << endl;
}

Measured memory_bytes: 3628
d,n  = map(int,input().split())
l1 = []
l2 = []


        
if d == 0:
    if n != 100:
        print(n)
    else:
        print(101)
elif d == 1:
    if n != 100:
        print(n * 100)
    else:
        print(10100)
else:
    if n != 100:
        print(n * 10000)
    else:
        print(1010000)

Measured memory_bytes: 3060
import math
n,d =  map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
count = 0
for xi in range(len(x)):
  for xj in range(xi+1,len(x)):
    dists = [(x[xi][k]-x[xj][k])**2 for k in range(d)]          
    dist = math.sqrt(sum(dists))
    #print(dists,dist)
    if dist.is_integer():
      count+=1
print(count)      

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

int main() {
  int n;
  cin >>n;
  vector<int> a(n);
  rep(i,n) cin >>a[i];
  int ans = 0;
  rep(i,n){
    ans += a[i]-1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,n;
  scanf("%d",&n);
  int a[n+10],b[n+10],c[n+10];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  for(i=0;i<n;i++)
    scanf("%d",&b[i]);
  for(i=0;i<n-1;i++)
    scanf("%d",&c[i]);

  int sum=0;
  for(i=0;i<n;i++){
    sum += b[a[i]-1];
    if(i==0)
      continue;
    else{
      if(a[i-1]==a[i]-1)
        sum += c[a[i-1]-1];
    }
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>

#define MAX_N 100

using namespace std;

int main() {
  int count = 0;
  char s[MAX_N + 1];
  
  while (~scanf("%s\n", s)) {
    int len = strlen(s);
    if (len == 1) count++;
    else {
      bool flag = true;
      int center = len / 2 + len % 2;
      for (int i = 0; i < center && flag; i++) {
        if (s[i] != s[len-i-1]) flag = false;
      }
      if (flag) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
#include<algorithm>
#define REP(i,Z) for(int i=0;i<Z;i++)
int main(){


	int a,b,A[7];
	REP(i,7){	
	cin>>a>>b;
	A[i]=max(a,b)-min(a,b);
	}
	REP(i,7){
	cout<<A[i]<<endl;
	}
	return 0;
}

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

using namespace std;

int main(){
	int n , x, a;
	cin >> n >> x;
	vector<int> nums;
	for(int i = 0; i < n; i++)
	{
		cin >> a;
		nums.push_back(a);
	}
	sort(nums.begin(),nums.end());
	for(int i = 0; i < nums.size(); i++)
	{
		x -= nums[i];
	}
	int ans = n;
	ans +=  x / nums[0];
	cout << ans;
}
	

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#define rep(i,l,n) for(i=l;i<n;i++)

int main(void){
	int n,i,st,sh,cmp;
	char t[101],h[101];
	
	scanf("%d",&n);
	
	st=0;
	sh=0;
	rep(i,0,n){
		cmp=0;
		scanf("%s",t);
		getchar();
		scanf("%s",h);
		
		cmp=strcmp(t,h);
		if(cmp>0) st+=3;
		else if(cmp==0){
			st++; sh++;
		}else sh+=3;
		
	}
	printf("%d %d\n",st,sh);	
	
	return 0;
}

Measured memory_bytes: 608
N,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(N):
    if a[i]<=x and i!=N-1:
        ans+=1
        x-=a[i]
    if i==N-1and x==a[i]:
        ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
using namespace std;


int64_t lDP[51][101];//[i][j]左からi番目までの範囲でj手使った時の最大価値
int64_t rDP[51][101];//[i][j]右からi番目までの範囲でj手使った時の最大価値
int main(){
    const int INF = -1000000000;
    int N,K;
    cin>>N>>K;
    vector<int> V(N);
    for(auto &v:V)cin>>v;
    fill(lDP[0],lDP[N],INF);
    fill(rDP[0],rDP[N],INF);
    lDP[0][0]=rDP[0][0]=0;
    for(int i=1;i<=N;i++){
        int v=V[i-1];
        //拾ってあとで捨てる
        if(i+1<=K)for(int k=i+1;k<=K;k++){
            lDP[i][k]=lDP[i-1][k-2];
        }
        //拾う
        if(i<=K)for(int k=i;k<=K;k++){
            if(lDP[i-1][k-1]==INF) continue;
            if(lDP[i][k]==INF){
                lDP[i][k]=lDP[i-1][k-1]+v;
            }else{
                lDP[i][k]=max(lDP[i][k],lDP[i-1][k-1]+v);
            }
        }
    }
    reverse(V.begin(), V.end());
    for(int i=1;i<=N;i++){
        int v=V[i-1];
        //拾ってあとで捨てる
        if(i+1<=K)for(int k=i+1;k<=K;k++){
            rDP[i][k]=rDP[i-1][k-2];
        }
        //拾う
        if(i<=K)for(int k=i;k<=K;k++){
            if(rDP[i-1][k-1]==INF) continue;
            if(rDP[i][k]==INF){
                rDP[i][k]=rDP[i-1][k-1]+v;
            }else{
                rDP[i][k]=max(rDP[i][k],rDP[i-1][k-1]+v);
            }
        }
    }
    int64_t ans=INF;
    for(int lk=0;lk<=K;lk++){
        for(int rk=0;rk+lk<=K;rk++){
            for(int li=0;li<=N;li++){
                for(int ri=0;ri<=N-li;ri++){
                    ans=max(ans,lDP[li][lk]+rDP[ri][rk]);
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
  int N, a, ans = 0;
  cin >> N;
  for (int i = 1; i <= N; i++)
  {
    cin >> a;
    if (a % 2 && i % 2)
    {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
const long long MOD = 1e9+7, INF = 1e18;
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;}

int A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;

signed main(){
	string s;
	cin>>s;
	map<char,int>mp;
	rep(i,0,s.size())mp[s[i]]++;
	if(mp.size()==2&&mp[s[0]]==2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


@njit('(i8,i8[:],i8,)', cache=True)
def sad(N, A, x):
    s = 0
    for i in range(N):
        s += abs(A[i] - (x + i + 1))
    return s


@njit('(i8,i8[:],)', cache=True)
def solve(N, A):

    min_n = np.min(A) - 10**9
    max_n = np.max(A) + 10**9

    while max_n - min_n != 1:
        tn = (min_n + max_n) // 2
        if sad(N, A, tn) < sad(N, A, tn + 1):
            max_n = tn
        else:
            min_n = tn

    return max_n


def main():

    N = in_n()
    A = np.array(readline().split(), np.int64)

    b = solve(N, A)
    print(sad(N, A, b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 120596
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main() {
	int n, m,k; cin >> n >> m>>k;
	vector<int> a(m),b(m),c(m);
	rep(i, 0, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--; b[i]--; c[i] *= -1; c[i]+=k;
	}
	vector<ll> dist(n, INF);
	dist[0] = 0;
	rep(roop,0,n){
		bool update = false;
		rep(i, 0, m) {
			if (dist[a[i]] != INF && dist[b[i]] > dist[a[i]] + c[i]) {
				dist[b[i]] = dist[a[i]] + c[i];
				update = true;
			}
		}
		if (!update) break;
	}
	ll ans = dist[n - 1];
	vector<bool> neg(n, false);
	rep(roop, 0, n)rep(i, 0, m) {
		if (dist[a[i]] == INF) continue;
		if (dist[b[i]] > dist[a[i]] + c[i]) {
			dist[b[i]] = dist[a[i]] + c[i];
			neg[b[i]] = true;
		}
		if (neg[a[i]]) neg[b[i]] = true;
	}
	if (neg[n - 1]) printf("-1");
	else printf("%lld", max(0LL,-ans));
	return 0;
}


Measured memory_bytes: 384
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,X = map(int,read().split())

"""
# 実験
import itertools
med = lambda x,y,z: x+y+z-min(x,y,z)-max(x,y,z)
change = lambda A: [med(x,y,z) for x,y,z in zip(A,A[1:],A[2:])]
se = set()
for p in itertools.permutations(range(1,10)):
    q = p[:]
    for _ in range(4):
        q = change(q)
    if q[0] == 2:
        print(p)
    se.add(q[0])
se # 2,3,4,5,6,7,8
"""

# 初手で中央にx,xが残るようにすればよい

def case2(N,X):
    if X != 2:
        return False
    return [1,2,3]

def solve(N,X):
    if N == 2:
        return case2(N,X)
    if X == 1 or X == N+N-1:
        return False
    se = set(range(1,N+N))
    A = [0] * (N+N-1)
    if X <= N:
        A[N-1] = X
        A[N] = 1
        A[N+1] = X+1
        A[N-2] = X+2
        se -= set([X,1,X+1,X+2])
    else:
        A[N-1] = X
        A[N] = N+N-1
        A[N+1] = X-1
        A[N-2] = X-2
        se -= set([X,N+N-1,X-1,X-2])
    for i in range(N+N-1):
        if not A[i]:
            A[i] = se.pop()
    return A    

A = solve(N,X)
if not A:
    print('No')
else:
    print('Yes')
    print('\n'.join(map(str,A)))

Measured memory_bytes: 24800
#include <iostream>
#include <math.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
	int i;
	cin>>i;
	cout<<i*i*i;
}


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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    set<string> st;
    for (int i = 0; i < 1000; ++i) {
        string t = to_string(i);
        int sz = t.size();
        rep(i, 3 - sz) {
            t = "0" + t;
        }
        int cur = 0;
        rep(j, S.size()) {
            if (cur >= 3) break;
            if (S[j] == t[cur]) cur++;
        }
        if (cur == 3) st.insert(t);
    }

    cout << st.size() << endl;
}


Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    long long l, r, ans=2020, i, j, tmpi, tmpj;
    cin >> l >> r;

     for(i=l;i<r;i++){
         for(j=i+1;j<=r;j++){
             ans=min(ans, (i*j)%2019);
             if(ans==0) break;
         }
         if(ans==0) break;
     }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pi  3.14159265358979323846
#define mod 1000000007
#define pf push_front
#define pb push_back
#define flush fflush(stdout);
#define null NULL
#define test cout<<"#";
 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(null);
    ll n, k;
    cin>>n>>k;
    vector<ll> v(k);
    for(ll x = 0; x < k; x++)
        cin>>v[x];
    vector<ll> a;
    for(ll x = 1; x < k; x++)
    {
        a.pb((v[x]-v[x-1]));
    }
    ll d = (v[0]+(n - v[k-1]));
    a.pb(d);
    sort(a.begin(),a.end());
    ll sum = 0;
    for(ll x = 0; x < k-1; x++)
        sum +=a[x];
    cout<<sum;
}



Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll H, N; cin >> H >> N;
  ll A = 0;
  REP(i, N){
    ll tmp; cin >> tmp;
    A += tmp;
  }
  if(H > A){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n){
    if(a[i]==0){
      cout <<0;
      return 0;
    }
  }
  ll ans=1;
  rep(i,n){
    if(1000000000000000000/ans<a[i]){
      cout <<-1;
      return 0;
    }
    ans*= a[i];
  }
  cout << ans;
}

Measured memory_bytes: 4052
n,z,w = map(int,input().split())
a = tuple(map(int,input().split()))

res = abs(a[-1]-w)
for i in range(n-1):
    cand = abs(a[-1]-a[i])
    for j in range(i+1,n-1):
        cand = min(a[j]-a[-1],cand)
    res = max(res,cand)
print(res)

Measured memory_bytes: 3188
/***
*	author  :_shamim
*	created : 05.05.2020
*
***/

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <list>
#include <set>
#include <queue>
#include <iterator>
#include <bitset>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#define ll             long long
#define _              ios_base::sync_with_stdio(0);cin.tie(0);
#define loop           for(i=0;i<n;i++)
#define pb             push_back
#define tc()           int t;cin>>t;while(t--)          

using namespace std;

ll i,j,temp;

int main()
{_
	
	set<char > myset;
	char word[27];
	int len=0;
	cin>>word;
	while(word[len]!='\0'){
		len++;
	}
	for(i=0;i<len;i++){
		myset.insert(word[i]);
	}
	if(myset.size()==len){
		cout<<"yes"<<endl;
	}
	else{
		cout<<"no"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256