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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

int main() {
  int m;
  cin >> m;
  ll sum_d = 0, sum_c = 0, ans = 0, rem = 0;
  rep(i,m) {
    int d;
    ll c;
    cin >> d >> c;
    sum_d += d;
    sum_c += c;
    ll coef = ( ( d * c ) - 1LL ) / 9LL;
    ans += coef;
    rem += ( ( d * c ) - coef * 9LL );
  }
  ans += ( sum_c - 1LL );
  if( rem - 1LL >= 1 ) ans += ( ( rem - 1LL ) / 9LL );
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
using namespace std;

int main() {
	long long a, b, c;
	cin >> a >> b >> c;
	long long s[3] = { a,b,c };
	sort(s, s + 3);
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0 << endl;
	}
	else{
		cout << s[0] * s[1] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// Problem : A - Lucky 7
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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


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

    string n;
    cin >> n;
    if (n[0] == '7' || n[1] == '7' || n[2] == '7') cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    /**/

    long long x = 1000;

    for(int i = 0;i < n - 1;i++){
        int s = a[i];
        int t = a[i + 1];
        if(s < t){
            long long k = x/s;
            x = x%s;
            x += k*t;
        }
    }

    cout << x << endl;
    return 0;
}

Measured memory_bytes: 3128
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Long> aList = new ArrayList<>();
		for(int i=0; i<N; i++){
			aList.add(sc.nextLong());
		}

		sc.close();
		System.out.println(gcd(aList));

	}

	public static long gcd(long a, long b){

		// a>bにする
		if(a<b){
			a = a^b;
			b = a^b;
			a = a^b;
		}

		long r = -1;
		while (r!=0){
			r = a%b;
			a = b;
			b = r;
		}

		return a;
	}

	public static long gcd(List<Long> aList) {

		final long len = aList.size();
		long gcd = gcd(aList.get(0), aList.get(1));
		for(int i = 2; i<len; i++){
			gcd = gcd(gcd, aList.get(i));
		}
		return gcd;
	}
}


Measured memory_bytes: 62440
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, ans = 0; string s; cin >> n >> s;
    for(int i = 0; i < n - 2; i++){
        int count = 0;
        for(int x = int('a'); x <= int('z'); x++){
            bool k_f = 0, l_f = 0;
            for(int k = 0; k <= i; k++) if(s[k] == x) k_f = 1;
            for(int l = i + 1; l < n; l++) if(s[l] == x) l_f = 1;
            if(k_f & l_f) count++;
        }ans = max(ans, count);
    }cout << ans;
}


Measured memory_bytes: 256
def examA():
    S = SI(); N = len(S)
    T = "CODEFESTIVAL2016"
    ans = 0
    for i in range(N):
        if S[i]!=T[i]:
            ans +=1
    print(ans)
    return

def examB():
    N, A, B = LI()
    S = SI()
    d = defaultdict(int)
    for s in S:
        if s=="a":
            if d["a"]+d["b"]<A+B:
                print("Yes")
                d[s] += 1
            else:
                print("No")
        elif s=="b":
            if d["a"]+d["b"]<A+B and d["b"]<B:
                print("Yes")
                d[s] += 1
            else:
                print("No")
        else:
            print("No")
    return

def examC():

    return

import sys,copy,bisect,itertools,heapq,math
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,ALPHABET, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 1e-9
alphabet = [chr(ord('a') + i) for i in range(26)]
ALPHABET = [chr(ord('A') + i) for i in range(26)]

if __name__ == '__main__':
    examB()


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

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

int n, d, ans;

void solve() {
    scanf("%d", &n);
    scanf("%d %d", &d, &ans);

    for (int i = 1, x; i <= n; ++i) {
        scanf("%d", &x);

        for (int j = 1; j <= d; j += x) {
            ++ans;
        }
    }

    printf("%d\n", ans);
}

int main() {
    #ifdef BThero
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // BThero

    int tt = 1;

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<string> S(N);
  for(int i=0;i<N;i++){
  cin >> S[i]; 
  }
    
  int C0=0;
  int C1=0; 
  int C2=0;
  int C3=0; 
  
      for(int i =0;i<N;i++){
      
        if(S[i] == "AC"){
  			C0 += 1;
 		 }
  		else if(S[i] == "WA"){
  		C1 += 1;
  		}
  		else if(S[i] == "TLE"){
  		C2 += 1;
  		}
        else if(S[i] == "RE"){
  		C3 += 1;
  		}
 	 }      
  cout <<"AC x "<<C0 << endl;
  cout <<"WA x "<<C1 << endl;
  cout <<"TLE x "<<C2 << endl;
  cout <<"RE x "<<C3 << endl;
}

