akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int i, n, ct=0;
  string s, t;
  cin >> s >> t;
  n = s.length();
  for(i=0; i<n; i++)
    if(s[i]!=t[i])
      ct++;
  cout << ct;
  return 0;
  
}

Measured memory_bytes: 3916
//Krunal_Mathukiya
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define li long int
#define pb push_back
#define mkp make_pair
#define nikalL return
#define chalavo continue
#define basHo break
#define umap unordered_map
#define fr(i,s,n) for(int i=s;i<=n;++i)
#define frr(i,s,n) for(int i=s;i>=n;--i)
#define jaldiKarNe ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
int ns,nt;
void TestingChaluKarEyy(){
	string s,t;
	cin>>s;
	cin>>t;
	 ns=s.size();
	 nt=t.size();
	 int dp[ns+1][nt+1];
	 fr(i,0,ns) fr(j,0,nt) dp[i][j]=0;
	 fr(i,1,ns) {
	 	fr(j,1,nt) {
	 		dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
	 		if(s[i-1]==t[j-1]) {
	 			dp[i][j]=max(dp[i][j],1+dp[i-1][j-1]);
	 			continue;
	 		}
	 	}
	 }
	int i=ns,j=nt;
	string ans="";
	while(i&&j) {
		if(dp[i][j]==(dp[i-1][j-1]+1) && s[i-1]==t[j-1]) {
			ans+=s[i-1];
			--i;
			--j;
		}
		else if(dp[i-1][j]==dp[i][j]) --i;
		else if(dp[i][j-1]==dp[i][j]) --j;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans;
}
int main(){
//	#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//	#endif
	// jaldiKarNe;
	int TestingKaravvuChhe=1;
	// cin>>TestingKaravvuChhe;
	while(TestingKaravvuChhe--){
		TestingChaluKarEyy();
	}
}

Measured memory_bytes: 38772
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    a,b,c = LI()
    if c >= a and c <= b:
        return 'Yes'
    return 'No'

print(main())


Measured memory_bytes: 7876
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N, K;
	cin >> N >> K;
	int l[60];
	for (int i = 0; i < N; i++) cin >> l[i];
	sort(l, l + N,greater<int>());
	int ans = 0;
	for (int i = 0; i < K; i++) ans += l[i];
	cout << ans << endl;
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int p, q, r; cin >> p >> q >> r;
  cout << p + q + r - max(p, max(q, r)) << endl;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

int main(){
    int n;
    cin>>n;
    Vi a(n);
    REP(i,n) cin>>a[i];
    
    REP(i,n){
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0){
                cout<<"DENIED"<<endl;
                return 0;
            }
        }
    }

    cout<<"APPROVED"<<endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;

class Program
{
    static void Main(string[] args)
    {
        var n = Console.ReadLine().Split(' ');
        var k = int.Parse(n[0]);
        var x = int.Parse(n[1]);

        var ret = new ArrayList();
        for (var i = x - k + 1; i <= x + k - 1; i++)
        {
            ret.Add(i);
        }

        Console.Write(string.Join(" ", ret.ToArray()));
    }
}



Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define int long long
using namespace std;

double cal(int a){
  int b=a,c=0;
  while(b)c+=b%10,b/=10;
  return 1.0*a/c;
}

