akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int dp[105][4][4][4];
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   dp[0][0][0][0]=1;
   for(int i=0;i<n;i++)
   {
       rep(a1,0,4)
       {
           rep(a2,0,4)
           {
               rep(a3,0,4)
               {
                   rep(b,0,4)
                   {
                       if(b==2 && a1==3 && a2==1)continue;
                       if(b==2 && a1==1 && a2==3)continue;
                       if(b==3 && a1==2 && a2==1)continue;
                       if(b==2 && a1==3 && a3==1)continue;
                       if(b==2 && a2==3 && a3==1)continue;
                       (dp[i+1][b][a1][a2]+=dp[i][a1][a2][a3])%=M;

                   }
               }
           }
       }
   }
   int ans=0;
   rep(a1,0,4)
   {
       rep(a2,0,4)
       {
           rep(a3,0,4)
           {
               ans+=dp[n][a1][a2][a3];
           }

       }
   }
   cout<<ans%M<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <limits>
#include <algorithm>
#include <memory>
#include <climits>
#include <bitset>

constexpr long long MOD = 1000000007;

int main()
{
  int R, G, B, N;
  std::cin >> R >> G >> B >> N;
  int ans = 0;
  int r = N / R;
  for (int i = 0; i <= r; ++i)
  {
    int n = N - R * i;
    int g = n / G;
    for (int j = 0; j <= g; ++j)
    {
      int n1 = n - G * j;
      if (n1 % B == 0)
        ++ans;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 256
A,B,C,D,E,F = map(int,input().split())
ansx,ansy = 1, 0
for ai in range(F//(100*A)+1):
  for bi in range(F//(100*B)+1):
    if ai ==0 and bi ==0: continue
    s = 0
    for ci in range((F-ai*100*A + bi*100*B)//C +1):
      for di in range((F-ai*100*A + bi*100*B)//D +1):
        s = ci*C + di*D
        if s <=(ai*A + bi*B)*E and s + ai*100*A + bi*100*B <= F:
          if 100*ansy/(ansx+ansy) <= 100*s/(s + ai*100*A + bi*100*B):
            ansx = ai*100*A + bi*100*B
            ansy = s
      
print(ansx+ansy, ansy)

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

int main(){
	char arr[4];
	
	cin>>arr;
	
	sort(arr,arr+4);
	
	if(arr[0]!=arr[2] && arr[0]==arr[1] && arr[2]==arr[3]){
		printf("Yes");
	}else{
		printf("No");
	}
	
	
	return 0;
}




















 

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

int main(){
  int m,d,ans = 0;cin >> m >> d;
  int a,b;
  for(int i=1;i<=m;i++){// i=月
    for(int j=1;j<=d;j++){
      a = j%10;
      b = j/10;
      if(a >= 2 && b >= 2 && a*b == i)ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
}

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

for i in range(1,len(s)):
    dt=int(s[i][0])-int(s[i-1][0])
    dx=int(s[i][1])-int(s[i-1][1])
    dy=int(s[i][2])-int(s[i-1][2])

    if dt<abs(dx)+abs(dy):
        print("No")
        exit()

    if (dx+dy)%2!=dt%2:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 71640
//150
#include <iostream>
#include <cstdio>
using namespace std;

int main(){

	const int x=10001;
	int p[x];
	int i,k,j,n;

	for(i=2; i<x; i++){
		p[i]=1;
	}
	p[0]=p[1]=0;
	for(i=2; i*i<=x; i++){
		if(p[i]){
			for(j=i*2; j<x; j+=i){
				p[j]=0;
			}
		}
	}

	while(1){

		cin >> n;
		if(!n){
			break;
		}

		for(k=n; k>0; k--){
			if(p[k] && p[k-2]){
				cout << k-2 << " " << k << endl;
				break;
			}
		}
	}

}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    long long sum=0;
    for(i=1;i<=n;i++)
    {
        if(i%3==0 || i%5==0)
        {
            continue;
        }
        else
        {
            sum=sum+i;
        }
    }
    cout<<sum;



    return 0;
}


Measured memory_bytes: 3632
h,w=map(int,input().split())
lst=list(input() for i in range(h))
n_h=h
for i in range(len(lst)):
    if "#" not in lst[h-i-1]:
        n_h-=1
        lst.pop(h-i-1)
h=n_h
n_w=w
lst=list(map(list,lst))
for i in range(w):
    T=True
    for b in range(h):
        if lst[b][w-i-1]=="#":
            T=False
            break
    if T:
        for b in range(h):
            lst[b].pop(w-i-1)
            n_w-=1
for b in range(h):
    print("".join(lst[b]))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	Int n; cin >> n;
	vector<Int> a(3*n);
	for(auto &i:a) cin >> i;
	for(auto &i:a) --i;
	vector<vector<Int>> dp(n, vector<Int>(n, -1e9));
	Int m = -1e9;
	vector<Int> mx(n, -1e9);
	vector<Int> my(n, -1e9);

	dp[a[0]][a[1]] = 0;
	m = 0;
	mx[a[0]] = 0;
	my[a[1]] = 0;
	Int ans = 0;
	for(int i=0; i<n-1; ++i){
		queue<tuple<Int, Int, Int>> qu;
		Int p = a[3*i+2], q = a[3*i+3], r = a[3*i+4];

		if(p==q && q==r){
			++ans;
			continue;
		}

		qu.push(make_tuple(p, q, max({dp[p][q], dp[r][r] + 1, m})));
		qu.push(make_tuple(q, p, max({dp[q][p], dp[r][r] + 1, m})));
		qu.push(make_tuple(q, r, max({dp[q][r], dp[p][p] + 1, m})));
		qu.push(make_tuple(r, q, max({dp[r][q], dp[p][p] + 1, m})));
		qu.push(make_tuple(r, p, max({dp[r][p], dp[q][q] + 1, m})));
		qu.push(make_tuple(p, r, max({dp[p][r], dp[q][q] + 1, m})));

		for(int x=0; x<n; ++x){
			if(q == r){
				qu.push(make_tuple(x, p, max(dp[x][p], dp[x][q] + 1)));
				qu.push(make_tuple(p, x, max(dp[p][x], dp[x][q] + 1)));
			}
			if(r == p){
				qu.push(make_tuple(x, q, max(dp[x][q], dp[x][r] + 1)));
				qu.push(make_tuple(q, x, max(dp[q][x], dp[x][r] + 1)));
			}
			if(p == q){
				qu.push(make_tuple(x, r, max(dp[x][r], dp[x][p] + 1)));
				qu.push(make_tuple(r, x, max(dp[r][x], dp[x][p] + 1)));
			}
			qu.push(make_tuple(x, p, mx[x]));
			qu.push(make_tuple(p, x, mx[x]));
			qu.push(make_tuple(x, q, mx[x]));
			qu.push(make_tuple(q, x, mx[x]));
			qu.push(make_tuple(x, r, mx[x]));
			qu.push(make_tuple(r, x, mx[x]));
		}
		for(int y=0; y<n; ++y){
			if(q == r){
				qu.push(make_tuple(y, p, max(dp[y][p], dp[q][y] + 1)));
				qu.push(make_tuple(p, y, max(dp[p][y], dp[q][y] + 1)));
			}
			if(r == p){
				qu.push(make_tuple(y, q, max(dp[y][q], dp[r][y] + 1)));
				qu.push(make_tuple(q, y, max(dp[q][y], dp[r][y] + 1)));
			}
			if(p == q){
				qu.push(make_tuple(y, r, max(dp[y][r], dp[p][y] + 1)));
				qu.push(make_tuple(r, y, max(dp[r][y], dp[p][y] + 1)));
			}
			qu.push(make_tuple(y, p, my[y]));
			qu.push(make_tuple(p, y, my[y]));
			qu.push(make_tuple(y, q, my[y]));
			qu.push(make_tuple(q, y, my[y]));
			qu.push(make_tuple(y, r, my[y]));
			qu.push(make_tuple(r, y, my[y]));
		}

		while(!qu.empty()){
			tuple<Int, Int, Int> t = qu.front();
			qu.pop();
			dp[get<0>(t)][get<1>(t)] = max(dp[get<0>(t)][get<1>(t)], get<2>(t));
			m = max(m, dp[get<0>(t)][get<1>(t)]);
			mx[get<0>(t)] = max(mx[get<0>(t)], dp[get<0>(t)][get<1>(t)]);
			my[get<1>(t)] = max(my[get<1>(t)], dp[get<0>(t)][get<1>(t)]);
		}
	}

	Int ma = 0;
	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			ma = max(ma, dp[i][j] + (i==j && j==a[3*n-1]));
	ans += ma;
	cout << ans << "\n";
}

Measured memory_bytes: 35480
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, M,K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    B = tuple(map(int, input().split()))
    A= list(accumulate(A))
    B= list(accumulate(B))
    ans=0
    ans=bisect_right(B,K)
    for i in range(N):
        a=A[i]
        if a>K:
            break
        ans=max(ans,i+1+bisect_right(B,K-a))
    print(ans)




if __name__ == "__main__":
    main()

Measured memory_bytes: 140396
#pragma GCC Optimize("Ofast")
#pragma GCC Optimize "trapv"
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define TC int t; cin >> t; while(t--)
#define li long int
#define ll long long
#define ull unsigned long long 
#define Vec(x) vector <x>
#define Pai(x,y) pair <x,y>
#define Map(x,y) map <x,y>
#define UMap(x,y) unordered_map <x,y>
#define Set(x) set <x>
#define Sta(x) stack <x>
#define Qu(x) queue <x>
#define DQ(x) deque(x)
#define PriorQ(x)	priority_queue <x>
#define bg begin()
#define ed end()
#define sz size()
#define ct(x) count(x)
#define len length()
#define F first
#define S second
#define Makep make_pair
#define ins(x) insert(x)
#define ers(x) erase(x)
#define endl "\n";
#define MOD 1000000007
#define PI 3.1415926535897932384626
#define clr() clear()
#define fori0(n) for(int i=0;i<n;i++)
#define foriab(a,b) for(int i=a;i<b;i++)
#define mem0(x) memset(x,0,sizeof(x))
#define mem1(x) memset(x,1,sizeof(x))
#define autoit(x) for(auto it=x.beg;it!=x.ed;it++)
#define count0(x) __builtin_popcount(x)
#define ret return 
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

ll a[100005],dp[100005],n;

ll ans(ll i){
	if(i==n-1)
		return 0;
	if(i>=n)
		return INT_MAX;
	if(dp[i]!=-1)
		return dp[i];
	ll left=INT_MAX,right=INT_MAX;
	if(i+1<n){
		left=abs(a[i]-a[i+1])+ans(i+1);
	}
	if(i+2<n){
		right=abs(a[i]-a[i+2])+ ans(i+2);
	}
	return dp[i]=min(left,right);

}

void solve(){
	memset(dp,-1,sizeof(dp));
	cin >> n;
	for(ll i=0;i<n;i++)		cin >> a[i];
	cout << ans(0) << endl;
}

int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
	FAST
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	solve();
	ret 0;
}

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define yes "Yes"
#define yse "Yes"
#define no "No"

#define pb push_back
#define mp make_pair

#define NIL -1

#define list_itr list<ll>::iterator

#define rep(i, l, n) for (int i = (l); i < (n); i++)
#define rep_cs(i, l, n) for (int i = (l); i <= (n); i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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

const int MOD = 1000000007;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(v.begin(), v.end());
// int sum = accumulate(v, v + v.size(), 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

bool binary_search(int a[], int n, int key)
{
    int l = 0;
    int r = n;
    int middle;
    while (l < r)
    {
        middle = (l + r) / 2;
        if (key == a[middle])
        {
            return true;
        }

        if (key > a[middle])
        {
            l = middle + 1;
        }
        else if (key < a[middle])
        {
            r = middle;
        }
    }
    return false;
}

int main()
{
    float c;
    cin >> c;

    cout << c * 2 * 3.14 << endl;
}


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

int main(void){
    long long int H;
    cin >> H;
    long long int N = 1;
    long long int count = 0;
    while(true){
        count += N;
        if(H == 1){
            break;
        }
        H = H/2;
        N = N*2;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
/*G - Travelling Salesman Problem*/

/*F - PLUR @ EDC*/

/*A - Headphones */

#include <bits/stdc++.h>
using namespace std;

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int a, b, c;
	int ans;
	int maximo;

	cin >> a >> b >> c;

	ans = a + b + c;
	maximo = max(a, b);
	maximo = max(maximo, c);

	ans -= maximo;

	cout << ans;

	return 0;
}

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

using namespace std;

int a[22][22];

void solve() {
    int n, d;
    cin >> n >> d;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> a[i][j];
        }
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            int sq = 0;
            for (int k = 0; k < d; k++) {
                int dif = a[i][k] - a[j][k];
                sq += dif * dif;
            }
            int dis = sqrt(sq);
            if (dis*dis == sq) res++;
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
w = int(input())
n = int(input())
l = [list(map(int, input().split(','))) for x in range(n)]

res = [0] * (w + 1)
for i in range(1, w + 1):
    c = i
    for a in l:
        if a[0] == c:
            c = a[1]
        elif a[1] == c:
            c = a[0]

    res[c] = i

for r in res[1:]:
    print(r)

Measured memory_bytes: 7640
#include<bits/stdc++.h>
#define M 1000000007

using namespace std;
typedef long long int ll;

int main()
{
  int n,k;
  cin>>n>>k;
  int rock,scissors, paper;
  cin>>rock>>scissors>>paper;
  string s;
  cin>>s;
  int ans=0;
  string temp;
  for(int i=0;i<n;i++)
  {
      if(i-k<0)
      {
          if(s[i]=='r')
            {
                temp+='p';
                ans+=paper;
            }
         else if(s[i]=='s')
         {
             temp+='r';
             ans+=rock;
         }
         else
         {
             temp+='s';
             ans+=scissors;

         }
      }
      else
      {
          if(s[i]=='r')
          {
              //cout<<s[i-k]<<endl;
              if(temp[i-k]!='p')
              {
                  temp+='p';
                  ans+=paper;
              }
              else
              {
                  if(i+k<n)
                  {

                      if(s[i+k]=='p')
                        temp+='r';
                      else
                        temp+='s';
                  }
                  else
                  {
                      temp+='r';
                  }
              }
          }
          else if(s[i]=='s')
          {
              if(temp[i-k]!='r')
              {
                  temp+='r';
                  ans+=rock;
              }
              else
              {
                  if(i+k<n)
                  {
                    if(s[i+k]=='p')
                    {
                      temp+='p';
                    }
                    else
                    {
                      temp+='s';
                    }
                  }
                  else
                  {
                        temp+='p';
                  }

              }
          }
          else
          {
              if(temp[i-k]!='s')
              {
                  temp+='s';
                  ans+=scissors;
              }
              else
              {
                  if(i+k<n)
                  {
                    if(s[i+k]=='s')
                    {
                        temp+='p';

                    }
                    else
                    {
                        temp+='r';
                    }
                  }
                  else
                    temp+='p';

              }
          }
      }

  }
 // cout<<temp<<endl;
  cout<<ans<<endl;

}


Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d %d",&b,&c);
 
  if(a+b+1>=c){
    printf("%d",b+c);
  }
  
  else printf("%d",b+a+b+1);
  return 0;
}

Measured memory_bytes: 128
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}
nxt_st = set([])

def bfs(pnxt):
    next_q = deque([])
    for hw in pnxt:
        next_q.append(hw)
    nxt = set([])
    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h,w = next_q.popleft()
        if h == glh and w == glw:
            print(ret)
            exit()
        seen[h][w] = 0
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                next_q.append((hs, ws))
                seen[hs][ws] = 0
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                nxt.add((hs, ws))

    return nxt

ret = -1
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    ret += 1
    nxt_st = bfs(nxt_st)
print(-1)


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

int main() {
    int X;
    cin >> X;
    if (X == 7 || X == 5 || X == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <map>

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))

typedef std::stack<int> IntStack;
typedef std::queue<int> IntQueue;
typedef std::vector<int> IntVector;
typedef std::list<int> IntList;

using namespace std;
  
int main(){
  long long N, K;
  cin >> N >> K;
  long long H[N];
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  
  sort(H, H+N);
  long long sum = 0;
  for(int i=0;i<N-K;i++){
    sum += H[i];
  }
  long long ans = sum;
  
  
  
  cout << ans << endl;
}

Measured memory_bytes: 1792
#define N '\0'
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int getop(char []);
void push(double);
double pop(void);

int main()
{
  char s[100];
  int w;
  double op;

  while((w = getop(s)) != EOF && w < 100) {
    switch (w) {
    case '0':
      push(atof(s));
      break;
      
    case '+':
      push(pop() + pop());
      break;
      
    case '*':
      push(pop() * pop());
      break;
      
    case '-':
      op = pop();
      push(pop() - op);
      break;
      
    case '\n':
      printf("%.8g\n", pop());
      break;
      
    default:
      printf("error: unknown command %s\n", s);
      break;
    }
  }
  return 0;
}

double V[100];
int sp = 0;

void push(double f)
{
  if (sp < 100)
    V[sp++] = f;
  else
    printf("error: stack full, can't push %g\n", f);
}

double pop(void)
{
  if (sp > 0)
    return V[--sp];
  else {
    printf("error: stack empty\n");
    return 0.0;
  }
}

#include <ctype.h>

int getch(void);
void ungetch(int);

int getop(char argv[])
{
  int i,x;

  while ((argv[0]= x = getch()) == ' ' || x == '\t')
    
  argv[1] = N;
  if (!isdigit(x) && x != '.')
    return x;
  
  i = 0;
  if (isdigit(x))
    while (isdigit(argv[++i] = x = getch()))
      
  if (x == '.')
    while (isdigit(argv[++i] = x = getch()))
      
  argv[i] = N;
  if (x != EOF)
    ungetch(x);
  
  return '0';
}

char buf[100];
int bp = 0;

int getch(void)
{
  return (bp > 0) ? buf[--bp] : getchar();
}

void ungetch(int x)
{
  if (bp >= 100)
    printf("ungetch: too many characters\n");
  else
    buf[bp++] = x;
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
int main()
{
  char s[19];
for(int i=0; i<19; i++)
{
    cin>>s[i];
    tolower(s[i]);
        s[5]=' ';
        s[13]=' ';
cout<<s[i];
}
}


Measured memory_bytes: 384
import sys
import socket

if socket.gethostname() in ['N551J', 'F551C']:
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    n = read_int()
    a = read_int_list()
    M = 10 ** 9 + 7

    # Compute all inverse modulo M
    inv = [0] * (n + 1)
    inv[1] = 1
    for i in range(2, n + 1):
        inv[i] = (-(M // i) * inv[M % i]) % M

    c = [0] * (n + 1)
    for i in range(n):
        c[i + 1] = (c[i] + inv[i + 1]) % M

    # The same as B in the editorial
    b = [0] * n
    for i in range(n):
        b[i] = (c[i + 1] + c[n - i] - 1) % M

    f = 1
    for i in range(1, n + 1):
        f = (f * i) % M

    res = 0
    for i in range(n):
        res = (res + f * b[i] * a[i]) % M
    return res


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


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

int main() {
  rep(i, 3) rep(j, 3) {
    char c;
    cin >> c;
    if(i == j) cout << c;
  }
  cout << endl;
}

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

int main()
{
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> a(q);
    for (int i=0; i<q; i++) {
        cin >> a.at(i);
    }
    vector<int> ans(n);
    for (int i=0; i<q; i++) {
        ans[a[i]-1]++;
    }

    for (int i=0; i<n; i++) {
        if (q-ans[i] >= k) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }

    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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

int h[111];
int now[111];
int ans, n;

int main(){
	cin >> n;
	REP(i,n)cin >> h[i];
	REP(i,n){
		while(now[i] < h[i]){
			ans++;
			for(int j = i;j < n && now[j] < h[j];j++)now[j]++;
		}
	}

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


Measured memory_bytes: 256
input = require("fs").readFileSync("/dev/stdin", "utf8")

lines = input.split("\n")
N = lines.shift() * 1
A = lines.shift().split(' ').map(function(i) { return i * 1 })
B = lines.shift().split(' ').map(function(i) { return i * 1 })
C = lines.shift().split(' ').map(function(i) { return i * 1 })

ans = 0
for (i = 0; i < N; i++) {
    ans += B[A[i] - 1]
    if (i > 0) {
        if (A[i] - A[i-1] == 1) {
            ans += C[A[i-1] - 1]
        } 
    }
}

console.log(ans)

Measured memory_bytes: 21064
import java.util.Scanner;

class Main {
public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String a = sc.next();
      String b = sc.next();
      String res = "";

      for (int i = 0; i < n; i++) {
        res += (""+ a.charAt(i) + b.charAt(i));
      }

      System.out.println(res);
	}
}

Measured memory_bytes: 21844
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N,K;
	cin >> N>>K;
	ll V[N];
	for (ll i = 0; i < N; ++i) cin >> V[i];
 
	// 解法
	ll ans = 0;
	ll a_max = min(K, N);
	REP(a,a_max+1){
		ll b_max = min(N-a, K-a);
		REP(b,b_max+1){
			vector<ll> ab;
			REP(i,a) ab.pb(V[i]);
			REP(i,b) ab.pb(V[N-i-1]);
			sort(ab.begin(), ab.end());
			ll score = 0;
			REP(i, ab.size()){
				if (ab[i]<0 and i+1<=K-a-b) continue;
				else score += ab[i];
			}
			// printf("a: %lld, b: %lld, ab: ", a,b);
			// REP(i,ab.size()){
			// 	printf("%lld ", ab[i]);
			// }
			// printf("score: %lld", score);
			// printf("\n");
			
			if (ans<score) ans = score;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
string A,B;
cin >> A >> B;
if (A.size() > B.size()) cout << "GREATER" << endl;
else if (A.size() < B.size()) cout << "LESS" << endl;
else {
  for (int i = 0;i < A.size();i++) {
    if (A.at(i) > B.at(i)) {
      cout << "GREATER" << endl;
      return 0;
    } else if (A.at(i) < B.at(i)) {
      cout << "LESS" << endl;
      return 0;
    }
  }
  cout << "EQUAL" << endl;
}

return 0;
}

Measured memory_bytes: 256
mod = 2019
l, r = gets.split(' ').map(&:to_i)
if r - l >= 673
  puts 0
  exit 0
end
min = Float::MAX
for i in l...r do
  for j in (i + 1)..r do
    min = [min, (i * j) % mod].min
  end
end
puts min

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

vector<int> e[200200];

signed main() {

    int n, m;

    cin >> n >> m;

    for(int i = 0; i < m; i++) {
        int a,b ;
        cin >> a >> b;
        e[a].bash(b);
        e[b].bash(a);
    }

    bool f = false;
    for(auto&&u:e[1]) {
        for(auto&&v:e[u]) {
            if(v == n) f = true;
        }
    }
    

    cout << (f?"POSSIBLE\n":"IMPOSSIBLE\n") ;
    
    return 0;
}



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

using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<int,int>:: iterator


#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl



int32_t main()
{
    fast;
    string s;cin>>s;
    for(int i=0;i<s.size();i++)
        cout<<'x';
}   

Measured memory_bytes: 256
a,b,c=map(int,input().split())
total=a*b*c
difMin=1000**18+1

if a%2==0:
    difMin=0
else:
    difMin=min(difMin,b*c)

if b%2==0:
    difMin=0
else:
    difMin=min(difMin,c*a)

if c%2==0:
    difMin=0
else:
    difMin=min(difMin,a*b)
    
print(difMin)


Measured memory_bytes: 3188
#include<iostream>
#define MAX 99999999;
using namespace std;
int p[102];
int mcm[102][102];
int n;
int min(int x,int y) {
	int m = MAX;
	int cost = 0;
	for (int j = x; j < y; j++) {
		cost = mcm[x][j] + mcm[j + 1][y] + p[x-1]*p[j]*p[y];
		if (cost < m) {
			m = cost;
		}
	}
	return m;
}
int calMcm() {
	for (int j = 2; j <= n; j++) {
		for (int i = 1; i <= n-j+1; i++) {
			mcm[i][j+i-1] = min(i, j+i-1);
		}
	}
	return mcm[1][n];
}
int main() {
	int t;

	cin >> n;
	cin >> p[0];
	cin >> p[1];
	for (int i = 2; i <= n; i++) {
		cin >> t >> p[i];
	}

	/*for (int i = 0; i <= n; i++) {
		cout << p[i] << " ";
	}
	cout << endl;*/

	cout << calMcm() << endl;
}




Measured memory_bytes: 3112
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll H[N];
    ll tmp = -1;
    ll ans = 0;
    REP(i, 0, N) {
        cin >> H[i];
        if (H[i] >= tmp) {
            ans++;
            tmp = H[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

typedef long long LL;

inline bool tri(LL a, LL b, LL c){
    return a < b + c;
}

int main(){
    int n;
    cin >> n;
    vector<LL> a(n);
    REP(i, n) cin >> a[i];
    sort(a.begin(), a.end(), greater<LL>());

    LL ans = 0;

    vector<LL> length;
    REP(i, n - 2) {
        if(tri(a[i], a[i + 1], a[i + 2])){
            length.push_back(a[i] + a[i + 1] + a[i + 2]);
            i += 2;
        }
        if(length.size() == 2) {
            ans = max(ans, accumulate(length.begin(), length.end(), 0LL));
            break;
        }
    }

    LL b[2][3] = {};
    int idx[2] = {};
    for(int comb = (1 << 3) - 1; comb < (1 << 6);){
        for(int i = 0; i + 6 <= n; i++){
            memset(idx, 0, sizeof(idx));
            for(int j = 0; j < 6; j++) {
                b[ comb >> j & 1 ][ idx[comb >> j & 1]++ ] = a[i + j];
            }
            if(tri(b[0][0], b[0][1], b[0][2]) && tri(b[1][0], b[1][1], b[1][2])){
                ans = max(ans, accumulate(b[0], b[0] + 3, 0LL) + accumulate(b[1], b[1] + 3, 0LL));
            }
        }

        int x = comb & -comb, y = comb + x;
        comb = ((comb & ~y) / x >> 1) | y;
    }

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

Measured memory_bytes: 1792
// SeeAlso: https://atcoder.jp/contests/abc144/tasks/abc144_c

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(ll i = 1; i <= n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {

    ll n;
    cin >> n;

    ll t = pow(n, 0.5) + 1;
    ll ans = n-1;

    rep(a, t) {
        if(n%a==0) {
            ll b = (n-n%a)/a;
            ans = min(ans, (b+a-2));
        }
    }

    print(ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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;
}

int main(){
    int x;
    cin >> x;
    int y=x/100;
    if (y>=21) cout << 1 << endl;
    else {
        x%=100;
        if (x<=y*5) cout << 1 << endl;
        else cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)
using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> A(N), B(N);
    REP (i, N) {
        cin >> A[i] >> B[i];
    }

    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());

    ll ans = 0;
    REP (i, N) {
        A[i] += ans;
        if (A[i] % B[i] == 0) continue;
        else {
            ans += B[i] - A[i] % B[i];
        }
    }

    cout << ans <<  "\n";
}

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

using namespace std;

int main() {
    int n, m, a[10001], sum=0;
    scanf("%d %d", &n, &m);
    for(int i=1;i<=m;i++)
    {
    scanf("%d", &a[i]);
    sum+=a[i];
    }
    if(sum<=n)
    printf("%d", n-sum);
    else
    printf("-1");
    
    return 0;
}

Measured memory_bytes: 3844
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
    char s[3];
    int i = 0, count = 0;
    char c;
    for (i = 0; i < 3; i++)
    {
        scanf("%c", &c);
        s[i] = c;
    }
    for (i = 1; i < 3; i++)
    {
        if (s[i] != s[i - 1])
            count++;
    }
    if (count)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#define FOR(i,a,b) for(i=a;i<=b;i++)

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long


int A, B, C, D,ans;


int main()
{
	cin >> A >> B >> C >> D;
	ans = min(A, B)+min(C,D);
	cout <<ans;


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int m, n;
float a[101], sum = 0; 
int main () {
    cin >> n >> m;
    for (int i = 1; i <= n; i ++)  {
        cin >> a[i];
        sum += a[i];
    }
    sort(a+1,a+1+n);
    float f = sum / (4 * m * 1.0);
    for (int i = 0; i < m; i ++) {
        if (a[n-i] < f) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,l;
    cin>>n>>l;
    int ans=n*(n+1)/2+n*(l-1);
    if (l>0)
    ans-=l;
    else
    {
        if (n<=abs(l))
        ans-=n+l-1;
    }
    cout<<ans;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string A,B;
    cin>>A>>B;
    if (A.size()!=B.size()){
        cout<<(A.size()<B.size()?"LESS":"GREATER")<<endl;
        exit(0);
    }
    int N=A.size();
    for(int i=0;i<N;i++){
        if (A[i]!=B[i]){
            cout<<(A[i]<B[i]?"LESS":"GREATER")<<endl;
            exit(0);
        }
    }
    cout<<"EQUAL"<<endl;
}

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

int main(void){
    
    unsigned int a = 0;
    unsigned int b = 0;

    cin >>  a >> b;
    
    unsigned int d = a / b;
    unsigned int r = a % b;
    double f = (double)a / b;
    
    cout << d << ' ' << r  << ' ' << fixed << setprecision(6) << f << endl;
    
    return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

int main(){
    int n,c,flag,m,sum;
    
    cin >> n >> m >> c;
    vector<int> B(m,0);
    vector<int> D(m,0);

    for(int j = 0; j < m;j++){
        cin >> B[j];
    }

    for(int i = 0; i < n;i++){
        sum = c;
     for(int k = 0;k < m;k++){
         cin >> D[k];
         sum += B[k]*D[k];
     }   
     if(sum > 0){flag += 1;}
    }
    cout << flag << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
    double x1,x2,y1,y2,b;
    cin >> x1 >> y1>> x2 >> y2;
    printf("%.5f\n",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
int main()
{
	map<long long,bool> m;
	int n;
	string ans;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		long long a;
		cin>>a;
		if(m[a])ans="NO";
		m[a]=true;
	}
	if(ans.size())cout<<ans<<endl;
	else cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 12800
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/abc106/tasks/abc106_c>
 問題文============================================================
 =================================================================
 解説=============================================================
 
 Sの1..K文字まで全て1であれば1、そうでなければ一番最初に現れる1以外の値
 ================================================================
 */


ll solveC(){
    ll res = 0;
    string S; cin >> S; ll K; cin >> K;
    res = 1;
    ll onecnt = 0;
    for(int i = 0; S.length();i++){
        if(S[i] == '1'){
            onecnt++;
        }else{
            res = S[i] - '0';
            break;
        }
    }
    if(onecnt >= K) return 1;
    else return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solveC() << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())
B_list = list(map(int,input().split()))
A_list = []
A_list.append(B_list[0])

for i in range(len(B_list)-1):
     B_i = B_list[i]
     B_j = B_list[i+1]
     A_list.append(min(B_i, B_j))

A_list.append(B_list[N-2])

print(sum(A_list))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define lowbit(x) (x&(-x))
#define MAXN 3000010
using namespace std;
int main(){
	char a[1000];
	bool pd1=false,pd2=false;
	int ans1,ans2;
	scanf("%s",a);
	for(int i=0;i<=100;i++){
		if(a[i]=='C') {
		   if(pd1==false)
		   ans1=i;
		   pd1=true;
		}
		if(a[i]=='F') {
		   ans2=i;
		   pd2=true;
		}
	}
	if(pd1==true&&pd2==true&&ans1<ans2) cout<<"Yes";
	else cout<<"No";
}

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

bool isPalindrome(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  return s == t;
}

int main() {
  string s;
  cin >> s;
  bool ans = true;
  if (!isPalindrome(s)) ans = false;
  if (!isPalindrome(s.substr(0, s.size()/2))) ans = false;
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}

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


void solve(long long N, std::vector<long long> A){
    vector<pair<ll,ll>> a(N);
    rep(i,N){
        a[i].second=i;
        a[i].first=A[i];
    }
    sort(a.begin(),a.end());
    rep(i,N){
        cout<<a[i].second+1<<" ";
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::cout<<std::fixed<<std::setprecision(10);//誤差小数10桁まで
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 3200