Measured memory_bytes: 6372
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

const int MAXN = 100+10;
char sen[MAXN];

int main(){
	int flag = 1;
	int c= 0 ;
	scanf("%s",sen);
	int n = strlen(sen);
	if(sen[0]=='A'){
		for(int i=2;i<n-1;i++){
			if(sen[i]=='C') c++;
		}
		if(c!=1)	flag = 0;
		if(flag !=0){
			for(int i=0;i<n;i++){
				if(sen[i]=='A'||sen[i]=='C')	continue;
				else{
					if(sen[i]>'z'||sen[i]<'a'){
						flag = 0;
						break;
					}
				}
			}
		}
	}else{
		flag = 0;
	}
	if(flag)	printf("AC\n");
	else	printf("WA\n");
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <algorithm>
int main(){
  int n,a,b,i,j=1,x;
  std::cin>>n;
  std::vector<int> p,q,v(n);
  for(i=0;i<n;++i){std::cin>>x;p.push_back(x);}
  for(i=0;i<n;++i){std::cin>>x;q.push_back(x);}
  std::iota(v.begin(), v.end(), 1);
  do{
    if(v==p)a=j;
    if(v==q)b=j;
    ++j;
  }
  while(std::next_permutation(v.begin(), v.end()));
  std::cout<<std::abs(a-b)<<"\n";
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	MAX_N = 10
)

var N, M int
var edges [MAX_N][]int
var dp [MAX_N][1 << MAX_N]int

func memo(pos, bit int) int {
	if bit == (1<<uint(N))-1 {
		return 1
	}
	if dp[pos][bit] >= 0 {
		return dp[pos][bit]
	}

	res := 0
	for _, nxt := range edges[pos] {
		if ((bit >> uint(nxt)) & 1) == 0 {
			res += memo(nxt, bit|1<<uint(nxt))
		}
	}
	dp[pos][bit] = res
	return res
}

func main() {
	fsc := NewFastScanner()
	N, M = fsc.NextInt(), fsc.NextInt()
	for i := 0; i < M; i++ {
		a, b := fsc.NextInt(), fsc.NextInt()
		a--
		b--
		edges[a] = append(edges[a], b)
		edges[b] = append(edges[b], a)
	}
	for i := 0; i < N; i++ {
		for j := 0; j < len(dp[i]); j++ {
			dp[i][j] = -1
		}
	}
	fmt.Println(memo(0, 1))
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}


Measured memory_bytes: 768
#include <stdio.h>
#define H 500000

int A[H],h;

void swap(int *a,int *b){
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

void maxHeapify(int i){
  int l,r,largest;
  l = 2*i;
  r = 2*i + 1;
  if(l <= h && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= h && A[r] > A[largest]) largest = r;

  if (largest != i) {
    swap(&A[i],&A[largest]);
    maxHeapify(largest);
  }
}

int main() {
  int i;
  scanf("%d",&h);
  for (i = 1; i <= h; i++) {
    scanf("%d",&A[i]);
  }
  for (i = h/2; i >= 1; i--) {
    maxHeapify(i);
  }
  for (i = 1; i <= h; i++) {
    printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 4628
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long LL;
const int inf=0x3f3f3f3f;
const int MAX=1e5+100;
LL maxv[MAX][2],f[MAX][2];
int n;
LL m;
struct sushi
{
    LL val,pos;
}ar[MAX];
void init()
{
    f[0][0]=maxv[0][0]=(LL)0;
    f[n+1][1]=maxv[n+1][1]=(LL)0;
}
void calmax()
{
    ar[0].pos=(LL)0;ar[n+1].pos=m;
    for(int i=1;i<=n;i++)
    {
        f[i][0]=f[i-1][0]-(ar[i].pos-ar[i-1].pos)+ar[i].val;
        maxv[i][0]=max(maxv[i-1][0],f[i][0]);
    }
    for(int i=n;i>=1;i--)
    {
        f[i][1]=f[i+1][1]-(ar[i+1].pos-ar[i].pos)+ar[i].val;
        maxv[i][1]=max(maxv[i+1][1],f[i][1]);
    }
}
int main()
{
    cin>>n>>m;
    init();
    for(int i=1;i<=n;i++)cin>>ar[i].pos>>ar[i].val;
    calmax();
    //for(int i=1;i<=n;i++)cout<<maxv[i][0]<<" ";cout<<endl;
    //for(int i=n;i>=1;i--)cout<<maxv[i][1]<<" ";cout<<endl;
    LL ans=0;
    for(int i=0;i<=n;i++)
    {
        ans=max(ans,maxv[i][0]+maxv[i+1][1]-min(ar[i].pos,m-ar[i+1].pos));
    }
    cout<<ans<<endl;
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 4992
import math
A,B,H,M=input().split()

A=int(A)
B=int(B)
H=int(H)
M=int(M)

kakudo_H = H*30 +M*0.5
kakudo_M = M*6
if M==0:
    kakudo_M=360

kakudo_sa=abs(kakudo_H-kakudo_M)
# cはまずは2条している値としてセット
c=A**2 +B**2-2*A*B*(math.cos(math.radians(kakudo_sa)))
C=c**0.5
print(C)

Measured memory_bytes: 9508
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };

	static class TaskX {
		@SuppressWarnings("unchecked")
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int v = in.nextInt(), e = in.nextInt();
			List<Integer>[] g = new ArrayList[v];
			g = Stream.generate(ArrayList::new).limit(v).toArray(List[]::new);
			int[] count = new int[v];

			for (int i = 0; i < e; i++) {
				int s = in.nextInt(), t = in.nextInt();
				g[s].add(t);
				count[t]++;
			}

			Queue<Integer> q = new ArrayDeque<>();
			List<Integer> topologicalSortList = new ArrayList<>();
			for (int i = 0; i < v; i++) {
				if (count[i] == 0) {
					q.add(i);
					topologicalSortList.add(i);
				}
			}

			while (!q.isEmpty()) {
				int from = q.remove();
				for (int i = 0; i < g[from].size(); i++) {
					int to = g[from].get(i);
					count[to]--;
					if (count[to] == 0) {
						q.add(to);
						topologicalSortList.add(to);
					}
				}
			}

			for (Integer num : topologicalSortList) {
				out.println(num);
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}



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

using namespace std;

int main()
{
  uint64_t N;
  int64_t T, A;
  cin >> N >> T >> A;
  
  vector<int64_t> H(N);
  for (uint64_t n = 0; n < N; ++n) {
    cin >> H[n];
  }
  
  long double min = INT64_MAX;
  uint64_t min_n = 0;
  
  for (int64_t n = 0; n < N; ++n) {
    long double t = static_cast<long double>(T) - static_cast<long double>(H[n]) * 0.006;
    
    if (abs(t - A) < min) {
      min = abs(t - A);
      min_n = n + 1;
    }
  }
  
  cout << min_n << endl;
  
  return 0;
}

Measured memory_bytes: 256
// finish date: 2018/02/23

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    ll K;
    cin >> K;
    vl A(K);
    rep(i, K) cin >> A[i];

    reverse(A.begin(), A.end());
    if (A[0] != 2) {
        cout << -1 << endl;
        return 0;
    }
    ll mi = 2, ma = 3;
    FOR(i, 1, K) {
        if (ma / A[i] - (mi - 1) / A[i] == 0) {
            cout << -1 << endl;
            return 0;
        } else {
            mi = (ll) A[i] * ((mi + A[i] - 1) / A[i]);
            ma = (ll) A[i] * (ma / A[i] + 1) - 1;
        }
    }
    cout << mi << " " << ma << endl;


    return 0;
}





Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main () {
    
    long long int n;
    scanf("%lld", &n);
    
    for (long long int i = pow(n, 0.5); i >= 1; i--) {
        if (n % i == 0) {
            int result = 0;
            i = n / i;
            while (i > 0) {
                i /= 10;
                result++;
            }
            printf("%d", result);
            return 0;
        }
    }
    
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define x first
#define y second
#define int int long long // 2e9 & 9e18
using namespace std; const int inf = numeric_limits<int>::max();
struct __io{__io(){ios_base::Init i; ios_base::sync_with_stdio(0); cin.tie(0);}} __io; // fast I/O
#ifdef LOCAL // setting up print debugging (yes lol)
template<class K, class V>ostream& operator<<(ostream&s,const pair<K,V>&p){s<<'<'<<p.x<<", "<<p.y<<'>';return s;}
template<class T, class=typename T::value_type, class=typename enable_if<!is_same<T,string>::value>::type>
ostream& operator<<(ostream&s,const T&v){s<<'[';for(auto&x:v){s<<x<<", ";}if(!v.empty()){s<<"\b\b";}s<<']';return s;}
void __prnt(){cerr<<endl;} template<class T, class...Ts>void __prnt(T&&a,Ts&&...etc){cerr<<a<<' ';__prnt(etc...);}
#define print(...) __prnt(__VA_ARGS__)
#else
#define print(...)
#endif

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int boss;
    for (int i = 0; i < n-1; ++i) {
        cin >> boss;
        a[boss-1]++;
    }
    for (int x : a) {
        cout << x << '\n';
    }
}


Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,sum=0; cin>>N;
  vector<ll>A(N,1);
  stack<ll>S;
  for(int i=2; i<=N; i++){
    A[i-1]=A[i-2]+i;
  }
  while(sum!=N){
    if(sum<N){
      auto IT=lower_bound(A.begin(), A.end(), N-sum);
      ll z=IT-A.begin();
      sum+=A[z];
      for(int i=z+1; i>0; i--){
        S.push(i);
      }
    }
    else{
      auto IT=lower_bound(A.begin(), A.end(), sum-N);
      ll z=IT-A.begin();
      sum-=A[z];
      for(int i=z+1; i>0; i--){
        S.pop();        
      }
    }
  }
  while(!S.empty()){
    cout<<S.top()<<endl;
    S.pop();
  }
}

Measured memory_bytes: 78464
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		
		if(a < b && b < c) {
			
			System.out.println("Yes");
		}
		else {
			
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 26116
import java.util.Scanner;

class Main
{
	public static void main(String[] args)
	{
	Scanner sc1 = new Scanner(System.in);
	int S = sc1.nextInt();
	int h = S / 3600;
	int m = (S-h*3600) / 60;
	int s = S % 60;
	System.out.println(h+":"+m+":"+s);
	}
}



Measured memory_bytes: 26304
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();
            if (h == 0 && w == 0) {
                break;
            }
            boolean[][] field = new boolean[h][w];
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    field[i][j] = (sc.nextInt() == 1);
                }
            }
            int max = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (field[i][j]) {
                        max = Math.max(max, getCount(i, j, field));
                    }
                }
            }
            sb.append(max).append("\n");
        }
        System.out.print(sb);
    }
    
    static int getCount(int h, int w, boolean[][] field) {
        if (h < 0 || h >= field.length || w < 0 || w >= field[0].length || !field[h][w]) {
            return 0;
        }
        int max = 0;
        field[h][w] = false;
        max = Math.max(max, getCount(h - 1, w, field));
        max = Math.max(max, getCount(h + 1, w, field));
        max = Math.max(max, getCount(h, w - 1, field));
        max = Math.max(max, getCount(h, w + 1, field));
        field[h][w] = true;
        return max + 1;
    }
}



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

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

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

    ll n;
    cin>>n;
    ll nor=0,cham=0;
    vector<ll> v(n);
    cinv(v,0,n);
    vector<ll> f(8);
    FOR(j,0,n){
      FOR(i,0,8){
        if(400*i <= v[j] && v[j] < 400*(i+1)){
          f[i]++;
        }
      }
    }
    ll sum=0;
    FOR(i,0,8){
      sum+=f[i];
      if(f[i]>0){
        nor++;
      }
    }
    cham=n-sum;

    if(nor==0){
      nor++;
      cham--;
    }
    cout<<nor<<" "<<nor+cham<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double  ld;
