akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main() {
  string S, V, res;
  int count = 0;
  cin >> S;
  V = S;
  res = "yes";
  for (int i = 0; i < S.length(); i++) {
    for (int j = 0; j < S.length(); j++) {
      if (S[i] == S[j])
        count++;
    }
    if (count >= 2) {
      res = "no";
      break;
    }
    count = 0;
  }
  cout << res << endl;
  return 0;
}


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;


int main(){
    int N,M;
    cin >> N >> M;
    int cnt = N*(N-1)/2 + M*(M-1)/2;
    cout << cnt << endl;
}


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

	int n,k;
	cin >> n >> k;
	vector<int> h;
	rep(i,n) {
		int a;
		cin >> a;
		h.push_back(a);
	}

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

	int mi = 2e9;
	rep(i,n-k+1) {
		mi = min(mi, h[k-1+i] - h[i]);
	}

	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 892
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int n = 0;
		try {
			n = new Scanner(System.in).nextInt();
		} catch (InputMismatchException e) {
			e.printStackTrace();
		} catch (NoSuchElementException e) {
			e.printStackTrace();
		}
		System.out.println(fractal(n));
	}

	static long fractal(int n) {
		if (n > 1)
			return n * fractal(n - 1);
		else
			return 1;
	}

}

Measured memory_bytes: 17360
#include <iostream>
#include <cmath>
#define EPS 1e-9
using namespace std;
int main(void){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  while(cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd){
	  if(fabs((ya-yb)*(yc-yd)+((xa-xb)*(xc-xd))) <= EPS)cout<<"YES"<<endl;
	  else cout<<"NO"<<endl; 
  }
  return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>
#include <math.h>

#define MPI  3.14159265358979323846

int main(void){
	int a,b,h,m,min;
	double deg_h,deg_m,theta,c;
	
	scanf("%d %d %d %d",&a,&b,&h,&m);
	min=h*60+m;
	deg_h=360*(min/(12*60.0));
	deg_m=360*(m/60.0);

	theta=deg_h-deg_m;
	theta*=theta<0?-1:1;
	theta=theta>180?360-theta:theta;
	c=a*a+b*b-2*a*b*cos(theta*MPI/180.0);
	c=sqrt(c);
	printf("%.20f\n",c);
	

    return 0;
}

Measured memory_bytes: 2476
def examA():
    N = I()
    A = LI()
    A.sort()
    ans = 0
    for i in range(N):
        ans += A[-i*2-2]
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 38084
import sys
input = sys.stdin.readline
wield = 0
l = []
N,H = map(int,input().split())
for i in range(N):
   a,b = map(int,input().split())
   l.append(b)
   wield = max(a,wield)
l.sort(reverse=True)
ret = 0
for a in l:
   if H <= 0:
      break
   if a > wield:
      ret += 1
      H -= a
   else:
      break
if H > 0:
   ret += (H+wield-1)//wield
print(ret)


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

typedef long long ll;
const ll M=1000000007LL;

ll modpow(ll x, ll y){
  if(y==0) return 1;
  if(y==1) return x%M;
  if(y%2==0) return modpow(x*x%M, y/2)%M;
  return modpow(x*x%M, y/2)%M*x%M;
}

ll modinv(ll x){
  return modpow(x, M-2);
}

ll invsum[100001];
int main(){
  invsum[0]=0;
  ll N, A[100001];
  cin >> N;
  for(int i=1;i<=N;i++){
    cin >> A[i];
    invsum[i]=(invsum[i-1]+
               modinv(i))%M;
  }
  
  ll ans=0;
  for(int i=1;i<=N;i++){
    ans=(ans+(invsum[i]+
      invsum[N+1-i]-1)%M
      *A[i]%M)%M;
  }
  for(int i=1;i<=N;i++)
    ans=ans*i%M;
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1792
import java.util.*;
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 ans = a*100+b*10+c;
		if(ans % 4 == 0){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		sc.close();
	}

	private static int calc(int[] a,int ans,int n) {
		int sum=a[0];
		boolean plusFlag;
		// TODO 自動生成されたメソッド・スタブ
		if(a[0] > 0){
			plusFlag = true;
		}else{
			plusFlag = false;
		}



		for(int i = 1;i<n;i++){
			sum += a[i];
			if(plusFlag){
				if(sum >= 0){
					ans += Math.abs(sum)+1;
					sum = -1;

				}
			}else{
				if(sum <= 0){
					ans += Math.abs(sum)+1;
					sum = 1;
				}
			}
			plusFlag = !plusFlag;
		}


		return ans;
	}


}

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

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

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

    return arr

N = int(input())
if N==1:
    print(0)
elif N==2:
    print(1)
else:
    f = factorization(N)
    #print(f)
    
    ans=0
    for elem in f:
        t = elem[1]
        for i in range(1,N):
            if (i*(i+1)//2)>t:
                break
        #print(t,i)
        ans += (i-1)
        
    print(ans)

Measured memory_bytes: 9500
function main(input) {
  let args = input.split(/\s/);
  let result = 0;
  for (let i = args[0] * 1;i <= args[1];i++) {
    if (i % args[2] === 0) {
      result++;
    }
  }
  console.log(result);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;

  vector<int> cnt;
  if(S.at(0)=='0')  cnt.p_b(0);
  int tmp=1;
  REP(i,1,N){
    if(S.at(i)==S.at(i-1))  tmp++;
    else{
      cnt.p_b(tmp);
      tmp=1;
    }
  }
  cnt.p_b(tmp);
  if(S.at(N-1)=='0')  cnt.p_b(0);

  N=sz(cnt);
  vector<int> sum(N+1,0);
  REP(i,1,N+1)  sum.at(i)=sum.at(i-1)+cnt.at(i-1);
  int ans=0;
  for(int i=min(2*K+1,N);i<N+1;i+=2){
    chmax(ans,sum.at(i)-sum.at(max(0,i-(2*K+1))));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4416
// vim: foldmethod=marker
#include <iostream> // cout, endl, cin{{{
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
typedef long long ll;/*}}}*/

int main(int argc, char *argv[])
{
  int n, m;
  cin >> n >> m;

  if (n == m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 888
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
using namespace std;
 
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;   
   //  cin>>TESTS;
    while(TESTS--)
    {
       ll n;
       cin>>n;
       cout<<(n*n*n);
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int a[3];
void judge(int *a)
{
	int t;
	if (a[0] < a[1]) { t = a[0]; a[0] = a[1]; a[1] = t; }
	if (a[1] < a[2]) { t = a[1]; a[1] = a[2]; a[2] = t; }
	if (a[0] < a[1]) { t = a[0]; a[0] = a[1]; a[1] = t; }
}
int main(void)
{
	int sum = 0;
	scanf("%d%d%d", &a[0], &a[1], &a[2]);
	judge(a);
	for (int i = 1; i < 3; i++)
	{
		sum = sum + a[i] - a[i - 1];
	}
	printf("%d", abs(sum));
}

Measured memory_bytes: 128
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    char[][] s = new char[h][w];
    for (int i = 0; i<h;i++){
      s[i] = sc.next().toCharArray();
    }
    sc.close();
    
    int[] pointX = new int[]{0,0,1,-1};
    int[] pointY = new int[]{1,-1,0,0};
    boolean judge = true;
    for (int i = 0;i < h;i++){
      if (!judge){break;}
      for (int j = 0;j < w;j++){
        if (!judge){break;}
        if (s[i][j] == '#'){
          boolean islink = false;
          for (int k = 0;k<4;k++){
            int targetX = j + pointX[k];
            int targetY = i + pointY[k];
            if (targetX >= 0 && targetY >= 0 && targetX < w && targetY < h){
              if (s[targetY][targetX] == '#'){
                islink = true;
                break;
              }
            }
          }
          if (!islink){
            judge = false;
            break;
          }
        }
      }
    }
    String ans = judge ? "Yes":"No";
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
   static  long mod = 1000000007;
    static long dp[][][];
    static long ways(int pos , int rem , int pre , int d , String s)
    {
        if(pos == s.length())
        {
            if(rem==0)
            {
               
            return 1L;
            }
            
            return 0;
        }
        if(dp[pos][rem][pre] != -1)
        return dp[pos][rem][pre];
        
         long ans = 0;
    
         int curr = s.charAt(pos)-'0';
    
         for(int i = 0 ; i <= 9 ; i++)
         {
             if(i <= curr)
             {
                 if(i == curr && pre == 1)
                 ans += ways(pos+1,(rem+i)%d , 1, d , s);
                 
                 else
                 ans += ways(pos+1,(rem+i)%d ,0 , d , s);
             }
             
             else
             {
                 if(pre == 1)
                 break;
                 
                 ans += ways(pos+1,(rem+i)%d , 0 , d , s);
             }
             ans %= mod;
         }
         dp[pos][rem][pre] = ans;
         return ans;
    }
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc = new Scanner(System.in);
	    
		String s = sc.nextLine();
		int d = sc.nextInt();
		int n = s.length();
		dp = new long[n][d][2];
		for(int i = 0 ; i < n ; i++)
		{
		    for(int j = 0 ; j < d ; j++)
		    {
		        dp[i][j][0] = -1;
		        dp[i][j][1] = -1;
		    }
		}
		long ans = ways(0,0,1,d,s);
	     ans--;
	     System.out.println((ans+mod)%mod);
	}
}


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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 2e5 + 5, off = 1 << 18, inf = 1e9;

bool bio[2 * off];
vector<point> T[2 * off];

vector<point> Compress(vector<point> v) {
  vector<point> ret;
  sort(v.begin(), v.end());

  ret.push_back(v[0]);
  FOR(i, 1, sz(v)) {
    if(v[i].second < ret.back().second) {
      ret.push_back(v[i]);
    }
  }

  return ret;
}

int Query(int x, int a) {
  if(!bio[x]) {
    T[x] = Compress(T[x]);
    bio[x] = true;
  }

  int i = lower_bound(T[x].begin(), T[x].end(), point(a, -inf)) - T[x].begin(); --i;
  return T[x][i].second;
}

int Ask(int x, int lo, int hi, int a, int b) {
  if(lo >= b || hi <= a) {
    return inf;
  }
  if(lo >= a && hi <= b) {
    return Query(x, a);
  }

  int mid = (lo + hi) >> 1;

  return min(
             Ask(x * 2 + 0, lo, mid, a, b),
             Ask(x * 2 + 1, mid, hi, a, b)
             );
}

void upd(int i, point p) {
  i += off;
  for(; i; i /= 2) {
    T[i].push_back(p);
  }
}

int a[MAXN];
vector<int> l[MAXN];

int n;

int dp[MAXN];

void solve() {
  int global = 0, delta = 0;

  FOR(i, 1, n + 1) {
    delta = 1 - a[i];
    global += delta;

    for(auto x: l[i]) {
      int val = Ask(1, 0, off, x, i);
      val = min(val, dp[x - 1]);
      upd(i, {x, val});
    }

    upd(i, {i + 1, dp[i - 1] - delta + a[i]});
    upd(i, {0, inf});

    dp[i] = Query(i + off, MAXN);
  }

  cout << dp[n] + global << endl;
}

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

  cin >> n;
  REP(i, n) cin >> a[i + 1];

  int q; cin >> q;
  REP(i, q) {
    int x, y; cin >> x >> y;
    l[y].push_back(x);
  }

  solve();

  REP(i, 2 * off) {
    if(!sz(T[i])) continue;
    if(!bio[i]) T[i] = Compress(T[i]);
    FOR(j, 1, sz(T[i])) {
      assert(T[i][j].second < T[i][j - 1].second);
    }
  }
}


Measured memory_bytes: 118840
#include <cstdio>
#include <iostream>
#include <cctype>
#include <string>
using namespace std;
int main(){
  int a=0,b=0,n;
  string s1,s2;
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    cin>>s1>>s2;
    if(s1>s2) a+=3;
    else if(s2>s1) b+=3;
    else {a+=1;b+=1;}
    }
  printf("%d %d\n",a,b);
  return 0;
}

Measured memory_bytes: 1236
#include <stdio.h>

int main() {
	int a, b, n, s, f;
	scanf("%d%d", &a, &b);
	scanf("%d", &n);
    while(n--) {
        scanf("%d%d", &s, &f);
        if (b > s && a < f) {
            puts("1");
            return 0;
        }
    }
    puts("0");
}



Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n; cin >> n;
  vector<int> p(n); rep(i,n) cin >> p[i];
  int ans=0, minp=INF;
  rep(i,n) if(chmin(minp, p[i])) ans++;

  cout << ans;
  
return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;
class MainClass
{
	static void Main(string[] args)
	{
		Answer();
	}
	public static void Answer()
	{
      var cin = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
      var N = cin[0];
      var K = cin[1];
      var amari = N % K;
      if (amari == 0)
        Console.WriteLine("0");
      else
        Console.WriteLine("1");
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define N 2505
using namespace std;
int n,m,K;
vector<int>P[N],C[N],T[N];
int vis[N];
long long dis[N];
int inu[N];
int mark[N];
void dfs(int p){
	mark[p]=1;
	for(int i=0;i<T[p].size();i++){
		int y=T[p][i];
		if(mark[y])continue;
		dfs(y);
	}
}
void spfa(){
	queue<int>Q;
	for(int i=1;i<=n;i++)dis[i]=0x8f8f8f8f8f8f8f8f,inu[i]=0;
	Q.push(1);dis[1]=0,vis[1]=1,inu[1]=1;
	int cnt=0;
	while(!Q.empty()){
		int v=Q.front();
		Q.pop();
		vis[v]=0;
		if(inu[v]==n){
			if(mark[v]){
				puts("-1");
				return;
			}else continue;
		}
		for(int i=0;i<(int)P[v].size();i++){
			int y=P[v][i];
			if(dis[v]+C[v][i]>dis[y]){
				dis[y]=dis[v]+C[v][i];
				if(!vis[y])Q.push(y),vis[y]=1,inu[y]++;
			}
		}
	}
	printf("%lld\n",max(0LL,dis[n]));
}
void solve(){
	scanf("%d %d %d",&n,&m,&K);
	for(int a,b,c,i=1;i<=m;i++){
		scanf("%d %d %d",&a,&b,&c);
		c-=K;
		P[a].push_back(b);
		C[a].push_back(c);
		T[b].push_back(a);
	}
	dfs(n);
	spfa();
}
int main (){
	solve();
	return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>

int main(){

    char s[1010];
    scanf("%s", s);

    int ult = strlen(s) - 1;

    if(s[ult] == 's'){
        strcat(s, "es\0");
        printf("%s", s);
    }else{
        strcat(s, "s\0");
        printf("%s", s);
    }

    return 0;
}

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

using namespace std;

long long mem[(1<<16)],sum[(1<<16)];
int n;
int mat[16][16];



int main()
{
	cin >> n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin >> mat[i][j];
	for(int i=1;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
			for(int k=j+1;k<n;k++)
				if((i&(1<<j))&&(i&(1<<k)))
					sum[i]+=mat[j][k];
	}
	for(int i=1;i<(1<<n);i++)
	{
		mem[i]=sum[i];
		for(int mas=i;mas>0;mas=(mas-1)&i)
			mem[i]=max(mem[i],mem[mas]+mem[i^mas]);
	}
	cout << mem[(1<<n)-1] << endl;
}

Measured memory_bytes: 1280
function BFS(){
   var bfs=[[s0,0]];
   while(true){
      if(bfs.length==0)break;
      var [leaf,cnt]=bfs.shift();
      if(leaf==s1){
         flag=true;
         console.log(cnt);
         break;
      }
      ab.forEach(v=>{
         if(leaf.includes(v[0])){
            var re = new RegExp(v[0], "g");
            var str = leaf.replace(re,v[1]);
            if(str.length<=10)bfs.push([str,cnt+1]);
         }
      });
   }
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var n=arr.shift()-0;
   if(n==0)break;
   var ab=arr.slice(0,n).map(v=> v.split(" "));;
   arr=arr.slice(n);
   var s0=arr.shift();
   var s1=arr.shift();
   var flag=false;
   BFS();
   if(!flag)console.log(-1);
}


Measured memory_bytes: 19832
X = int(input())
if X < 600:
    print(8)
elif X < 800:
    print(7)
elif X < 1000:
    print(6)
elif X < 1200:
    print(5)
elif X < 1400:
    print(4)
elif X < 1600:
    print(3)
elif X < 1800:
    print(2)
elif X < 2000:
    print(1)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int f[MAX_N]={};
int b[MAX_N]={};
bool dp[MAX_N]={};

int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	ll r=n/(a+b);


	ll r2=n%(a+b);
	r2=min(r2,a);

	cout<<r*a+r2<<endl;
	return 0;
}


Measured memory_bytes: 256
A, B, C, D = list(input())

op = ['-', '+']

for i in range(2 ** 3):
    s = A + op[i & 1] + B + op[(i >> 1) & 1] + C + op[(i >> 2) & 1] + D
    if eval(s) == 7:
        print(s+'=7')
        exit()

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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

//========================================================================//

int main() {
	int a, b; cin >> a >> b;
	if (a > 9 || b > 9) {
		cout << -1 << endl;
	}
	else {
		cout << a * b << endl;
	}
}

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


int main(){
	int n;
    int a;
    int c=0;

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a;
        while(a % 2 == 0){
            c++;
            a = a / 2;
        }
    }
	cout << c << endl;
	
	return 0;
}


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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

    int bs[N];

    int amax = -1;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        amax = max(amax, a);
        bs[i] = b;
    }

    vector<int> used_bs;
    for (int b : bs) {
        if (b > amax) used_bs.push_back(b);
    }

    sort(used_bs.begin(), used_bs.end(), greater<>());

    int ret = 0;
    for (int i = 0; i < used_bs.size(); i++) {
        ret++;
        H -= used_bs[i];
        if (H <= 0) break;
    }

    while (H > 0) {
        ret++;
        H -= amax;
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 2168
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {

        var XY = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        //var S = Console.ReadLine();
        var X = XY[0];
        var Y = XY[1];
        long ans = long.MaxValue;

        if (Y >= X)
        {
            ans = Math.Min(ans, Y - X);
            ans = Math.Min(ans, Math.Abs(Math.Abs(Y) - Math.Abs(X))+1);
        }
        else
        {
            if(X * Y > 0)
            {
                ans = Math.Min(ans, Math.Abs(Math.Abs(Y) - Math.Abs(X)) + 2);
            }
            else if(X * Y == 0)
            {
                ans = Math.Min(ans, Math.Abs(Math.Abs(Y) - Math.Abs(X)) + 1);
            }
            else
            {
                ans = Math.Min(ans, Math.Abs(Math.Abs(Y) - Math.Abs(X)) + 1);
            }
        }

        Console.WriteLine(ans);
    }



}


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

using namespace std;
using   ll=long long;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define pll				pair<int , int>
#define endl            "\n"

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(int a , int m)
{
	return mod_pow(a , m - 2 , m);
}

void solve() {
	int n;
	
	cin >> n;
	
	for(int i = 0; i < n; ++i) {
		cout << "ACL";
	}
}

signed main() {
	fast;
   
    int t = 1;

	//cin >> t;

    while(t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char s[200001];
	scanf("%s", s);
	
	int i, j;
	long long count, total = 0;
	char t[200001];
	for (i = 0, j = 0; s[i] != 0; i++) {
		if (s[i] == 'A') t[j++] = 'A';
		else if (s[i] == 'B' && s[i+1] == 'C') {
			t[j++] = 'B';
			i++;
		} else t[j++] = 'X';
	}
	t[j] = 0;
	i = 0;
	while (t[i] != 0) {
		count = 0;
		for (; t[i] == 'X'; i++);
		for (; t[i] != 'X' && t[i] != 0; i++) {
			if (t[i] == 'A') count++;
			else total += count;
		}
	}
	
	printf("%lld\n", total);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<pi,int>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int k,x;
int main()
{
    go;
    cin>>k>>x;
    int j=1e6;
    for(int i=max(-j,x-k+1);i<=min(j,x+k-1);i++)
        cout<<i<<" ";
    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//int→string
//string→int
//------------------------------------------
inline int toInt(string s) {
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}

template<class T>
inline string toString(T x) {
    ostringstream sout;
    sout << x;
    return sout.str();
}

//sqrt
//-------------------------------------------
template<class T>
inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

//repetition
//------------------------------------------
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  FOR(i,0,n)
#define REPR(i, n) for(int i = n;i >= 0;i--)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {

//    cin >> n;
//    REP(i, n){
//        cin>>a[i];
//    }
//    cin >> K;
//
//    //全探索
//    //bitは{0,1,･･･,n-1}の2^n通りの部分集合全体を動く
//
//    bool exist = false;
//    for(int bit = 0; bit<(1<<n); bit++){
//        int sum = 0;
//        for(int i=0;i<n;i++){
//            //i番目がSに入っていれば足す
//            if(bit & (1<<i)){
//                sum += a[i];
//            }
//        }
//
//        if(sum == K){
//            exist = true;
//        }
//
//    }

    string S; cin >> S;

    LL sum = 0;
    int n = S.length();

    //部分集合を全通り含む ex)100100110
    for(int bit=0; bit<(1<<(n-1)); bit++){
        LL cur = 0;

        //nはビット数
        for(int i=0;i<n;i++){
            cur = cur*10 + (S[i]-'0');

            //もし+のときは
            if(bit&(1<<i)){
                sum+=cur;
                cur=0;
            }
        }
        sum += cur;
    }

    cout<<sum;

    return 0;
}






































































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

count_max = 0
for i in range(0, (len(S) - len(T) + 1)):
    s = S[i:i+len(T)]
    count = 0
    for j in range(0, len(s)):
        if s[j] == T[j]:
            count += 1
    if count_max < count:
        count_max = count

print(len(T) - count_max)



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

int main(void){
 
    int H,A;
    
    cin >> H >> A;
    int cont = 0;
    while(H>0){
        
        H -= A;
        cont++;
    }
    
    cout << cont <<endl;
    
}

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;

ll ch(ll n){
  return n*(n-1)/2;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    int a_t;
    cin >> a_t;
    a[i] = a_t - 1;
  }
  vector<int> v(n);
  rep(i, n) ++v[a[i]];
  // rep(i, n) cout << i << ": " << v[i] << endl;
  ll all = 0;
  rep(i, n) all += ch(v[i]);
  rep(i, n) cout << all - v[a[i]] + 1 << endl;
}


Measured memory_bytes: 4096
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws Exception {
        int Q = Integer.parseInt(br.readLine().trim());
        int[][] lr = new int[Q][2];
        Boolean[] isPrime = new Boolean[100001];
        for (int i = 0; i < lr.length; i++) {
            lr[i] = inputval();
        }
        for (int i = 0; i < isPrime.length; i++) {
            isPrime[i] = true;
        }
        int x;
        for (int i = 2; i < (int) Math.sqrt(isPrime.length); i++) {
            x = 2;
            while (i * x < isPrime.length) {
                isPrime[i * x] = false;
                x++;
            }
        }
        isPrime[0] = false;
        isPrime[1] = false;


        int[] isLike2017 = new int[100001];
        int count = 0;
        for (int i = 0; i < isLike2017.length; i++) {
            isLike2017[i] = 0;
        }
        for (int i = 0; i < isLike2017.length; i++) {
            if (isPrime[i] && isPrime[(i+1)/2]){
                count++;
            }
            isLike2017[i] = count;

        }


        for (int i = 0; i < lr.length; i++) {
            System.out.println(isLike2017[lr[i][1]] - isLike2017[lr[i][0]-1]);
        }
    }


    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    static void array_sout(int[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
    }

    static void array_sout(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
    }
}

Measured memory_bytes: 59036
#include <cstdio>
#include <algorithm>

using namespace std;

int up(int n) {
    return ((n-1)/10+1)*10;
}

int main() {
    int a, b, c, d, e;
    scanf("%d\n%d\n%d\n%d\n%d", &a, &b, &c, &d, &e);
    printf("%d\n", up(a)+up(b)+up(c)+up(d)+up(e)-max({up(a)-a,up(b)-b,up(c)-c,up(d)-d,up(e)-e}));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;


void weather_predicition()
{
  string s;
  cin >> s;

  if (s == "Sunny") cout << "Cloudy\n";
  else if (s == "Cloudy") cout << "Rainy\n";
  else if (s == "Rainy") cout << "Sunny\n";
}


void odds_of_oddness()
{
  int n;
  cin >> n;

  int cnt = 0;
  for (int i = 1; i <= n; ++i)
  {
    if (i % 2 != 0) ++cnt;
  }

  cout << (float)cnt / (float)n << "\n";
}


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

  if (a - 2 * b > 0) cout << a - 2 * b << "\n";
  else cout << 0 << "\n";
}


void cant_wait_for_holiday()
{
  string s;
  cin >> s;

  vector<string> S{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

  int cnt = 7;
  for (int i = 0; i < 7; ++i)
  {
    if (s == S[i]) cout << cnt << "\n"; 
    --cnt;
  }

}


void blackjack()
{
  vector<int> a(3);
  for (int i = 0; i < 3; ++i) cin >> a[i];

  if (accumulate(a.begin(), a.end(), 0) >= 22) cout << "bust\n";
  else cout << "win\n";
}


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

  cout << 6 - a - b;
}


void strings()
{
  string s, t;
  cin >> s >> t;

  cout << t + s << "\n";
}


void yen_conins()
{
  int k, x;
  cin >> k >> x;

  if (k * 500 - x >= 0) cout << "Yes\n";
  else cout << "No\n";
}


int main()
{
  //weather_predicition();
  //odds_of_oddness();
  //curtain();
  //cant_wait_for_holiday();
  //blackjack();
  //round_one();
  //strings();
  yen_conins();
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

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

  int ans=0;
  rep(i,101){
    if(a<i && i<=b && c<i && i<=d) ans++;
  }
  prt(ans);

}


Measured memory_bytes: 256
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;

int main(){
	int n;
	scanf("%d",&n);
	if(n==10 || n==100 || n==1000 || n==10000 || n==100000) puts("10");
	else{
		int ans=0;
		while(n){
			ans+=n%10;
			n/=10; 
		}
		printf("%d\n",ans);
	}
	return 0;
}




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>

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

const int dx[4] = { -1, 0, 0, 1 }, dy[4] = { 0, -1, 1, 0 };
int H, W, M[1234][1234];
vector<vector<int>> water;
vector<set<int>> water_to;
vector<bool> isOne;

int index(int w, int h) {
	if (w < 0 || h < 0 || w >= W || h >= H) return -1;
	return h * W + w;
}

void GetWaterTo(int i) {
	if (water_to[i].size() > 0 || isOne[i]) return;
	if (water[i].size() == 0) water_to[i].insert(i);
	rep(j, water[i].size()) {
		GetWaterTo(water[i][j]);
		if (isOne[water[i][j]] || water_to[water[i][j]].size() >= 2) {
			isOne[i] = true;
			break;
		}
		water_to[i].insert(water_to[water[i][j]].begin(), water_to[water[i][j]].end());
	}
	return;
}

int main() {

	scanf("%d %d", &H, &W);

	water.resize(H*W);
	water_to.resize(H*W);
	isOne.resize(H*W, false);

	vector<pair<int, int>> order;

	int IndexCount = 0;
	rep(i, H) rep(j, W) {
		scanf("%d", &M[i][j]);
		order.push_back(make_pair(M[i][j], IndexCount));
		IndexCount++;
	}

	rep(i, H) rep(j, W) {
		rep(d, 4) {
			if (index(j + dx[d], i + dy[d]) != -1 && M[i][j] > M[i + dy[d]][j + dx[d]]) {
				water[index(j, i)].push_back(index(j + dx[d], i + dy[d]));
			}
		}
	}

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

	rep(i, order.size()) GetWaterTo(order[i].second);
	//rep(i, H*W) GetWaterTo(i);

	int c = 0;
	rep(i, H*W) if (isOne[i] || water_to[i].size() >= 2) c++;

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

	return 0;
}

Measured memory_bytes: 163544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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;}
const ll INF = 1LL<<60;
const ll M = pow(10,9)+7;
/*template*/


int main()
{
  ll h,w;cin>>h>>w;
  ll ans=((h+1)/2)*((w+1)/2)+(h/2)*(w/2);
  if(h==1 || w==1)ans=1;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
max_h = 0
max_x = 0
max_y = 0
for p,q,h in xy:
    if max_h < h:
        max_h = h
        max_x = p
        max_y = q

for top_x in range(101):
    for top_y in range(101):
        top_h = abs(max_x-top_x)+abs(max_y-top_y)+max_h
        for x,y,h in xy:
            if max(top_h-abs(top_x-x)-abs(top_y-y),0) != h:
                break
        else:
            print(top_x,top_y,top_h)
            exit()



Measured memory_bytes: 3064
# -*- coding:utf-8 -*-
import copy

def solve():
    K = int(input())

    if K <= 9:
        print(K)
        return

    que = [i for i in range(1, 10)]
    cnt = 9

    while True:
        tmp_que = copy.deepcopy(que)
        que = []
        for i in tmp_que:
            a = i%10
            for j in range(a-1, a+2):
                if j < 0 or j > 9:
                    continue
                cnt += 1
                new = i*10+j
                if K == cnt:
                    print(new)
                    return
                que.append(new)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 6944
#include <iostream>
#include <vector>
 
inline double func(const double x){
	return x * x;
}


int state_circles(const std::vector<double> &a, const std::vector<double> &b){
    double d;
    d = func(a[0] - b[0]) + func(a[1] - b[1]);
    if(func(a[2] + b[2]) < d)
        return 0;
    if(func(a[2] - b[2]) > d){
        if(a[2] > b[2])
            return 2;
        else
            return -2;
    }
     
    else
        return 1;
}
 
int main(){
    std::vector<double> a(3), b(3);
    int data_num;
    std::cin >> data_num;
    for(int i = 0; i < data_num; ++i){ 
        std::cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];
        std::cout << state_circles(a, b) << std::endl;
    }
     
    return 0;
}
  

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define int long long int
#define gif(a,b) (a/b +(a%b?1:0))
#define pi 3.14159265358
#define watch(x) cout<<(#x)<<" is "<<(x)<<"\n";
#define float long double
using namespace std;

int32_t main()
{   
    cin.tie(NULL);
    std::ios::sync_with_stdio(false);
  	int  d;
  	cin >> d;
  		if( d == 7 || d == 5 || d == 3)
  			cout << "YES";
  		else
  			cout << "NO";
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {

			var inputArray = retreiveLongArray();
			var inputCount = 3;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			//i,jのすべての組み合わせに対して距離を求める
			// X→Yのルートを使う場合とつかわない場合を算出し、小さいほう
			//kと等しい数を数える

			var N = inputArray[0];
			// X >= Y となるように格納する
			var X = (int)Math.Min(inputArray[1], inputArray[2]);
			var Y = (int)Math.Max(inputArray[1], inputArray[2]);

			//key = k Value=kの登場回数
			var distanceDic = new Dictionary<int,int>();

			for (int i = 1; i <= N; i++) {

				for (int j = 1; j <= N; j++) {
					//i < jのときのみ距離を測る
					if (i <j) {
						var distance = getDistance(i,j,X,Y);
						if (distanceDic.ContainsKey(distance)) {
							distanceDic[distance] += 1;
						}
						else {
							distanceDic.Add(distance,1);
						}
					}
				}
			}

			var sb = new StringBuilder();

			//検証用
			//foreach (var item in distanceList) {
			//	Console.WriteLine(item);
			//}


			for (int k = 1; k < N; k++) {

				if(k != 1) {
					sb.Append("\n");
				}

				if (distanceDic.ContainsKey(k)) {
					sb.Append(distanceDic[k]);
				}
				else {
					sb.Append(0);
				}
				//Console.WriteLine($"k ={k}");(For Test)
			}
			//答えの出力
			Console.WriteLine(sb.ToString());

		}

		/// <summary>
		/// i >j, X>Yとなるように入力　iからjの最短距離求める
		/// </summary>
		/// <param name="i"></param>
		/// <param name="j"></param>
		/// <param name="X"></param>
		/// <param name="Y"></param>
		/// <returns></returns>
		private static int getDistance(int i,int j , int X, int Y) {

			var normalRoute = j - i;
			var jumpRoute = Math.Abs(X - i) + Math.Abs(Y - j) + 1;

			return Math.Min(normalRoute, jumpRoute);
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


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

const int N_MAX = 200005;

int L[N_MAX];
int R[N_MAX];

int main(){
    int n, k, c;
    cin >> n >> k >> c;
    string S;
    cin >> S;

    int kmax = 1;
    int nw = -c - 5;
    for(int i = 0; i < n; i++){
        if (nw + c < i && S[i] != 'x'){
            nw = i;
            L[kmax] = i;
            kmax++;
        }
    }
    nw = n + c + 5;
    int kn = k;
    for(int i = n-1; i >= 0; i--){
        if (nw - c > i && S[i] != 'x'){
            nw = i;
            R[kn] = i;
            kn--;
        }
        if (kn == 0)break;
    }
    bool ans = false;
    for(int i = 1; i <= k; i++){
        if (L[i] == R[i]){
            cout << L[i] + 1 << endl;
            ans = true;
        }
    }
    if (!ans)cout << endl;
    return 0;
}

Measured memory_bytes: 5276
import math
n,k = map(int,input().split())

s = 0

a = k
p = 1/2
if a <= n:
  s += p*(n-a+1)

a = (a+1)//2
p = p/2
while True:
  if n >= a:
    s += p*(n-a+1)
  if a == 1:
    break
  p = p/2
  a = (a+1)//2
s += p*n

print(s/n) 
  

Measured memory_bytes: 3060
n = int(input())
a = list(map(int,input().split()))
answer = 1
count = [0] * 3
color = []
for i in range(n):
    pcount=0
    flag=0
    if count[0] == a[i]:
        pcount+=1
        flag=1
    if count[1] == a[i]:
        pcount+=1
        flag=2
    if count[2] == a[i]:
        pcount+=1
        flag=3
    color.append(pcount)
    count[flag-1]+=1
for i in range(n):
    answer=answer*color[i]
print(answer%(10**9+7))

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 	int a,b;
 	cin >> a >> b;
 	if((a*b)&1)
 		cout << "Yes\n";
 	else
 		cout << "No\n";
    return 0;
}

Measured memory_bytes: 256