akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
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 N; cin >> N;
	if(N == 1){cout << 0 << endl; return 0;}
	vector<ll> A(N);
	ll sum = 0;
	rep(i,N)
	{
		cin >> A.at(i); A.at(i) -= i+1;
		sum += A.at(i);
	}
	sort(ALL(A));
	ll ans1 = 0;
	rep(i,N){ans1 += abs(A.at(i) - A.at(N/2));}
	ll ans2 = 0;
	rep(i,N){ans2 += abs(A.at(i) - A.at(N/2+1));}

	ll ans = min(ans1,ans2);
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A,mat &B){
	mat C(A.size(),vec(B[0].size()));
	for(int i=0;i<A.size();i++){
		for(int k=0;k<B.size();k++){
			for(int j=0;j<B[0].size();j++){
				C[i][j]=(C[i][j]+(A[i][k]*B[k][j]%MOD))%MOD;
			}
		}
	}
	return C;
}

mat pow(mat A,ll n){
	mat B(A.size(),vec(A.size()));
	for(int i=0;i<A.size();i++){
		B[i][i]=1;
	}
	while(n>0){
		if(n&1)B=mul(B,A);
		A=mul(A,A);
		n>>=1;
	}
	return B;
}


int n,m,K;
ll p[10001];
ll nec[801];
ll res[30][801];
ll ans[2][801];

int main(void){
	scanf("%d%d%d",&n,&m,&K);
	mat B(n,vec(n));
	for(int i=0;i<m;i++){
		scanf("%d",&p[i]);
	}
	nec[0]++;
	for(int i=0;i<m;i++){
		int mo=p[i]%n;
		nec[mo]++;
	}
	for(int i=0;i<30;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				if(i>0)res[i][(j+k)%n]+=(res[i-1][j]*res[i-1][k])%MOD;
				if(i==0)res[i][j]=nec[j];
				if(res[i][(j+k)%n]>=MOD)res[i][(j+k)%n]%=MOD;
			}
		}
	}
	int prev=0,now=1;
	ans[0][0]=1;
	for(int i=0;i<30;i++){
		if(K>>i & 1){
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					ans[now][(j+k)%n]+=(ans[prev][j]*res[i][k])%MOD;
					if(ans[now][(j+k)%n]>=MOD)ans[now][(j+k)%n]%=MOD;
				}
			}
			swap(now,prev);
			memset(ans[now],0,sizeof(ans[now]));
		}
	}
	for(int i=0;i<n;i++){
		printf("%lld\n",ans[prev][i]);
	}
	return 0;
}

Measured memory_bytes: 8276
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n+1];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = linearSearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int linearSearch(int[] a, int n, int key){
        int i = 0;
        a[n] = key;
        while(a[i] != key){
            i++;
        }
        if(i == n) return -1;
        return i;
    }
}


Measured memory_bytes: 37428
import java.util.*;
class Main {
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int T = scan.nextInt();
    int A = scan.nextInt();
    
    int arr[] = new int [N];
    
    for(int i = 0 ; i< N  ; i++){
      arr[i] = scan.nextInt();
    }
    
    ArrayList<Double> a = new ArrayList<>();
    
    for(int i = 0 ; i < N ; i++){
      a.add( Math.abs(A-(T - arr[i]*.006))) ; 
    }
    
    System.out.println(a.indexOf(Collections.min(a, null))+1);
    
  }
}