#define pii pair<ll,ll> 
#define pic pair<ll,char>
#define vi vector< ll > 
#define vvi vector< vi > 
#define vpi vector< pii > 
#define vvpi vector< vpi > 
#define st  set <ll, greater <ll> >
#define mst  multiset <ll, greater <ll> >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mapp  unordered_map <ll, ll>
#define ppii pair< pii, pii > 
#define test(t) ll t;cin>>t;while(t--)
#define inarr(n) ll arr[n];for(ll i=0;i<n;i++)cin>>arr[i];
#define ingra(m) vvi arr(100005);for(ll i=0;i<m;i++){ll u,v;cin>>u>>v;arr[u].pb(v);arr[v].pb(u);}
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
vvi arr(100001);
vi topo;
ll visited[100001];
void dfs(ll u)
{
    ll i;
    visited[u] = 1;
    for(i=0;i<arr[u].size();i++)
    {
        if(visited[arr[u][i]]==0)
            dfs(arr[u][i]);
    }
    topo.pb(u);
}
signed main()
{
    fast;
    ll n,m;
    cin>>n>>m;
    ll i;
    for(i=0;i<m;i++)
    {
        ll u,v;
        cin>>u>>v;
        arr[u].pb(v);
    }
    for(i=1;i<=n;i++)
    {
        if(visited[i]==0)
            dfs(i);
    }
    reverse(all(topo));
    ll dp[n+1];
    for(i=0;i<=n;i++)
        dp[i] = 0;
    for(i=0;i<n;i++)
    {
        ll u = topo[i];
        ll j;
        for(j=0;j<arr[u].size();j++)
            dp[arr[u][j]] = max(dp[arr[u][j]],dp[u]+1);
    }
    cout<<*max_element(dp+1,dp+n+1);
}