signed main(){
  int k;
  cin>>k;
  int a=1,b=1;
  for(int i=0;i<k;i++){
    if(cal(a)>cal(a+b))a-=b,b*=10,i--;
    else cout<<a<<endl;
    a+=b;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000000 //1E+9
using namespace std;

int main(){
	int n,m,c;cin>>n>>m>>c;
	int b[m];for(int i=0;i<m;i++)cin>>b[i];
	int a[n][m];for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>a[i][j];

	int ans=0, buf;

	for(int i=0;i<n;i++){
		buf=0;
		for(int j=0;j<m;j++){
			buf+=a[i][j]*b[j];
		}
		buf+=c;
		if(buf>0) ans++;
	}

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

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
 
  int num,i,j,k,v;
  int A[1000];
 
 
  scanf("%d",&num);
 
  for(i=0;i<num;i++){
    scanf("%d",&A[i]);
  }
 
    for(i=0;i<num-1;i++){
      printf("%d ",A[i]);
    }
    printf("%d\n",A[i]);
 
  for(i = 1 ; i <= num-1 ; i++){
    v=A[i];
    j=i-1;
 
    while(j>=0 && A[j]>v){
 
      A[j+1]=A[j];
      j--;
    }
      A[j+1]=v;
     
 
    for(k=0;k<num-1;k++){
      printf("%d ",A[k]);
    }
    printf("%d\n",A[k]);
     
  }
  return 0;
}

Measured memory_bytes: 604
#include<stdio.h>
int main(){
  int W,H,C;
  int a,b,temp;
  int yakusuu,kukaku,result;

  scanf("%d%d%d",&W,&H,&C);
  
  if(W<H){
    a=H; b=W;
  }
  else{
    a=W; b=H;
  }
  

  while(1){
    if(a%b==0){
      yakusuu=b;
      kukaku=(W*H)/(yakusuu*yakusuu);
      result=kukaku*C;
      printf("%d\n",result);
      break;
    }

    temp=a%b;
    a=b;
    b=temp;
  }
  return 0;
}
    

Measured memory_bytes: 596
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    string s[100];
    bool ans = true;
    set<string> st;
    imfor(i, n) {
        cin >> s[i];
        if (st.find(s[i]) == st.end()) {
            st.insert(s[i]);
        }
        else {
            ans = false;
        }
    }
    for (int i = 1; i < n; i++) {
        if (s[i - 1][s[i - 1].size() - 1] != s[i][0]) {
            ans = false;
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    for(int i=0;k>i;++i){
        if(a>0){
            ++ans;
            --a;
        }
        else if(b>0){
            --b;
        }
        else if(c>0)
        --ans;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
var
        n,m,i,j:longint;
        g:array[0..101,0..101]of char;
        f:array[0..101,0..101]of longint;
begin
        readln(n,m);
        for i:=1 to n do
        begin
                for j:=1 to m do
                read(g[i,j]);
                readln;
        end;
        for i:=1 to n do
        for j:=1 to m do
        if g[i,j]<>'#' then
        begin
                if g[i-1,j-1]='#' then inc(f[i,j]);
                if g[i-1,j]='#' then inc(f[i,j]);
                if g[i-1,j+1]='#' then inc(f[i,j]);
                if g[i,j-1]='#' then inc(f[i,j]);
                if g[i,j+1]='#' then inc(f[i,j]);
                if g[i+1,j-1]='#' then inc(f[i,j]);
                if g[i+1,j]='#' then inc(f[i,j]);
                if g[i+1,j+1]='#' then inc(f[i,j]);
        end;
        for i:=1 to n do
        begin
                for j:=1 to m do
                if g[i,j]<>'#' then write(f[i,j])
                else write('#');
                writeln;
        end;
end.



Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

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

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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(0);

  int n, x;
  cin >> n >> x;
  vector<int> L(n);
  rep(i, n) cin >> L[i];

  int ans = 0, dist = 0;
  rep(i, n + 1) {
    if (dist <= x) {
      ans++;
    }
    dist += L[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
 
int main() {
	int n,a,b,c1=0,c2=0;
	string s;
	cin>>n>>a>>b>>s;
	REP(i,s.size()){
		if(s[i]=='a'){
			if(c1+c2<a+b){
				cout<<"Yes";
				c1++;
			}else{
				cout<<"No";
			}
		}else if(s[i]=='b'){
			if(c1+c2<a+b&&c2<b){
				cout<<"Yes";
				c2++;
			}else{
				cout<<"No";
			}
		}else{
			cout<<"No";
		}
		cout<<endl;
	}
				
}

Measured memory_bytes: 896
import numpy as np
N = int(input())
lis = np.zeros((101,101))
s = list()
for k in range(N):
    tmp = list()
    x,y,h = map(int,input().split())
    if h == 0:
        continue
    if s:
        if len(s) == 1:
            break
        for i in s:
            if i[2] == h+abs(i[0]-x)+abs(i[1]-y):
                tmp.append(i)
        s = tmp
    else:
        for i in range(101):
            for j in range(101):
                if lis[i][j] == 0:
                    lis[i][j] = h+abs(i-x)+abs(j-y)
                elif lis[i][j] == h+abs(i-x)+abs(j-y):
                    s.append([i,j,lis[i][j]])
else:
    for i in range(101):
        for j in range(101):
            if lis[i][j] == 1:
                s.append([i,j,lis[i][j]])
print(s[0][0], s[0][1], int(s[0][2]))


Measured memory_bytes: 21532
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sz(a) (int)a.size()
#define mp(a, b) make_pair(a, b)
#define all(a) a.begin(), a.end()


#ifdef LOCAL
#define pv(a) cout << #a << " = " << a << '\n';
#else
#define pv(a) ;
#endif



using namespace std;
typedef long long ll;

const int MAXN = 100500;
string s;


bool check()
{
  int ptr = s.size();
  while (ptr)
  {
    if (ptr - 5 >= 0 && s.substr(ptr - 5, 5) == "erase")
    {
      ptr -= 5;
      continue;
    }
    if (ptr - 5 >= 0 && s.substr(ptr - 5, 5) == "dream")
    {
      ptr -= 5;
      continue;
    }
    if (ptr - 6 >= 0 && s.substr(ptr - 6, 6) == "eraser")
    {
      ptr -= 6;
      continue;
    }
    if (ptr - 7 >= 0 && s.substr(ptr - 7, 7) == "dreamer")
    {
      ptr -= 7;
      continue;
    }
    return false;
  }
  return true;
}

int main()
{
  cin >> s;

  cout << (check() ? "YES" : "NO");

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> w(n);
    int sum = 0;
    rep(i, 0, n) {
        cin >> w[i];
        sum += w[i];
    }

    vector<int> s(n + 1, 0);
    rep(i, 0, n) {
        s[i + 1] = s[i] + w[i];
    }
    int ans = sum;
    rep(i, 1, n) {
        ans = min(ans, abs(s[i] - (sum - s[i])));
    }
    cout << ans << endl;

    return 0;
}


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

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

#define fr first
#define sc second

template <int N = 200010,int lnN = 18>
struct String{
	string S;
	int sa[N][lnN];
	void sa_init(){
		if(true){
			vector<P> vec;
			for(int i = 0 ; i < S.size() ; i ++){
				vec.push_back(P(S[i],0));
			}
			sort(vec.begin(),vec.end());
			for(int i = 0 ; i < S.size() ; i ++){
				sa[i][0] = lower_bound(vec.begin(),vec.end(),P(S[i],0)) - vec.begin();
			}
		}
		for(int t = 1 ; t < lnN ; t ++){
			vector<P> vec;
			for(int i = 0 ; i < S.size() ; i ++){
				if(i+(1<<(t-1)) < S.size())vec.push_back(P(sa[i][t-1],sa[i+(1<<(t-1))][t-1]));
				else vec.push_back(P(sa[i][t-1],-1));
			}
			sort(vec.begin(),vec.end());
			for(int i = 0 ; i < S.size() ; i ++){
				if(i+(1<<(t-1)) < S.size()){
					sa[i][t] = lower_bound(vec.begin(),vec.end(),P(sa[i][t-1],sa[i+(1<<(t-1))][t-1]))-vec.begin();
				}
				else {
					sa[i][t] = lower_bound(vec.begin(),vec.end(),P(sa[i][t-1],-1)) - vec.begin();
				}
			}
		}
	}
	bool eq(int x,int y,int l){
		for(int t = lnN-1 ; t >= 0 ; t--){
			if(l < (1<<t))continue;
			if(sa[x][t] != sa[y][t])return false;
			l -= 1<<t;
			x += 1<<t;
			y += 1<<t;
		}
		return true;
	}
};
String<> str;

string A,B;
vector<P> vec;
ll ret[26];
ll cnt_A[26];
ll cnt_B[26];
void cnt(ll x,ll k){
	//cout << x << " " << k << endl;
	if(x <= A.size()+B.size()){
		for(int i = 0 ; i < min( x , (ll)A.size() ) ; i ++){
			ret[A[i]-'a'] += k;
		}
		for(int i = A.size() ; i < x ; i ++){
			ret[B[i-A.size()]-'a'] += k;
		}
		return;
	}
	for(int i = 0 ; i+1 < vec.size() ; i ++){
		if(vec[i+1].fr*A.size()+vec[i+1].sc*B.size() <= x)continue;
		ll len = vec[i].fr*A.size() + vec[i].sc*B.size();
		for(int j = 0 ; j < 26 ; j ++){
			ret[j] += cnt_A[j]*vec[i].fr*k;
			ret[j] += cnt_B[j]*vec[i].sc*k;
		}
		cnt(x-len,k);
		return;
	}
}

int main(){
	ll l,r;
	cin >> str.S;
	cin >> l >> r;
	
	/*str.sa_init();
	A = "";
	for(int i = str.S.size()/2+1 ; i <= str.S.size() ; i ++){
		if(str.eq(0,i,str.S.size()-i)){
			A = str.S.substr(0,i);
			break;
		}
	}*/
	A = str.S.substr(0,str.S.size()/2);
	str.S = A;
	str.sa_init();
	for(int i = 1 ; i <= str.S.size() ; i ++){
		if(str.eq(0,i,str.S.size()-i)){
			B = str.S.substr(0,i);
			break;
		}
	}
	
	//cout << A << " " << B << endl;
	
	vec.push_back(P(0,1));
	vec.push_back(P(1,0));
	while(1){
		P p;
		p.fr = vec[vec.size()-2].fr + vec[vec.size()-1].fr;
		p.sc = vec[vec.size()-2].sc + vec[vec.size()-1].sc;
		vec.push_back(p);
		if(p.fr*A.size()+p.sc*B.size() > r)break;
	}
	for(int i = 0 ; i < A.size() ; i ++){
		cnt_A[A[i]-'a'] ++;
	}
	for(int i = 0 ; i < B.size() ; i ++){
		cnt_B[B[i]-'a'] ++;
	}
	
	cnt(r,1);
	cnt(l-1,-1);
	for(int i = 0 ; i < 26 ; i ++){
		printf("%lld%c",ret[i],(i==25)?'\n':' ');
	}
}


Measured memory_bytes: 12312
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef long long ll;

int main(void){
  int h, w;
  cin >> h >> w;
  vector<vector<char>> vvc(h, vector<char>(w,'.'));
  rep(i, h) rep(j, w) cin >> vvc[i][j];

  bool jud = true;
  rep(i, h){
    rep(j, w){
      bool jud_left = false;
      bool jud_right = false;
      bool jud_up = false;
      bool jud_down = false;
      if(vvc[i][j] == '#'){
        if(i >= 1){
          if(vvc[i - 1][j] == '#') jud_up = true;
        }
        if(i <= h - 2){
          if(vvc[i + 1][j] == '#') jud_down = true;
        }
        if(j >= 1){
          if(vvc[i][j - 1] == '#') jud_left = true;
        }
        if(j <= w - 2){
          if(vvc[i][j + 1] == '#') jud_right = true;
        }

        if(!jud_down && !jud_up && !jud_left && !jud_right) jud = false;
      }
    }
  }
  cout << (jud ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
def resolve():
    n = int(input())
    l = list(map(int,input().split()))
    out = 0
    if n >= 3:
        for i in range(n-2):
            for j in range(i+1, n-1):
                for k in range(j+1, n):
                    if l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
                        if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[k] + l[j] > l[i]:
                            out += 1
    print(out)
resolve()    

Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>

using namespace std;

#define ll long long
#define DEBUG(x) cerr << #x << " = " << x << endl
#define X first
#define Y second
#define N 100000
#define mod 1000000007
typedef pair<ll, ll> ii;
ll f[2*N + 5][0], rs;

ll gt(ll x){
	ll rs = 1;
	for (int i = 1; i <=x ; i++){
		rs = rs * i;
		rs %= mod;
	}
	return rs;
}

int main(){
	ios_base::sync_with_stdio(0);
	
	int n, m;
	
	cin >> n >> m;
	if (abs(n-m) >= 2) cout << 0;
	else {
		if (n == m){
			cout << 2 * gt(n) * gt(m) % mod;
		} else {
			cout << gt(n) * gt(m) % mod;
		}
	}
	

	return 0;
}



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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int main() {
	int N;
	cin >> N;
	cout << N/3 << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

K = int(input())
A = list(map(int, input().split()))

lb, ub = 1, 10**18
while ub - lb > 1:
    m = (lb + ub) // 2
    rem = m
    for a in A:
        rem = rem // a * a
    if rem < 2:
        lb = m
    else:
        ub = m

lb2, ub2 = 1, 10**18
while ub2 - lb2 > 1:
    m = (lb2 + ub2) // 2
    rem = m
    for a in A:
        rem = rem // a * a
    if rem <= 2:
        lb2 = m
    else:
        ub2 = m

if ub > lb2:
    print(-1)
else:
    print(ub, lb2)

Measured memory_bytes: 59632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

int c[105][6];
int main(){
 
  ll n; scanf("%lld",&n);
  ll x=n/11;
  ll ans = 2*x;
  n-=x*11;
  if(n>6) ans+=2; else if(n) ans++;
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) rep2(i,0,n)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;
int n,ans=0;
int main()
{
	cin>>n;
	rep2(i,1,n+1)
	{
		ans+=n/i;
		ans-=n%i==0;
	}
	re(ans) 
	return 0;}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
int f[maxn],h[maxn],n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	f[1]=0,f[2]=abs(h[1]-h[2]);
	for(int i=3;i<=n;i++)
		f[i]=min(abs(h[i]-h[i-1])+f[i-1],abs(h[i]-h[i-2])+f[i-2]);
	cout<<f[n];
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int main()
{
    int in[5], ans=0, mx=0;
    REP(i,0,4) scanf("%d",&in[i]);

    REP(i,0,4) {
        ans += (in[i]+9)/10*10;
        if (in[i]%10)
            mx = max(mx, 10-in[i]%10);
    }
    printf("%d\n", ans-mx);
    
    return 0;
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m,k;
    cin>>n>>m>>k;
    if(n-m==0&&n!=k){
      cout<<"Yes"<<endl;
      return 0;
    }
    if(n-k==0&&n!=m){
      cout<<"Yes"<<endl;
      return 0;
    }
    if(k-m==0&&n!=k){
      cout<<"Yes"<<endl;
      return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


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


void solve(long long K, long long X){
    for (int i=X-K+1; i<X+K; ++i){
        printf("%d ", i);
    }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    solve(K, X);
    return 0;
}


Measured memory_bytes: 256
L, R = map(int, input().split())

x_min = 2018
if L // 2019 != R // 2019:
  print(0)
elif L % 2019 == 0 or R % 2019 == 0:
  print(0)
else:
  L = L % 2019
  R = R % 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      if x_min > (i*j)%2019:
        x_min = (i*j)%2019
  print(x_min)

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	input := []string{}
	n := nextInt()
	for i := 0; i < n; i++ {
		input = append(input, nextStr())
	}
	resultMap := map[string]int{}

	for _, s := range input {
		resultMap[s]++
	}

	fmt.Print(len(resultMap))
}


Measured memory_bytes: 25452
n = int(input())
h = list(map(int, input().split()))
result = True
for i in range(n - 1, 0, -1):
    d = h[i - 1] - h [i]
    if d > 1:
        result = False
        break
    if d == 1:
        h[i - 1] = h[i - 1] - 1
if result:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14396
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for j in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if a[k+i][0+j:m+j]!=b[k]:
                break
        else:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")

Measured memory_bytes: 9096
N = int(input())

t = []
x = []
y = []

for i in range(N):
    tadd, xadd, yadd = map(int, input().split())
    t.append(tadd)
    x.append(xadd)
    y.append(yadd)

ans = 'Yes'

for j in range(N):
    if t[j] % 2 != (x[j] + y[j]) % 2 or t[j] < abs(x[j]) + abs(y[j]):
        ans = 'No'
        break

print(ans)

Measured memory_bytes: 11752
//============================================================================
// Name        : f.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
using namespace std;

//(a^n)mod(p)
//long long modPow(long long a, long long n, long long p) {
//  if (n == 1) return a % p;
//  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
//  long long t = modPow(a, n / 2, p);
//  return (t * t) % p;
//}


long long modPow(long long a, long long n,long long MOD) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        a = a * a % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}


int main() {
	long long  r1,r2,c1,c2;
	cin>>r1>>c1>>r2>>c2;
	long long def=1;
	long long n=r2+c2+3;
	for(int i=0;i<9;i++)def*=10;
	def+=7;
	vector<long long> f(n),rf(n);
	f[0]=1;
	rf[0]=1;
	for(int i=1;i<n;i++){
		f[i]=f[i-1]*i;
		f[i]%=def;
		rf[i]=modPow(f[i],def-2,def);
	}



	long long ans=0;
	ans+=((f[r2+c2+2]*rf[r2+1])%def)*rf[c2+1];
	ans%=def;
	ans-=((f[r2+c1+1]*rf[r2+1])%def)*rf[c1];
	ans%=def;
	ans-=((f[r1+c2+1]*rf[r1])%def)*rf[c2+1];
	ans%=def;
	ans+=((f[r1+c1]*rf[r1])%def)*rf[c1];
	ans%=def;
	ans+=def;
	ans%=def;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 31488
P = [-1] * 101
while True:
    t, p = [int(x) for x in input().split(",")]
    if t == 0 and p == 0:
        break
    P[t] = p

L = sorted(set(P),reverse=True)
#print(L)
d = dict()
for rank, point in enumerate(L,start=1):
    d[point] = rank
#print(d)
while True:
    try:
        t = int(input())
    except:
        break

    p = P[t]
    print(d[p])


    





Measured memory_bytes: 5600
N = gets.chomp.to_i

V = gets.split.map(&:to_i)
C = gets.split.map(&:to_i)

sumV = 0
sumC = 0

N.times do | i |
    if V[i] > C[i] then
        sumV += V[i]
        sumC += C[i]
    end
    
end

puts sumV - sumC



Measured memory_bytes: 1916
/* Author:bhagatsunny96
         JGEC
	   template__
	lets_code_it_ */
#include <iostream>
using namespace std;
#define ll long long int
int main() 
{
    ll n,m;
    cin>>n>>m;
    ll a[m];
    ll s=0;
    for(ll i=0;i<m;i++)
    {
        cin>>a[i];
        s=s+a[i];
    }
    if(s>n)
    cout<<-1<<endl;
    else
    cout<<n-s<<endl;
	return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define MAXN 100020
 
struct TopSort {
    int n;
    vector<int> *e;
    int *degrees;
    queue<int> topNodes;
    vector<int> topologicalOrdering;
    bool acyclic;
    TopSort(int _n) : n(_n) {
        e = new vector<int>[n];
        degrees = new int[n];
        acyclic = true;
        for (int i = 0; i < n; i++) {
            degrees[i] = 0;
        }
    }
    void add(int u, int v) {
        e[u].push_back(v);
        degrees[v]++;
    }
    void checkAcyclic() {
        if (topologicalOrdering.size() != n) {
            acyclic = false;
        }
    }
    void driver() {
        for (int i = 0; i < n; i++) {
            if (degrees[i] == 0) {
                topNodes.push(i);
            }
        }
        while (!topNodes.empty()) {
            int topNode = topNodes.front();
            topNodes.pop();
            topologicalOrdering.push_back(topNode);
            for (int i = 0; i < e[topNode].size(); i++) {
                degrees[e[topNode][i]]--;
                if (degrees[e[topNode][i]] == 0) {
                    topNodes.push(e[topNode][i]);
                }
            }
        }
        //checkAcyclic();
    }
    void print() {
        for (int i = 0; i < topologicalOrdering.size(); i++) {
            cout << topologicalOrdering[i] << " ";
        }
        cout << endl;
    }
};
 
int n,m;
int dp[MAXN];
 
int main() {
	cin >> n >> m;
  	TopSort TS = TopSort(n);
  	for (int i = 0; i < m; i++) {
      int x,y; cin >> x >> y;
      x--; y--;
      TS.add(x,y);
    }
  	TS.driver();
  	for (int i = n-1; i >= 0; i--) {
      int v = TS.topologicalOrdering[i];
      dp[v] = 1;
      for (int j = 0; j < TS.e[v].size(); j++) {
        dp[v] = max(dp[v],1+dp[TS.e[v][j]]);
      }
    }
  	int ans = 1;
  	for (int i = 0; i < n; i++) {
      ans = max(ans,dp[i]);
    }
  cout << ans-1 << endl;
}

Measured memory_bytes: 7032
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    string s;
    cin >> s;
    int n = s.length();
    bool ok = true;
    string t;
    
    rep(i, (n-1)/2){
        t[i] = s[(n-3)/2-i];
    }
    rep(i, (n-1)/2){
        if(s[i] != t[i]){
            ok = false;
        }
        if(s[i] != s[n-1-i]){
            ok = false;
        }
    }
    rep(i, (n-1)/2){
        t[n-1-i] = s[(n+1)/2+i];
    }
    rep(i, (n-1)/2){
        if(s[n-1-i] != t[n-1-i]){
            ok = false;
        }
    }
    if(ok){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
 
int main(){
  	int a,b;
  	int l,m,n,p;
  	scanf("%d %d",&a,&b);
  	l=2*a-1;
  	m=2*b-1;
  	n=a+b;
  	p=std::max(std::max(l,m),n);
 	printf("%d",p);
  return 0;
}

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

int main() {
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;

    if (x-r>=0 && x+r<=w && y-r>=0 && y+r<=h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3116
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#include<stack>
#include<cassert>
#include<functional>
#define int long long int
#define double long double
using namespace std;
#define INT_MAX 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

signed main()
{
int n;
std::cin >> n;
std::vector<double> a(n,0);
double mean = 0;
for(int i = 0; i < n; i++){
    double temp;
    std::cin >> temp;
    a[i] = temp;
    mean += temp;
}
mean = (double)mean/((double)n * 1.0);

double min = 1000000.00;
double flag = 0;
for(int i = 0; i < n; i++){
    if(abs(a[i] - mean) < min){
        min =abs(a[i] - mean);
        flag= i; 
    }
}

std::cout << flag << std::endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<cstring>
using namespace std;
long long combi(int n,int m){//求组合数的函数
    long long cnt = 1;
    for(int i = 0; i < m; i++){
        cnt *= n - i;
        cnt /= i + 1;
    }
    return cnt;
}

int main()
{
	int n,m;
	cin>>n>>m;
	cout<<combi(n,2)+combi(m,2)<<endl;
	return 0; 
	
}

Measured memory_bytes: 256
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import copy
    # import numpy as np
    import math
    # import random
    input = stdin.readline

    x = int(input())
    one_round = 360
    print(int(360//math.gcd(one_round, x)))




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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;



int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  REP(i, N){
    cin >> a[i];
  }
  int cnt = 0;
  REP(i, N){
    if(i % 2 != 0) continue;
    if(a[i] % 2) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3592
mod = 10**9 + 7
N, M = map(int, input().split())
state = [True]*(N+1)
ans = [0]*(N+1)
for _ in range(M):
    state[int(input())] = False

ans[0] = 1
for i in range(N):
    if state[i]:
        ans[i+1] += ans[i]
        if i < N-1:
            ans[i+2] += ans[i]
print(ans[-1]%mod)

Measured memory_bytes: 468976
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin, (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
	  fac[i] = fac[i-1] * i % MOD;
	  inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
	  finv[i] = finv[i-1] * inv[i] % MOD;
	}
}
//組み合わせ
long long COM (int n, int k) {
	if(n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
void solve() {
	int64 n; cin >> n;
	string s; cin >> s;
	int64 rc = 0;
	int64 gc = 0;
	int64 bc = 0;
	rep (i, n) {
		if (s[i] == 'R') rc++;
		else if (s[i] == 'G') gc++;
		else bc++;
	}
	int64 ans = rc * gc * bc;
	for (int64 i = 1; i < n; ++i) {
		for (int64 j = 0; (i + i + j) < n; ++j) {
			if (s[j] != s[i + j] && s[i + j] != s[i + i + j] && s[i + i + j] != s[j]) ans--;
		}
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3640
//
//  main.c
//  Practice
//
//  Created by hoshino on 2015/10/19.
//  Copyright ?? 2015??´ hoshino. All rights reserved.
//

#include <stdio.h>

int main(void) {
    int S,h,m,s;
    
    scanf("%d", &S);
    h=S/3600;
    m=(S-h*3600)/60;
    s=(S-h*3600-m*60);
    printf("%d:%d:%d\n",h,m,s);
    // insert code here...
    
    return 0;
}

Measured memory_bytes: 1020
import java.util.*;
 
public class Main{
	public  static void main(String[] args){
    	Scanner Scan = new Scanner(System.in);
      	int A = Scan.nextInt();
      	int B = Scan.nextInt();
      	int T = Scan.nextInt();
      	int preans = T / A;
      	int ans = B * preans;
      	System.out.print(ans);
      	Scan.close();
    }
}

Measured memory_bytes: 19796
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    string s;
    cin >> s;
    string t1(s), t2(s);
    int cnt1 = 0, cnt2 = 0;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2) {
            if (s[i] != '1') cnt1++;
            else cnt2++;
        }
        else {
            if (s[i] != '0') cnt1++;
            else cnt2++;
        }
    }
    cout << min(cnt1, cnt2) << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  int x,y,z;
  C3(x,y,z);
  int a=x-z,b=y+z;
  int bef = 0;
  for(int i = 0 ; i < 100000 ; i++ ){
    if(a<b*i){
      P(bef);
      break;
    }
    bef = i;
  }
  ret 0;
}

Measured memory_bytes: 256
from collections import defaultdict
n, *D  = [list(map(int, s.split())) for s in open(0)]
D = D[0]
dic = defaultdict(int)
for i in D:
    dic[i] += 1

total_comb = 0
for j in dic:
    if dic[j] >= 2:
        total_comb += dic[j] * (dic[j] - 1) / 2
for k in D:
    if dic[k] >= 2:
        print(int(total_comb - dic[k] + 1))
    else:
        print(int(total_comb))

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

int main() {
    int n, q, t;
    string name;

    queue< pair<string, int> > process;

    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        cin >> name >> t;
        process.push(make_pair(name, t));
    }

    pair<string, int> u;
    int elaps = 0;
    int a;

    while (!process.empty()) {
        u = process.front(); process.pop();
        a = min(u.second, q);
        u.second -= a;
        elaps += a;
        if (u.second > 0) {
            process.push(u);
        } else {
            cout << u.first << " " << elaps << endl;
        }
    }
}



Measured memory_bytes: 6224
s=input()
n=len(s)
k=int(input())

index=-1
for i in range(n):
    if s[i]!='1':
        index=i
        break

if index==-1:
    print(1)
else:
    if k<=index:
        print(s[k-1])
    else:
        print(s[index])

Measured memory_bytes: 9136
import sys
sys.setrecursionlimit(10 ** 6)


def dfs(s, pos):
    global N, K
    ns = {}
    if len(A) > K:
        return
    for i in pos:
        ni = i + 1
        if ni < N:
            x = s + S[ni]
            if x in ns:
                ns[x].append(ni)
            else:
                ns[x] = [ni]
    candidate = []
    for x in list(ns.keys()):
        candidate.append((x, ns[x]))
    candidate.sort()
    for c, idx in candidate:
        A.add(c)
        dfs(c, idx)


S = list(input())
N = len(S)
K = int(input())
alpha = [chr(ord('a') + i) for i in range(26)]

A = set()
for c in alpha:
    if len(A) < K:
        pos = []
        for i, s in enumerate(S):
            if c == s:
                A.add(c)
                pos.append(i)
        dfs(c, pos)

A = list(A)
A.sort()
print(A[K - 1])


Measured memory_bytes: 4212
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //



void solve(){
	int n, x;
	cin >> n >> x;
	SI s;
	loop(i, x){
		int t;
		cin >> t;
		s.insert(t);
	}
	loop(i, 1000000){
		if(!s.count(n - i)){
			cout << n - i;
			return;
		}
		if(!s.count(n + i)){
			cout << n + i;
			return;
		}
	}
}




int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



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

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

char mat[101][101];
int l[101][101] = {}, u[101][101] = {};

int main(){
    int n, m, d;
    cin >> n >> m >> d;

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> mat[i][j];
            if(mat[i][j] == '.'){
                u[i][j] = u[i-1][j]+1;
                l[i][j] = l[i][j-1]+1;
            }    
        }
    }

    int ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            ans += (l[i][j] >= d) + (u[i][j] >= d);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
   int n;
   long double ans;
   cin >> n;
   vector<double> a(n);

   for(int i=0;i<n;i++){
      cin >> a[i]; 
   }
   
   for(int i=0;i<n;i++){
    ans +=  1.0 / a[i];
   }

   printf("%.14Lf\n",1.0 / ans);
   	
}



Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



void solve() {
    ll a, b, c, d, e , m, n, k, x,l,r;
    string s;
    ll ans = 0;
    double dans = 0;
    string sans = "Yes";
    vector<ll> ar;

    cin >> s;

    ll min = INF;


    rep(i,s.size()-2){
        ll num = stoi(s.substr(i,3));
        min = std::min(abs(min), abs(753-num));
    }

    ans = min;

    std::cout << ans << endl; 

    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <string.h>

#define testin freopen("1.txt","r",stdin);
#define testout freopen("out.txt","w",stdout);
#define ll long long

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    a-=b;
    c-=a;
    if(c<0) cout<<0<<endl;
    else cout<<c<<endl;
    return 0;
}


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

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

  int a_x[N], a_y[N], a_h[N];
  for (int i = 0; i < N; ++i)
    cin >> a_x[i] >> a_y[i] >> a_h[i];

  for (int X = 0; X <= 100; ++X) {
    for (int Y = 0; Y <= 100; ++Y) {
      int H = -1, H_MAX = -1;
      for (int i = 0; i < N; ++i) {
        int h = abs(a_x[i] - X) + abs(a_y[i] - Y) + a_h[i];
        if (a_h[i] != 0) {
          if (H == -1) {
            H = h;
            continue;
          }
          if (H != h)
            break;
        } else {
          if (H_MAX == -1 || h < H_MAX)
            H_MAX = h;
        }
        if (i == N - 1 && 1 <= H && (H_MAX == -1 || H <= H_MAX)) {
          cout << X << " " << Y << " " << H << endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 256
from operator import itemgetter
n,m = map(int,input().split())

ab = sorted([tuple(map(int,input().split())) for i in range(m)],key = itemgetter(1))
removed = -1
ans = 0

for a,b in ab:
    if a > removed:
        removed = b-1
        ans += 1
print(ans)


Measured memory_bytes: 19016
from operator import itemgetter
N = int(input())

SP = [["", "", i+1] for i in range(N)]
kari = []

for i in range(N):
  kari.append(list(map(str, input().split())))
  
for i in range(N):
  SP[i][0] = kari[i][0]
  SP[i][1] = int(kari[i][1])

SP.sort(key=itemgetter(1), reverse=True)
SP.sort(key=itemgetter(0))

for i in range(N):
  print(SP[i][2])

Measured memory_bytes: 3064
<?php

[$N, $M] = fscanf(STDIN, "%d%d");
$map = fscanf(STDIN, str_repeat("%d", $N));

$mod = [];
$last = 0;
$ans = 0;
foreach($map as $value){
    $last += $value;
    $last %= $M;
    if($last === 0){
        $ans++;
    }
    if(isset($mod[$last])){
        $ans += $mod[$last];
        $mod[$last]++;
    }else{
        $mod[$last]=1;
    }

}
echo $ans;


Measured memory_bytes: 23980
#include<iostream>
using namespace std;
int main()
{
int i,j;
	for(i=1;i<=9;i++)
		{
			for(j=1;j<=9;j++)
			{
			  cout<< i << "x" << j << "=" << i*j <<endl;
			}
		}
return 0;
}

Measured memory_bytes: 1116