Measured memory_bytes: 24020
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
	map <int,int> hash;
    int n,m,ans=0; cin>>n>>m; 
    while (n--){
    	int a,b;
    	cin>>a>>b;
    	hash[a] += b; 
    }
    for (auto &it: hash){
    	if (it.ss<=m) m -= it.ss,ans += it.ss*it.ff ; 
    	else {
    		ans += m*it.ff;
    		break; 
    	}
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

multiset<int> Mset;

int main() {
    int state = 0;
    int N, D, M, T;
    cin >> N;
    for (int i=0;i<N;i++) {
        cin >> D;
        Mset.insert(D);
    }
    cin >> M;
    for (int i=0;i<M;i++) {
        cin >> T;
        if (state == 0) {
            if (Mset.find(T) != Mset.end()) {
                Mset.erase(Mset.find(T));
            } else {
                state = -1;
                Mset.clear();
            }
        }
    }
    if (state==-1) cout << "NO\n";
    else cout << "YES\n";
}


Measured memory_bytes: 9600
while True:
    x = [int(z) for z in input().split(" ")]
    if x[0] == 0 and x[1] == 0: break
    for h in range(0,x[0]):
        for w in range(0,x[1]):
            if h == 0 or h == x[0]-1:
                print("#", end="")
            elif w == 0 or w == x[1]-1:
                print("#", end="")
            else:
                print(".", end="")
        print("\n", end="")
    print("")

Measured memory_bytes: 9144
work = [True] * 100001
work[0] = False
work[1] = False
primes = []
for i in range(100001):
    if work[i]:
        for j in range(2* i, 100001, i):
            work[j] = False


csum = [0] * 100001
index = 0
for i in range(1, 100001):
    if work[i] and work[(i+1)//2]:
        csum[i] = csum[i - 1] + 1
    else:
        csum[i] = csum[i - 1]

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = csum[l-1]
    high = csum[r]
    print(high-low)


Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >> S;
    int count=0;
    for(int i=0; i<S.size(); i++){
        if(S.at(i)=='x'){
            count += 1;
        }
    }
    if(count >=8){
        cout << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner in = new Scanner(System.in);
        int num1 = in.nextInt();
        int num2 = in.nextInt();
        int ans;
        
        ans = Math.max(num1 + num2,num1 - num2);
        ans = Math.max(ans,num1 * num2);
        System.out.println(ans);

        
    }
}


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

int main() {
  int res = 0;
  int N;
  cin >> N;
  vector<vector<int>> indicate(N, vector<int>(N, -1));
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    for (int j = 0; j < A; j++) {
      int x, t;
      cin >> x >> t;
      indicate[i][x - 1] = t;
    }
  }
  int limit = 1 << N;
  for (int i = 1; i < limit; i++) {
    int state = i;
    int j = 0, count = 0;
    vector<bool> honest(N, false);
    while (state > 0) {
      if (state % 2 == 1) {
        count++;
        honest[j] = true;
      }
      state /= 2;
      j++;
    }
    bool valid = true;
    for (int h = 0; valid && h < N; h++) {
      if (honest[h]) {
        for (int id = 0; id < N; id++) {
          if ((indicate[h][id] == 0 && honest[id]) || (indicate[h][id] == 1 && !honest[id])) {
            valid = false;
            break;
          }
        }
      }
    }
    if (valid) {
      res = max(res, count);
    }
  }
  cout << res << endl;
  return 0;
}

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

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

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N, X, T; std::cin >> N >> X >> T;
  int s = std::ceil((double)N/X);
  std::cout << s * T << std::endl;
  return 0;
}



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

#define ll long long
#define NIL 0
#define INF 1e18
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll>
#define vvl vector<vector<ll>> 
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pb push_back
#define F first
#define S second
#define pp pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define rpk(i,k,n) for(int i=k;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++) 
#define RPK(i,k,n) for(int i=k;i<=n;i++) 
#define ritr(i,gr) for(auto i=gr.begin();i!=gr.end();i++)

const int M = 1e9+7;

int V, E, i, j, k, u, v, x, y, p, q, r, t, n;
vi *g;
vb sn;

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

    cin>>n>>k;
    int a[n];
    rep(i,n) cin>>a[i];
    
    bool dp[k+1];
    dp[0] = false;
    REP(i,k) {
        bool ans = false;
        rep(j,n) {
            if(a[j]<=i) if(dp[i-a[j]]==false) ans=true;
        }
        dp[i] = ans;
    }
    if(dp[k]) cout<<"First\n";
    else cout<<"Second\n";
}
    
    
    