Measured memory_bytes: 9080
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
const ll MAXN=1e5+51;
map<string,ll>mp;
set<string>st;
set<string>::iterator it;
ll cnt,res;
string str;
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
} 
int main()
{
	cnt=read();
	for(register int i=0;i<cnt;i++)
	{
		cin>>str,mp[str]++,st.insert(str);
	}
	for(it=st.begin();it!=st.end();++it)
	{
		res=max(res,mp[*it]);
	}
	for(it=st.begin();it!=st.end();++it)
	{
		if(mp[*it]==res)
		{
			cout<<*it<<endl;
		}
	}
}

Measured memory_bytes: 34560
n, m, a, b = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_i)
keep, drop = [], []
k = false
arr.each{|x|
    k = true if x < a
    if k
        keep << x
    else
        drop << x
    end
}
if keep.length < m
    while !drop.empty? && drop.last <= b
        drop.pop
    end
end
puts drop.length


Measured memory_bytes: 8872
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    std::cin >> a >>b;
    int cnt=0;
    for (int i = a; i <= b; i++) {
        int t=i%100;
        t=t/10+t%10*10;
        if(i/1000==t){
            cnt++;
        }
    }
    std::cout << cnt << std::endl;
}
    


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		
		if(str.equals("AAA") || str.equals("BBB")){
		    System.out.println("No");
		}else{
		    System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 35820
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 11;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

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

	int v = (N - M) * 100 + M * 1900;
	return !printf("%d\n", v << M);
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include<bitset>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

struct Wifi{
  int pos;
  int range;
  Wifi(int a,int b){
    pos=a;
    range=b;
  }
  bool operator>(const Wifi& a)const {
    return pos>a.pos;
  }
  bool operator<(const Wifi& a)const{
    return pos<a.pos;
  }
};

bool Solve(const std::vector<Wifi>& wifi,int size){
  int imos[100005]={};
  int cum[100005]={};
  for(auto tgt:wifi){
    imos[std::max(0,tgt.pos-tgt.range)]++;
    imos[std::min(100004,tgt.pos+tgt.range)]--;

  }
  cum[0]=imos[0];
  for(int i=1;i<=size;i++){
    cum[i]=cum[i-1]+imos[i];
  }
  for(int i=0;i<=size-1;i++){
    if(cum[i]<=0){
      return false;
    }
  }
  return true;


}



int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n,w,h;
  cin>>n>>w>>h;

  std::vector<Wifi> vertical_wifi,horizontal_wifi;
  for(int i=0;i<n;i++){
    int x,y,r;
    cin>>x>>y>>r;
    vertical_wifi.push_back(Wifi(x,r));
    horizontal_wifi.push_back(Wifi(y,r));

  }

  std::sort(vertical_wifi.begin(),vertical_wifi.end());
  std::sort(horizontal_wifi.begin(),horizontal_wifi.end());

  if(Solve(horizontal_wifi,h)||Solve(vertical_wifi,w)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }



  return 0;
}



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


int main() {
  int H,N;
  cin >> H>>N;
 
 
  vector<int> a(N),b(N);
  rep(i,N) {
    cin >> a.at(i)>>b.at(i);
  }
  int ans=0;
  vector<int> dp(H+1,100000000);
  dp.at(0)=0;
  rep(i,N){
    rep(j,H){
      int ni=min(H,j+a.at(i));
      dp.at(ni)=min(dp.at(ni),dp.at(j)+b.at(i));
    }
  }
   
    
  cout<<dp.at(H)<<endl;

}



Measured memory_bytes: 256
#include<iostream>

int main()
{
    int a, b, c;
    std::cin>>a>>b>>c;

    if((a<0 || 100<a) || (b<0 || 100<b) || (c<0 || 100<c))
    {
        std::cout<<"Wrong Number!\a"<<std::endl;
        return 1;
    }
    if (a<b & b<c) {
        std::cout<<"Yes"<<std::endl;
    }else
    {
        std::cout<<"No"<<std::endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
#define N_MAX 20

int v[N_MAX];
int c[N_MAX];

int main(void){
  int n;
  scanf("%d", &n);
  for(int i = 0; i < n; i ++) scanf("%d", &v[i]);
  for(int i = 0; i < n; i ++) scanf("%d", &c[i]);
  
  int result = 0;
  for(int i = 0; i < n; i ++){
    if (v[i]-c[i] > 0) result += v[i]-c[i];
  }
  printf("%d", result);
  return 0;
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const double eps = 1e-9;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

signed main() {
  int n = in();
  cout << (n % 10 == n / 100 ? "Yes" : "No") << endl;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;
using tTree = __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

#define FACSIZE 200002

ll invfac[FACSIZE];
ll fac[FACSIZE];

template <class T>
bool chmax(T &, const T &);
template <class T>
bool chmin(T &, const T &);
ll gcd(ll, ll);
ll powLL(ll x, ll y);

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
ll comb(ll, ll);
void make_fact(ll);
void make_invfact(ll);
void fact_init();

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

  cout << (6 - a - b) << endl;

  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return mod_mul(t, t);
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = mod_mul(t, t);
    return (k % mod) * (x % mod);
  }
}
ll mod_add(ll a, ll b)
{
  return ((a % mod) + (b % mod)) % mod;
}

ll mod_mul(ll a, ll b)
{
  return ((a % mod) * (b % mod)) % mod;
}

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void fact_init()
{
  make_fact(FACSIZE - 1);
  make_invfact(FACSIZE);
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}

ll comb(ll n, ll r)
{

  return mod_mul(mod_mul(fac[n], invfac[r]), invfac[n - r]);
}
template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (b < a)
  {
    a = b;
    return 1;
  }
  return 0;
}

ll qp(ll a, ll b)
{
  ll ans = 1LL;
  do
  {
    if (b & 1LL)
      ans = 1LL * mod_mul(ans, a) % mod;
    a = 1LL * mod_mul(a, a) % mod;
  } while (b >>= 1LL);
  return ans;
}
ll qp(ll a, ll b, ll mo)
{
  ll ans = 1LL;
  do
  {
    if (b & 1LL)
      ans = 1LL * (ans % mo) * (a % mo);
    a = 1LL * (a % mo) * (a % mo);
  } while (b >>= 1LL);
  return ans;
}
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}
ll powLL(ll x, ll y)
{
  ll ans = 1LL;
  for (ll i = 0LL; i < y; i++)
    ans *= x;
  return ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define mk make_pair
#define pb push_back
#define pf push_front
typedef pair<int, int> pii;
#define INF (1 << 30)
#define INFL (1ll << 60ll);
#define mod 1000000007
#define se second
#define fi first

int N;
int par[200200], nxt[200200];
int dp[200200];

int dfs(int pos)
{
    if(~dp[pos]){
        return dp[pos];
    }
    if(pos == N - 1){
        return dp[pos] = 1ll;
    }
    int res = 0;
    if(~nxt[pos]){
        res += dfs(nxt[pos]);
        res %= mod;
    }
    res += dfs(pos + 1);
    res %= mod;
    return dp[pos] = res;

}

signed main()
{
    cin >> N;
    vector<int> C(N);
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }
    C.erase(unique(C.begin(), C.end()), C.end());
    N = C.size();
    memset(par, -1ll, sizeof(par));
    memset(dp, -1ll, sizeof(dp));
    for(int i = N - 1; i >= 0; i--){
        nxt[i] = par[C[i]];
        par[C[i]] = i;
    }
    /*for(int i = 0; i < N; i++){
        printf("%lld %lld\n", i, nxt[i]);
    }*/
    int ans = dfs(0);
    cout << ans % mod << endl;


    return 0;
}