Measured memory_bytes: 3756
#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;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int T,D,L;
    while(1){
        cin>>T>>D>>L;
        if(T==0)break;
        int ans=0,a,last=-1e9;
        for(int i=0;i<T;i++){
        if( i-last <=D ){
            ans++;
        }
        cin>>a;
        if(a>=L)last=i;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = true;

int main(){

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

    ll ans = 0;
    for(int i = 1; i < n - 1; i++){
        if(p[i] > p[i - 1] && p[i] < p[i + 1]){
            ans ++;
        }
        if(p[i] < p[i - 1] && p[i] > p[i + 1]){
            ans ++;
        }

    }

    cout << ans <<  endl;

}

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

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

Measured memory_bytes: 3660
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;

bool findCycle(int **Edges, int numEdge, int numVert)
{
	int **R = (int**)malloc(sizeof(int*) * numVert);
	int **T = (int**)malloc(sizeof(int*) * numVert);
	R[0] = (int*)malloc(sizeof(int) * numVert * numVert);
	T[0] = (int*)malloc(sizeof(int) * numVert * numVert);

	for(int i = 0; i < numVert; i++)
	{
		R[i] = &R[0][i * numVert];
		memset(R[i], 0, sizeof(int) * numVert);
		T[i] = &T[0][i * numVert];
		memset(T[i], 0, sizeof(int) * numVert);
	}

	for(int i = 0; i < numEdge; i++)
	{
		R[Edges[i][0]][Edges[i][1]] = 1;
		T[Edges[i][0]][Edges[i][1]] = 1;
	}
	
	for(int k = 0; k < numVert; k++)
	{
		for(int i = 0; i < numVert; i++)
		{
			for(int j = 0; j < numVert; j++)
			{
				T[i][j] = T[i][j] || (T[i][k] && T[k][j]);
				if(i == j && T[i][j] == 1)
				{
					/*for(int i = 0; i < maximum; i++)
					{
						for(int j = 0; j < maximum; j++)
						{
							cout<<T[i][j]<<" ";
						}
						cout<<endl;
					}*/
					return 1;
				}
			}
		}
	}

	/*for(int i = 0; i < numVert; i++)
	{
		for(int j = 0; j < numVert; j++)
		{
			cout<<T[i][j]<<" ";
		}
		cout<<endl;
	}*/
	return 0;
}

int main()
{
	int numVert,numEdge;
	
	cin>>numVert>>numEdge;

	int **Edges = (int**)malloc(sizeof(int*) * numEdge);
	Edges[0] = (int*)malloc(sizeof(int) * numEdge * 2);
	for(int i = 0; i < numEdge; i++)
	{
		Edges[i] = &Edges[0][i*2];
		cin>>Edges[i][0]>>Edges[i][1];
	}

	/*for(int i = 0; i < numEdge; i++)
	{
		cout<<Edges[i][0]<<" "<<Edges[i][1]<<endl;
	}*/

	cout<<findCycle(Edges, numEdge, numVert)<<endl;
	return 0;
}

Measured memory_bytes: 1288
import Text.Regex
import GHC.Exts

data PQ = P | Q deriving (Eq,Show)

main::IO()
main =do
  wh<-getLine
  let w:h:[]=map read (words wh)::[Int]
  ps<-get_n w
  qs<-get_n h
  let pp= map (\x->(P,x)) ps
  let qq= map (\x->(Q,x)) qs
  let pq= sortWith (\(_,x)->x) (pp++qq)
  print (solver w h pq)

get_n::Int -> IO [Int]
get_n 0 = return []
get_n n = do
          c<-getLine
          let m = read c ::Int
          rest<- (get_n (n-1))
          return (m:rest)

solver::Int -> Int -> [(PQ,Int)] -> Int
solver 0 0 [] = 0
solver w h ((P,p_i):rest) = ((h+1)*p_i)+(solver (w-1) h rest)
solver w h ((Q,q_j):rest) = ((w+1)*q_j)+(solver w (h-1) rest)

Measured memory_bytes: 130428
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var K = parseInt(input[0],10);
	var S = parseInt(input[1],10);

    var x;
    var y;
    var z;
    var count = 0;
    for (var i=0;i<=K;i++){
        x = i;
        for (var j=0;j<=K;j++){
            y = j;
            z = S-(x+y);
            if ((z >= 0) && (z <= K)){
                count += 1;
            }
        }
    }
    console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7756
require "date"

while true
  m, d = gets.chomp.split(" ").map(&:to_i)
  exit if m == 0 && d == 0
  wday = Date.new(2004,m,d).wday
  case wday
  when 0
    puts "Sunday"
  when 1
    puts "Monday"
  when 2
    puts "Tuesday"
  when 3
    puts "Wednesday"
  when 4
    puts "Thursday"
  when 5
    puts "Friday"
  when 6
    puts "Saturday"
  end
end

Measured memory_bytes: 6216
S = input()
points = []

s_ = ''
n_points = 0
for i, s in enumerate(S):
    if (s_ == 'R') & (s == 'L'):
        points.append(i - 1)
        n_points += 1
    s_ = s

nearest_point = []
nearest_distance = []
j = 0
for i, s in enumerate(S):
    #print(j, points[j])
    if s == 'R':
        nearest_point.append(points[j])
        nearest_distance.append(points[j] - i)
    else:
        nearest_point.append(points[j-1])
        nearest_distance.append(i - points[j-1])
    if points[min(j, n_points-1)] == i:
        j += 1

#print(points)
#print(nearest_point)
#print(nearest_distance)

ans = [0] * len(S)

for p, d in zip(nearest_point, nearest_distance):
    if d % 2 == 1:
        ans[p + 1] += 1
    else:
        ans[p] += 1

s = ' '.join([str(a) for a in ans])
print(s.strip())


Measured memory_bytes: 15264
unittest
{
	assert( [ "abc" ].parse.expand.solve == "cba" );
	assert( [ "ac" ].parse.expand.solve == "ac" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	if( s.length == 3 ) s.reverse();
	return s;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int m = in.ni(), k = in.ni();
        if(k < Math.round(Math.pow(2,m))){
            if(m==0) out.println("0 0");
            else if(m==1){
                if(k==0)out.println("0 0 1 1");
                else out.println(-1);
            }else{
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < 1<<m; i++) {
                    if(i != k) sb.append(i+" ");
                }
                out.print(new String(sb)+k+" ");
                sb = new StringBuilder();
                for (int i = (1<<m)-1; i >= 0; i--) {
                    if(i != k) sb.append(i+" ");
                }
                out.print(new String(sb)+k+" ");
            }
        }else{
            out.println(-1);
        }
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 57376
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;

const int maxn = 200090;

ll n,k,ab;

ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }

int main(){
    n = read(), k = read();
    ab=n%k; 

	if(ab>abs(ab-k)){
		ab=abs(ab-k);
	}

	printf("%lld\n",ab);

	return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;

void work() {
    LL q, h, s, d;
    cin >> q >> h >> s >> d;
    int n;
    cin >> n;
    LL one = inf;
    one = min(one, 4 * q);
    one = min(one, 2 * h);
    one = min(one, s);
    LL ans = n * one;
    ans = min(ans, n / 2 * d + ((n & 1) * one));
    cout << ans << endl;
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    string S; cin >> S;
    //ll H,W; cin >> H >> W;
    ll sum=0;
    for(int i=0;i<S.length();i++){
        if(S[i]=='o')sum++;
    }
    if(15+sum-S.length()>=8)cout << "YES" << endl;
    else cout << "NO" << endl;
}

/*



 */


Measured memory_bytes: 256
a,b = map(int,input().split())
if (b == 100):
    AB = a * 1000 + b
elif(b > 9):
    AB = a * 100 + b
else:
    AB = a * 10 + b
cnt = 1
ans = False
while(True):
    x = cnt * cnt
    if(x == AB):
        ans = True
    if(x > AB):
        break
    cnt += 1
if(ans):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
/* Author : A110011 - 00:19 "CodeIn Hard Way" */

#include<bits/stdc++.h>

#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             10000007
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
typedef long long int ll;

using namespace std;


int solve(int day,int flg,int n,vector<vector<int>> &res, vector<vector<int>> &dp){
        if(day==n){
            return 0;
        }
    
    
    if(dp[day][flg]!=-1){
        return dp[day][flg];
    }
    int mx=0;
    
    if(flg==0){
        mx=max(mx,res[day][1]+solve(day+1,1,n,res,dp));
        mx=max(mx,res[day][2]+solve(day+1,2,n,res,dp));
        mx=max(mx,res[day][3]+solve(day+1,3,n,res,dp));
                   
    }else if(flg==1){
        mx=max(mx,res[day][2]+solve(day+1,2,n,res,dp));
        mx=max(mx,res[day][3]+solve(day+1,3,n,res,dp));
    }else if(flg==2){
        mx=max(mx,res[day][1]+solve(day+1,1,n,res,dp));
        mx=max(mx,res[day][3]+solve(day+1,3,n,res,dp));
    }else{
        mx=max(mx,res[day][1]+solve(day+1,1,n,res,dp));
        mx=max(mx,res[day][2]+solve(day+1,2,n,res,dp));
    }
    
    return dp[day][flg]=mx;
}

int main(){

	// For fast I/O.
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif */
    
   int n;
    cin>>n;
    
    vector<vector<int>> res(n,vector<int>(4));
    
    for(int i=0;i<n;i++){
        int x,y,z;
        cin>>x>>y>>z;
        
        res[i][1]=x;
        res[i][2]=y;
        res[i][3]=z;
    }
   
    vector<vector<int>> dp(n,vector<int>(4,-1));
    
    cout<<solve(0,0,n,res,dp)<<endl;


return 0; 
}


Measured memory_bytes: 19072
#include <bits/stdc++.h>
       
      #define X first
      #define Y second
       
      using namespace std;
       
      typedef long long ll;
      typedef pair<ll, ll> pii;
       
      const int N = 2e5 + 50;
       
      int n;
      ll c;
      ll h[N];
      ll dp[N];
      vector<int> env;
       
      ll _ccw(pii a, pii b, pii c) {
        return a.X * (b.Y - c.Y) + b.X * (c.Y - a.Y) + c.X * (a.Y - b.Y);
      }
       
      int ccw(pii a, pii b, pii c) {
        ll get = _ccw(a, b, c);
       
        if(get > 0LL)
          return 1;
        else if (get < 0LL)
          return -1;
        return 0;
      }
       
      pii conv(int i) {
        return {-2LL * h[i], h[i] * h[i] + dp[i]};
      }
       
      void insert(int i) {
        if(env.empty()) {
          env.push_back(i);
          return;
        }
       
        int top = env.back();
        env.pop_back();
       
        while(!env.empty() && ccw(conv(env.back()), conv(top), conv(i)) >= 0)
          top = env.back(), env.pop_back();
       
        env.push_back(top);
        env.push_back(i);
      }
       
      ll comp(int i, ll val) {
        return -2LL * h[i] * val + h[i] * h[i] + dp[i];
      }
       
      int query(ll val) {
        int lo = 0, hi = env.size() - 1, mid;
       
        while(lo < hi) {
          mid = (lo + hi) >> 1;
        
          if(comp(env[mid], val) >= comp(env[mid + 1], val))
            lo = mid + 1;
          else
            hi = mid;
        }
       
        return env[lo];
      }
       
      void load() {
        scanf("%d%lld",  &n, &c);
       
        for(int i = 0; i < n; ++i)
          scanf("%lld", h + i);
      }
       
      void solve () {
        dp[0] = 0;
       
        insert(0);
       
        for(int i = 1; i < n; ++i) {
          int j = query(h[i]);
		  /*if(i == 4) {
			  for(auto it : env)
				  printf("%d ", it);
			  printf(" J %d\n", j);
		  }*/
          dp[i] = (h[i] - h[j]) * (h[i] - h[j]) + c + dp[j];
          assert(dp[i] > 0 && dp[i] > dp[j]);
          insert(i);
        }
       
        printf("%lld\n", dp[n - 1]);
      }
       
      int main() {
        load();
        solve();
       
        return 0;
      }

Measured memory_bytes: 4472
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int k, s;  cin >> k >> s;
	ll ans = 0;
	for(int z = 0 ; z <= k ; z++)
		for(int y = 0 ; y <= k ; y++)
			if(0 <= s - z - y && s - z - y <= k)  ans += 1;

	cout << ans << endl;

	return 0;
}


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

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MAX = 1e6+5;
constexpr ll INF = 2134567890;
constexpr ll MOD = 1e9+7;

ll fpow(ll b, ll a, ll MOD = MOD) {
    b %= MOD;
    ll r = 1;
    for(; a; b=b*b%MOD, a>>=1)
        a&1 && (r = r*b%MOD);
    return r;
}

signed main() {
    FAST;

    int H, W, N;
    cin >> H >> W >> N;
    pii *pos = new pii[N]();
    Fr(i, 0, N) cin >> (pos+i)->Ft >> (pos+i)->Sd;
    auto hh = [](const int x, const int y) {
        return x*MOD+y;
    };
    unordered_set<ll> pts{};
    Fr(i, 0, N)
        pts.insert(hh((pos+i)->Ft, (pos+i)->Sd));
    ll *ans = new ll[10]();
    int nx, ny, cnt;
    unordered_set<ll> visit{};
    Fr(i, 0, N) {
        tie(nx, ny) = pos[i];
        Fr(x, nx-1, nx+2) Fr(y, ny-1, ny+2) if (2 <= min(x, y) && x < H && y < W) {
            if (visit.find(hh(x, y)) != visit.end()) continue;
            visit.insert(hh(x, y));
            cnt = 0;
            Fr(tx, x-1, x+2) Fr(ty, y-1, y+2)
                cnt += pts.find(hh(tx, ty)) != pts.end();
            ans[cnt]++;
        }
    }
    ll sum = 0;
    Fr(i, 1, 10) sum += ans[i];
    ans[0] = ll(H-2)*(W-2) - sum;
    Fr(i, 0, 10) cout << ans[i] << endl;

}


Measured memory_bytes: 41488
#include<bits/stdc++.h>
             
            using namespace std;
            typedef long long int lld;
            #define INF 1000000000000000000
            #define MOD 1000000007
            int n;
            lld FT[1000000];
            void upd(int pos, lld val){
            	for(int i=pos;i<=n;i+=(i&(-i))){
            		FT[i]=max(FT[i],val);
            	}
            }
            lld ans(int pos){
            	lld ans=0;
            	for(int i=pos;i>0;i-=(i&(-i))){
            		ans=max(FT[i],ans);
            	}return ans;
            }
            int main(){
            	cin>>n;
            	int per[n];
            	for(int i=0;i<n;i++)scanf("%d",&per[i]);
            	for(int i=0;i<=n;i++)FT[i]=0;
            	lld DP[n+1];
            	DP[0]=0;
                lld Ans=0;
            	for(int i=0;i<n;i++){
            		lld x;
            		scanf("%lld",&x);
            		DP[i+1]=x+ans(per[i]);
            		upd(per[i],DP[i+1]);
                    Ans=max(Ans,DP[i+1]);
            		//cout<<DP[i+1]<<endl;
            	}printf("%lld\n",Ans);
            	
            	
            	return 0;
            }

Measured memory_bytes: 4096
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

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

#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)

class AGarden {
public:
	void solve(std::istream& in, std::ostream& out) {
		int a, b; in >> a >> b;
		out << a*b - a - b + 1;
	}
};


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	AGarden solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000001

int main(){
	
	int N;
	cin>>N;
	
	long long T;
	cin>>T;
	
	vector<pair<long long,long long>> A;
	vector<long long> B;
	
	for(int i=0;i<N;i++){
		long long a,b;
		cin>>a>>b;
		if(a==0)B.push_back(b);
		else A.emplace_back(a,b);
	}
	
	sort(B.begin(),B.end());
	
	sort(A.begin(),A.end(),[&](pair<long long,long long> a,pair<long long,long long> b){
		return a.first*(b.second+1)>b.first*(a.second+1);
	});
	
	vector<vector<long long>> dp(A.size()+1,vector<long long>(100,Inf));
	dp[0][0] = 0LL;
	
	for(int i=0;i<A.size();i++){
		//cout<<A[i].first<<','<<A[i].second<<endl;
		for(int j=0;j<100;j++){
			if(dp[i][j]==Inf)continue;
			dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
			
			if(j!=99){
				dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]+1+(dp[i][j]+1)*A[i].first + A[i].second);
			}
		}
	}
	
	int ans = 0;
	for(int i=0;i<100;i++){
		long long t = T-dp.back()[i];
		if(t<0)break;
		int x = i;
		for(int j=0;j<B.size();j++){
			if(t>=B[j]+1){
				t-=B[j]+1;
				x++;
			}
		}
		ans = max(ans,x);
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 170376
#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
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> t(N+2),v(N+2);
  t[0] = t[N+1] = 0;
  for(int i=1; i<=N; i++){
    cin >> t[i];
  }
  v[0] = v[N+1] = 0;
  for(int i=1; i<=N; i++){
    cin >> v[i];
  }
  vector<int> l(N+2),r(N+2);
  l[0] = r[0];
  for(int i=1; i<=N+1; i++){
    l[i] = r[i-1];
    r[i] = r[i-1] + t[i];
  }
  double ans = 0;
  double now = 0;
  for(double i=0; i<=r[N+1]; i+=0.5){
    double pre = now;
    now += 0.5;
    for(int j=0; j<=N+1; j++){
      if(l[j]<=i && i<=r[j]){
        chmin(now,(double)v[j]);
      }else if(i < l[j]){
        chmin(now,(double)v[j]+l[j]-i);
      }else{
        chmin(now,(double)v[j]+i-r[j]);
      }
    }
    // cout << now << "\n";
    ans += (double)(now+pre)/4;
  }
  cout << fixed << setprecision(10) << ans << "\n";
  return 0;
}

Measured memory_bytes: 3768
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    int H[100005];
    cin>>n;
    for(int i=0;i<n;i++) cin>>H[i];
    int m=0,s=0;
    for(int i=0;i<n-1;i++){
        if(H[i]>=H[i+1]){
            s++;
        }
        else{
            m=max(m,s);
            s=0;
        }
    }
    cout<<max(m,s)<<endl;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main() {
	int N;
	long long sum = 0;

	cin >> N;

	for (int i = 1; i <= N; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3636
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<cstdio>
#include <iomanip>
#include <limits>
#include<vector>
using namespace std;

int main()
{
	int N, M,i, j, k, l, m, n, o, p;
	long long int sum, flag, cc, cnt;
	sum = 0;
	flag = 1;
	cc = 0;
	cnt = 0;
	cin >> N >> M;
	bool start[100001] = {};
	vector<pair<int,int>>P(M);
	for (i = 0; i<M; i++) {
		cin >> P[i].second>>P[i].first;
	}
	sort(P.begin(), P.end());
	int ans = 0;
	int t = 0;
	for (i = 0; i < M; i++) {
		if(t <= P[i].second) {
			ans++;
			t = P[i].first;
		}
	}
	cout << ans << endl;


	return 0;
}



Measured memory_bytes: 1152
n = 100
a = []
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            a.append(i**2+j**2+k**2+i*j+j*k+k*i)

from collections import Counter
u = Counter(a)

n = int(input())
for i in range(1,n+1):
    if i in u.keys():
        print(u[i])
    else:
        print(0)

Measured memory_bytes: 49276
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
//_____
#define pb push_back
#define fi first
#define se second
#define mkp make_pair
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define outl(x) cout << (x) << '\n'
#define FAST() cin.tie(0), ios::sync_with_stdio(false)
typedef pair<int,int> pii;
//_______

vector <int> G[102];
pii d[102];
int tt;
int N;

void dfs(int u)
{
   d[u].fi = ++tt;
   rep(i, G[u].size()){
      if( d[ G[u][i] ].fi == 0 )dfs( G[u][i] );
   }
   d[u].se = ++tt;
   return ;
}

void slv()
{
   tt = 0;
   reps(i, 1, N)
      if( d[i].fi == 0 ) dfs(i);
   reps(i, 1, N)
      cout << i << ' ' << d[i].fi << ' ' << d[i].se << '\n';
}

signed main()
{
   FAST();
   int u, k, p;

   cin >> N;
   reps(i, 1, N){
      cin >> u >> k;
      while(k--){
         cin >> p;
         G[u].pb(p);
      }
   }

   slv();
   return (0);
}




Measured memory_bytes: 3176
#include<bits/stdc++.h>
int main(){
    int n,p;std::cin>>n>>p;
    std::string s;std::cin>>s;
    if(p==2||p==5){
        long long ans=0;
        for(int i=0;i<n;i++){
            if((s.at(i)-'0')%p==0){
                ans+=i+1;
            }
        }
        std::cout<<ans<<std::endl;
        return 0;
    }
    int now=0;
    std::map<int,long long>map;
    map[0]++;
    int coeff=1;
    for(char c:std::string(s.rbegin(),s.rend())){
        now+=(c-'0')*coeff;
        now%=p;
        coeff=coeff*10%p;
        map[now]++;
    }
    long long ans=0;
    for(auto&&p:map){
        long long x=p.second;
        ans+=x*(x-1)/2;
    }
    std::cout<<ans<<std::endl;
}



Measured memory_bytes: 1284
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP priority_queue
#define heap(T) priority_queue<T,vector<T>,greater<T> > 
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=200005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
const int BufferSize=1<<25;
char buffer[BufferSize],*Bufferhead,*Buffertail;
int Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T> inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){c=Getchar();rev|=c=='-';if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	x=rev?-x:x;
	return 1;
}
template<class T>inline void print(T x,const char c){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[10];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,dep[N],fa[N],a[N],p[N];
vi g[N];
bool vis[N],on[N];

inline void add(int x,int y){g[x].pb(y);g[y].pb(x);}
inline void pre_dfs(int x){
	vis[x]=1;
	for(int y:g[x]){
		if(!vis[y]){
			fa[y]=x;dep[y]=dep[x]+1;
			pre_dfs(y);
			continue;
		}
		if(dep[y]>dep[x]){
			while(y!=x) on[y]=1,y=fa[y];
			on[x]=1;
		}
	}
}
inline int dfs(int x){
	vi tmp;tmp.clear();
	for(int y:g[x])
		if(!on[y]) tmp.pb(dfs(y));
	for(int i:tmp) vis[i]=1;
	int k=0;
	while(vis[k]) k++;
	for(int i:tmp) vis[i]=0;
	return k;
}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&p[i]);
		add(p[i],i);
	}
	pre_dfs(1);clr(vis,0);
	for(int i=1;i<=n;i++)
		g[i].clear();
	for(int i=1;i<=n;i++) g[p[i]].pb(i);
	int cnt=0,tag=0;
	for(int i=1;i<=n;i++)
		if(on[i]) cnt++;
	if(cnt%2==0){puts("POSSIBLE");return 0;}
	for(int i=1;i<=n;i++)
		if(on[i]) a[i]=dfs(i),tag=a[i];
	for(int i=1;i<=n;i++)
		if(on[i]&&a[i]!=tag){puts("POSSIBLE");return 0;}
	puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 21760
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

int para;


int input(int n){
    cout << n << endl;
    string s;
    cin >> s;
    if (s == "Male") return 0;
    if (s == "Female") return 1;
    
    exit(0);
}

int main(){
    //cin.tie(0);

    int N; cin >> N;

    int low = 0;
    int high = N-1;
    int mid;
    int lres;
    int hres;
    int mres;

    lres = input(low);
    hres = input(high);
    for (int i = 0; i < 18; i++){
        mid = (high+low)/2;
        mres = input(mid);
        if (low%2 == mid%2){
            if (lres == mres){
                low = mid;
                lres = mres;
            }else{
                high = mid;
                hres = mres;
            }
        }else{
            if (lres != mres){
                low = mid;
                lres = mres;
            }else{
                high = mid;
                hres = mres;
            }
        }
    }
}


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

#define sf(n) scanf("%d",&n)
#define pd(n)  printf("%.12lf",n)
#define pf(n)  printf("%d\n", n)
#define p() 	printf("\n")
#define ps() 	printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000000000
#define pi 3.1415926536
#define ex 1e9
#define dbl 1e09
#define  qu(q)    queue<int>q
#define pqu(q)    priority_queue<int>q
#define len(s)   s.length()
#define sz(x)    x.size()
#define pb(x)    push_back(x)
#define all(x)   x.begin(),x.end()
#define rall(x)  x.rbegin(),x.rend()

int main() {
    //freopen("input.txt","r",stdin);
    int n,h,w,a,b,cnt=0;
    cin>>n>>h>>w;
    while(n--){
        cin>>a>>b;
        if(a>=h and b>=w)
            cnt+=1;
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let a = read::<i64>();
  let b = read::<i64>();
  let c = read::<i64>();
  let k = read::<i64>();

  let mut max_v = max(a, max(b, c));
  let mut max_v_mul = max(a, max(b, c));

  for _ in 0..k {
    max_v_mul = max_v_mul * 2;
  }

  println!("{}", (max_v_mul - max_v) + a + b + c);
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ff first
#define ss second
using namespace std;
typedef long long ll;

int main() {
    IO;
    string s;
    cin >> s;
    for(char x: s)
        if(x == '7'){
            cout << "Yes\n";
            return 0;
        }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
long long int ans[100010];
long long int num[100010];
long long int n,a,b;

bool check(long long t)
{
    long long cnt=0;
    for(long long int i=1;i<=n;i++)
        num[i]=ans[i];
    for(long long int i=1;i<=n;i++)
    {
        num[i]-=t*b;
    }
    long long more=a-b;
    for(long long int i=1;i<=n;i++)
    {
        if(num[i]>0)
        {
            if(num[i]%more) cnt+=(num[i]/more+1);
            else cnt+=num[i]/more;
        }
    }
    if(cnt<=t) return true;
    return false;
}

int main()
{
        scanf("%lld%lld%lld",&n,&a,&b);
        for(int i=1;i<=n;i++)
        {
            scanf("%lld",&ans[i]);
        }
        long long sum;
        long long l=1,r=1e9,mid;
        long long nn;
        while(l<=r)
        {
            mid=(l+r)/2;
            if(check(mid))
            {
                nn=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        printf("%lld\n",nn);
        return 0;
}


Measured memory_bytes: 1792
program ABC154C
    implicit none
    integer(8)::N,i
    integer(8)::flg=0
    integer(8),allocatable,dimension(:)::A
    read(5,*)N
    allocate(A(N))
    read(5,*)(A(i),i=1,N)
    A=iqsort(A)

    do i=1,N-1
        if(A(i)==A(i+1))then
            flg=1
            exit
        end if
    end do

    if(flg==0)then
        print'(A)',"YES"
    else
        print'(A)',"NO"
    end if

contains
    recursive function iqsort(ix) result(ires)
      integer(8), allocatable :: ires(:)
      integer(8), intent(in)  :: ix(:)
      integer :: k
      if (size(ix) <= 1) then 
        ires = ix
      else  
        k = ix(size(ix) / 2)
        ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
      end if
    end function iqsort
end program ABC154C

Measured memory_bytes: 8224
//
#include <atcoder/fenwicktree>
#include <atcoder/segtree>
#include <atcoder/lazysegtree>
#include <atcoder/string>
#include <atcoder/math>
#include <atcoder/convolution>
#include <atcoder/modint>
#include <atcoder/dsu>
#include <atcoder/maxflow>
#include <atcoder/mincostflow>
#include <atcoder/scc>
#include <atcoder/twosat>
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline void reverse(Type& arr) { reverse(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1000000007L;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
using P = pair<ll, ll>;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    atcoder::dsu d(N);
    rep(i, M)
    {
        ll A, B;
        cin >> A >> B;
        --A;
        --B;
        d.merge(A, B);
    }
    cout << d.groups().size() - 1;
    return 0;
}

Measured memory_bytes: 8352
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

LL x[100005], y[100005];
int n, m;
LL MOD = 1000000007;

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%lld", &x[i]);
	for (int i = 0; i < m; i++) scanf("%lld", &y[i]);
	LL xs = 0, ys = 0;
	LL sum = 0;
	for (int i = 0; i < n; i++) {
		xs += i * x[i] - sum;
		xs %= MOD;
		sum += x[i];
		sum %= MOD;
	}
	sum = 0;
	for (int i = 0; i < m; i++) {
		ys += i * y[i] - sum;
		ys %= MOD;
		sum += y[i];
		sum %= MOD;
	}
	LL ans = xs * ys;
	ans %= MOD;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1792