/*


7
4
2
5
4
2
4
4

*/


Measured memory_bytes: 12800
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(int i=a;i<b;i++)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
 
int main() {
  ll a;
  ci(a);
  vec b(a);
  for(i,0,a)
    ci(b[i]);
  ll c;
  for(i,0,a)
    c=gcd(c,b[i]);
  ll d=0;
  for(i,0,pow(10,9)){
    if(c%2==0){
      d++;
      c=c/2;
    }
    else
      break;
  }
  co(d);
}

Measured memory_bytes: 768
#include <stdio.h>

#define A 1000010

int mp[A];
int nxt[A];
int prs[A];
char ex[A];

int gcd(int x, int y){
	while(y){
		int r = x % y;
		x = y;
		y = r;
	}
	return x;
}

int main(void){
	int k = 0;
	for(int i = 2; i < A; ++i){
		if(!mp[i]){
			mp[i] = i;
			prs[k++] = i;
		}
		int m = mp[i];
		int r = nxt[i];
		for(int j = 0; j < k; ++j){
			int t = prs[j];
			int u = i * t;
			if(t > m || u >= A){ break; }
			mp[u] = t;
			nxt[u] = t == m ? r : i;
		}
	}

	int n;
	scanf("%d", &n);
	int d = 0;
	int pc = 1;
	for(int i = 0; i < n; ++i){
		int x;
		scanf("%d", &x);
		d = gcd(x, d);
		if(pc){
			while(x > 1){
				pc &= !ex[mp[x]];
				ex[mp[x]] = 1;
				x = nxt[x];
			}
		}
	}
	if(pc){ puts("pairwise coprime"); }
	else if(d == 1){ puts("setwise coprime"); }
	else{ puts("not coprime"); }
}


Measured memory_bytes: 10716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {

    int a, b;
    cin >> a >> b;

    if (a >= 13) {
        cout << b;
    } else if (a >= 6) {
        cout << b / 2;
    } else {
        cout << 0;
    }

    return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N, D;
    cin >> N >> D;
    int c = 0;
    for(;0 < N;) {
        N -= 2*D + 1;
        c++;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        w: usize,
        a: usize,
        b: usize,
    }

    if b>=a {
        println!("{}", max(0, b as i64 - (a+w) as i64));
    } else {
        println!("{}", max(0, a as i64 - (b+w) as i64));
    }

}


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

#define za ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod %1000000007
#define moz 1000000007
#define nl "\n"
#define S second
#define F first
#define PB push_back
#define MP make_pair
#define V vector
#define P pair
#define LEN length()
#define SZ size()
#define loop(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
typedef complex<ll> C;
#define X real()
#define Y imag()

int n,a,b,c;

int main()
{
    za;
    int a,b,c ;
    cin >> a >> b >> c;
    if((abs(a-b)>abs(a-c))) cout << 'B' << nl;
    else cout << 'A' << nl;
}


Measured memory_bytes: 256
from bisect import bisect_left
X, N = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort()
S = set(P)

if N == 0:
    print(X)
    exit()


def bisectsearch_left(L, a):
    i = bisect_left(L, a)
    return(i)


k = bisectsearch_left(P, X)
if X != P[k]:
    print(X)
else:
    ct = 0
    while True:
        ct += 1
        if X-ct not in S:
            print(X-ct)
            break
        elif X+ct not in S:
            print(X+ct)
            break

Measured memory_bytes: 62140
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int m = S.indexOf("C");
		int n = S.lastIndexOf("F");
		if (m<0 || n<0 || m>n) System.out.println("No");
		else System.out.println("Yes"); 
		sc.close();
	}

}


Measured memory_bytes: 10068
#include<iostream>
using namespace std;
 
int main(){
	long long ans,n, k,a,b,sum,A[100002];
	cin >> n >> k;
 
	for (int i = 0; i < 100002; i++) {
		A[i] = 0;
	}
 
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		A[a] += b;
	}
 
	sum = 0;
	ans = 1;
 
	while (sum < k) {
		sum += A[ans];
		ans++;
	}
	cout << ans - 1 << endl;
 
}

Measured memory_bytes: 1152
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
    ll k,n,i,j,cc=0;
    cin>>k>>n;
    ll ara[n];
    for(i=0;i<n;i++)cin>>ara[i];
    ll mx=-1;
//    if(ara[0]==0){
//        ara[0]=k;
//    }
    vector<ll>s;
    for(i=1;i<n;i++){
        s.push_back(ara[i]-ara[i-1]);
    }
    ll x;
    x=ara[0];
    ll y=k-ara[n-1];
    s.push_back(x+y);
    //for(auto it : s)cout<<it<<spc;
    sort(s.begin(),s.end(),greater<ll>());
    for(i=1;i<s.size();i++)cc+=s[i];
    cout<<cc<<endl;

return 0;
}


Measured memory_bytes: 8692
from collections import Counter
n=int(input())
v=list(map(int, input().split()))

even=Counter(v[0::2]).most_common()     #num,count
odd=Counter(v[1::2]).most_common()

i=0
while i<len(even):
    e=even[i]
    o=odd[i]
    if e[0]!=o[0]:
        if e[1]>=o[1]:
            ans=n-e[1]-odd[0][1]
            break
        else:
            ans=n-o[1]-even[0][1]
            break
    i+=1
else:
    ans=n-even[0][1] if len(even)==1 else n-even[0][1]-odd[1][1]
print(ans)

Measured memory_bytes: 20700
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll a[100000+10];
ll ans[100000+10];

int main(){
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> a[i];
}
ans[0]=0;
ans[1] = abs(a[1]-a[0]);
for(int i=2; i<n; i++){
    ans[i] = min(ans[i-1] + abs(a[i]-a[i-1]) ,abs(a[i]-a[i-2])+ans[i-2]);
}
cout << ans[n-1];
return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;
int main(){
  int n;
  cin>>n;
  long long int dp[100010];
  for(int i=0;i<100010;i++){
    dp[i]=9000000000000000;
  }
  int h[n];
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  dp[0]=0;
  for(int i=0;i<n;i++){
    mins(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
    mins(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
  }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main()
{
	long long a,b,c,d,s,ss,k=0;
	cin>>a>>b>>c>>d;
	if ((a<=0 && 0<=b) || (c<=0 && 0<=d))k=1;
	s=max(a*c,a*d);
	ss=max(b*c,b*d);
	s=max(s,ss);
	if (k==1 && s<0)s=0;
	cout<<s;
}
	
	

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();

		int maxX = x;
		int minY = y;
		for(int i = 0 ; i < n ; i++) {
			int x2 = sc.nextInt();
			maxX = Math.max(maxX, x2);
		}
		for(int i = 0 ; i < m ; i++) {
			int y2 = sc.nextInt();
			minY = Math.min(minY, y2);
		}

		sc.close();
		System.out.println(maxX < minY ? "No War" : "War");

	}
}



Measured memory_bytes: 35992
#include <stdio.h>

int main(void) {
	int n,r,s,i,a[32];
	while(scanf("%d",&n) , n != 0){
		s = 0;
		for(i = 0;i < n;i++){scanf("%d",&a[i]);}
		printf("31\n");
		r = 31;
		while(1){
			s%=n;
			r-=(a[s]);
			printf("%d\n",r);
			r-=(5-a[s]);
			printf("%d\n",r);
			if(r == 1){break;}
			s++;
		}
		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 612
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long k = sc.nextLong();
    long[] array = new long[100001];
    for(int i = 0; i < n; i++){
      int a = sc.nextInt();
      int b = sc.nextInt();
      array[a] += b;
    }
    long sum = 0;
    for(int i = 1; i <= 100000; i++){
      sum += array[i];
      if(sum >= k){
        System.out.println(i);
        break;
      }
    }
  }
}

Measured memory_bytes: 64840
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <deque>

template<class T>
using Edge = std::pair<T, T>;
template<class T>
using Graph = std::vector<std::vector<Edge<T> > >;

template<class T>
std::vector<T> BellmanFord(Graph<T> &graph, const T &start, const T &end){
    const T V = graph.size();
    const T distanceSup = std::numeric_limits<T>::max();
    const T distanceInf = std::numeric_limits<T>::min();
    const T zero = static_cast<T>(0);

    std::vector<T> distance(V, distanceSup);
    distance[start] = zero;

    std::deque<T> queue;
    std::vector<bool> isInQueue(V,false);
    std::vector<T> count(V,zero);
    queue.emplace_back(start);
    isInQueue[start] = true;
    ++count[start];
    T distanceTmp;
    T pred, suc;
    while(!queue.empty() && distance[end]>distanceInf){
        pred = queue.front();
        queue.pop_front();
        isInQueue[pred] = false;
        for(auto &edge : graph[pred]){
            suc = edge.first;
            distanceTmp = distance[pred] > distanceInf ? distance[pred] + edge.second : distanceInf;
            if(distance[suc] > distanceTmp){
                distance[suc] = distanceTmp;
                if(!isInQueue[suc]){
                    queue.emplace_back(suc);
                    isInQueue[suc] = true;
                    if(distance[queue.back()] < distance[queue.front()]){
                        queue.emplace_front(queue.back());
                        queue.pop_back();
                    }
                    if(++count[suc] >= V){
                        distance[suc] = distanceInf;
                    }
                }
            }
        }
    }

    return distance;
}

int main(int argc, char *argv[]){
    int N,M, P;
    std::cin >> N >> M >> P;
    int A, B;
    int C;
    Graph<int> graph(N);
    for(int i=0; i<M; ++i){
        std::cin >> A >> B >> C;
        --A; --B;
        graph[A].emplace_back(B, P-C);
    }
    auto distance = BellmanFord(graph,0, N-1);
    int score = distance[N-1];
    if(score <= std::numeric_limits<int>::min()){
        score = -1;
    }else if(score >= 0){
        score = 0;
    }else{
        score = -score;
    }
    std::cout << score << std::endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, m;
    cin >> n;
    vector<int> t(n);
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
    }
    cin >> m;
    vector<int> p(m), x(m);
    for (int i = 0; i < m; ++i) {
        cin >> p[i] >> x[i];
        --p[i];
    }
    for (int i = 0; i < m; ++i) {
        vector<int> tmp = t;
        tmp[p[i]] = x[i];
        int ans = 0;
        for (auto n : tmp) ans += n;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256