akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll po(ll x) { ll tmp = x; for (int i = 0; i < 4; i++)tmp *= x; return tmp; }

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

	ll X;
	cin >> X;

	for (int A = 1000; A >= -1000; A--) {
		for (int B = A - 1; B >= -1000; B--) {
			if (po(A) - po(B) == X) {
				cout << A << " " << B << endl;
				return 0;
			}
		}
	}
	

	return 0;
}

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

int main()
{
    int a, b, c, t;
    cin >> a >> b >> c;
    t = a + b + c;
    a = max(max(a, b), c);
    c = min(min(a, b), c);
    b = t - a - c;
    if (a - c == b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

int main() {
    int N;
    int count = 0;
    bool ans = true;
    cin >> N;

    while (N--) {
        string s;
        cin >> s;
        if (s == "A") {
            count++;
        } else if (count) {
            count--;
        } else {
            ans = false;
        }
    }

    if (!ans || count) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }

    return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
	string s;
	vector<string> words={"dream","dreamer","erase","eraser"};
	int num;
	string ret="NO";
void dfs(int i){
	if(i==num)ret="YES";
	for(auto&& w:words){
   //   	cout<<i<<" "<<w<<endl;
		if(i+w.size()<=num && s.substr(i,w.size())==w){
			dfs(i+w.size());
		}
	}	
	

	}


int main(){
	cin >>s;
	num=s.size();
  dfs(0);
  cout<<ret<<endl;
	

}

Measured memory_bytes: 2432
input_nums = list(map(int, input().split()))
num1 = input_nums[0]
num2 = input_nums[1]

def gcd(num1, num2):
    a = max(num1, num2)
    b = min(num1, num2)
    r = a%b
    while(r != 0):
        a = b
        b = r
        r = a%b
    return b
    

print(num1 * num2 // gcd(num1, num2))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ll long long
#define pii pair<int,int>
int fac[9];
void init() {
    int i=0;
    fac[0]=1;
    for(int i=1;i<9;i++)
        fac[i]=i*fac[i-1];
}

void test_case()
{
    int n,a=0,b=0;
    cin>>n;
    int p[n], q[n];
    for(int i=0;i<n;i++) cin>>p[i];
    for(int i=0;i<n;i++) cin>>q[i];

    do {
        a++;
    } while(prev_permutation(p,p+n));

    do {
        b++;
    } while(prev_permutation(q,q+n));

    cout<<abs(a-b);
}


int main()
{
    fastio
//    int t;
//    cin>>t;
//    while(t--)
    test_case();
}


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

using namespace std;

const int N = 1e5 + 100;

int a[N];
int n, ans;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		if (a[i] == i + 1) {
			ans++;
			swap(a[i], a[i + 1]);	
		}
	return cout << ans, 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
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;}
#define MOD 998244353 //1000000007


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

    // solution comes here

    string S;
    cin >> S;
    ll N=S.size();
    ll R=1, L=1, ai=0;
    vl ans(N);
    bool br=true;
    rep(i, N) {
        if(br) {
            if('R'==S[i+1]) R++;
            else {
                br=false;
                ai=i;
            }
        }
        else {
            if('L'==S[i+1]) L++;
            else {
                br=true;
                ll k=L+R;
                if(k%2) {
                    ans[ai] = k/2 + (R%2==1);
                    ans[ai+1] = k/2 + (R%2==0);
                }
                else {
                    ans[ai] = ans[ai+1] = k/2;
                }
                R=L=1;
            }
        }
    }

    for(auto x:ans) cout << x << " ";
    cout << nl;
}

Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0)
int in(){int32_t x ; scanf("%d",&x) ;  return x ;}
inline long long lin() {long long x ; scanf("%lld",&x) ; return x ;}
const int maxn = 1e6 + 10;
int32_t main()
{
    int n = in();
    int cnt = 0;
    for (int i = 0 ; i < n ; i ++)
        cnt += in()%2;
    cnt %= 2;
    if (cnt == 0) cout << "YES\n";
    else cout << "NO\n";
}

Measured memory_bytes: 256
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let length: i32 = buf.trim().parse().unwrap();

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iterator = buf.split_whitespace();

    let mut elements = vec![];
    for _ in 0..length {
        let element: i32 = iterator.next().unwrap().parse().unwrap();
        elements.push(element);
    }

    print!("{}", elements.pop().unwrap());
    for _ in 1..length {
        let element = elements.pop().unwrap();
        print!(" {}", element);
    }
    println!();
}



Measured memory_bytes: 5028
#include <iostream>
#include <vector>
using namespace std;
const int Max = 1000000;

int a[Max], cnt = 0;
vector<int> G;
void InsertSort(int a[], int N, int g)
{
    for(int i=g; i<N; i++)
    {
        int v = a[i];
        int j= i-g;
        while(j>=0 && a[j]>v)
        {
            a[j+g] = a[j];
            j-=g;
            cnt++;
        }
        a[j+g] = v;
    }
}

void ShellSort(int a[], int N)
{
       //Éú³ÉGÐòÁÐ
       int h  = 1;
       while(h<=N)
       {
           G.push_back(h);
           h = h*3+1;
       }

       for(int i=G.size()-1; i>=0; i--)
       {
           InsertSort(a, N, G[i]);
       }
}

int main()
{
    int N;
    cin >> N;
    for(int i=0; i<N; i++)
    {
        cin >> a[i];
    }
    ShellSort(a, N);
    cout << G.size() << endl;
    for(int i=G.size()-1; i>0; i--)
    {
        cout << G[i] << " ";
    }
    cout << G[0] << endl;
    cout << cnt << endl;
    for(int i=0; i<N; i++)
        cout << a[i] << endl;
    return 0;
}



Measured memory_bytes: 7072
s = input()
S = input()
ary = []
flag = False
for i in range(len(s)-len(S)+1):
    if s[i] == S[0] or s[i] == "?":
        a = s[i:i+len(S)]
        for j in range(len(S)):
            if a[j] == S[j] or a[j] == "?":continue
            break
        else:
            flag = True
            ary.append(s[:i]+S+s[i+len(S):])
print(sorted(i.replace("?","a") for i in ary)[0] if flag else "UNRESTORABLE")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#define inf 0x3f3f3f3f
using namespace std;
int vis[55][200];
vector<char>k;
int main()
{
	
	int n;
	scanf("%d",&n);
	char s[55][55];
	for(int i=0;i<n;i++)
	{
		scanf("%s",s[i]);
		int l=strlen(s[i]);
		for(int j=0;j<l;j++)
		{
			vis[i][s[i][j]-'a']++;
		}
		
	} 
	int flag=0;
	int num=inf;
	int sum=0;
	for(int i=0;i<26;i++)
	{
		sum=0;
		for(int j=0;j<n;j++)
		{
			if(vis[j][i])
			{
				sum++;
				
			}
		}
		if(sum==n)
		{
			flag=1;
			break;
			
		}
	}
	if(!flag)
		puts(" ");
	else
	{
		for(int i=0;i<26;i++)
		{
			num=0;
			int maxx=inf;
			for(int j=0;j<n;j++)
			{
				if(vis[j][i])
				{
					num++;
					maxx=min(vis[j][i],maxx);
				}
			}
			if(num==n)
			{
				while(maxx--)
				{
					k.push_back(i+'a');
				}
			}
		}
		sort(k.begin(),k.end());
		for(int i=0;i<k.size();i++)
		{
			cout<<k[i];
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int LEN = 2e5 + 10;
int R[LEN];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> R[i];
    }
    int maxV = -2e9, minV = R[0];
    for (int i = 1; i < n; i++) {
        maxV = max(maxV, R[i] - minV);
        minV = min(minV, R[i]);
    }
    cout << maxV << endl;
    return 0;
}


Measured memory_bytes: 3872
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>
#include<cmath>

#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N,D,X ;
char str[26];
std::map<char,int> M ;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  cin >> N >> D >> X ;
  int A[N];
  int E[N];
  int sum = X ;
  REP(i,N){
    cin >> A[i] ;
  }
  REP(i,N){
    REP(j,D/A[i] + 1){
      int day =( A[i] * j)+1;
      if(day <= D  ){
        sum++;
      }
    }

  }
  cout << sum << endl;

  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}


Measured memory_bytes: 256
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))

def f(li,a):
    li2=[]
    for j in range(len(li)):
        for i in range(len(li[j])+1):
            li2.append(li[j][i:]+[a]+li[j][:i])
    return li2


li=[[1]]

for i in range(2,n+1):
    li=f(li,i)
    
li.sort()


print(abs(li.index(p)-li.index(q)))

Measured memory_bytes: 9716
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;

int main(){
    int a[3];
    rep(i,0,3)cin>>a[i];
    sort(a,a+3);
    int x=abs(a[1]-a[0]);
    int y=abs(a[2]-a[1]);
    if(x<=0)x=0;
    if(y<=0)y=0;
    cout<<x+y<<endl;
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i = 0; i < n; i++)
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD = 1000000007;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


int main() {
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	bool can = true;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				bool can2 = false;
				for (int d = 0; d < 4; d++) {
					int ni = i + dy[d];
					int nj = j + dx[d];
					if (ni >= 0 and  ni < h and nj >= 0 and nj < w) {
					//if (ni < 0 or ni >= h) continue;
					//if (nj < 0 or w <= nj) continue;
						if (s[ni][nj] == '#')
							can2 = true;
					}
				}
				if (!can2) {
					can = false;
				}
			}
		}
	}
	if (can)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

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

    priority_queue<u64, vector<u64>, greater<u64>> W;
    priority_queue<u64> R;

	for(u64 i=0; i<N; i++) {
        char c;
        cin >> c;

        if(c == 'W') {
            W.push(i);
        } else {
            R.push(i);
        }
    }

    if(W.empty() || R.empty()) {
        cout << 0 << endl;
        return 0;
    }

    u64 ans = 0;
    while(W.top() < R.top()) {
        ans++;

        u64 w = W.top();
        u64 r = R.top();

        W.pop();
        R.pop();

        W.push(r);
        R.push(w);
    }

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

Measured memory_bytes: 5600
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    struct Pos
    {
        public int x;
        public int y;
        public int h;

        public Pos(int X,int Y,int H)
        {
            x = X;
            y = Y;
            h = H;
        }
    }
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        List<Pos> pos = new List<Pos> { Capacity = N };
        for(int i = 0; i < N; i++)
        {
            string[] p = Console.ReadLine().Split(' ');
            pos.Add(new Pos(int.Parse(p[0]), int.Parse(p[1]), int.Parse(p[2])));
        }
        pos.Sort((x, y) => y.h - x.h);
        bool cont = true;
        int Cx=0;
        int Cy=0;
        int H=0;
        for (int cx = 0; cx <= 100; cx++)
        {
            for (int cy = 0; cy <= 100; cy++)
            {
                cont = true;
                int hpredict = Math.Abs(pos[0].x - cx) + Math.Abs(pos[0].y - cy) + pos[0].h;
                for (int i = 1; i < N; i++)
                {
                    if (Math.Max(hpredict - Math.Abs(pos[i].x - cx) - Math.Abs(pos[i].y - cy), 0) != pos[i].h)
                    {
                        cont = false;
                        break;
                    }
                }
                if (cont)
                {
                    Cx = cx;
                    Cy = cy;
                    H = hpredict;
                    break;
                }
            }
            if (cont)
                break;
        }
        Console.WriteLine(Cx + " " + Cy + " " + H);
    }
}

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

int main()
{
 int n, b;
 cin >> n;
 int a[n+1];
 int x[n+1];
 b=0;
 for(int i=1; i<n+1;i++) cin >> a[i];
 for(int i=1; i<n-1;i++){
   if(i%2==1) b+=a[i];
   if(i%2==0) b-=a[i];
 }
 x[1]=b+a[n]-a[n-1];
 for(int i=2; i<n+1;i++) x[i]=2*a[i-1]-x[i-1];
 for(int i=1; i<n+1;i++) cout << x[i] << ' ';
  return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
int main(){
    int64_t N,sum=0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int c = i+1;
        if(c%3!=0&&c%5!=0){
            sum += c;
        }
    }
    
    cout << sum << endl;
}

Measured memory_bytes: 3636
k=int(input())
x=7
cnt=1
if k%2==0:
    print(-1)
else:
    while True:
        if x%k ==0:
            print(cnt)
            break
        elif cnt<10000000:
            x=(x*10+7)%k
            cnt+=1
        else:
            print(-1)
            break

Measured memory_bytes: 63136
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int siz,ans=0;
        string str;
        cin>>siz>>str;
        for(int i=0;i<siz-2*n;i++){
            if(str[i]=='I'){
                int co=0;
                for(int j=i+1;j<siz;j+=2,co++)
                    if(str[j]!='O'||str[j+1]!='I')break;
                if(co>=n){
                    ans+=co-n+1;
                    i+=2*co;
                }
            }
        }
        cout<<ans<<endl;
    }
}

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

int main() {
  int X, a, L, b, ans;
  cin >> X;
  a=(X-(X%500))/500;
  L=X%500;
  b=(L-(L%5))/5;
  ans=1000*a+5*b;
  cout << ans << endl;
}


Measured memory_bytes: 3604
H,W=map(int,input().split())
bd=[]

for i in range(H):
        bd.append(input())

x=set()
y=set()

for i in range(H):
        for j in range(W):
                if bd[i][j]=="#":
                        x.add(j)
                        y.add(i)
for i in y:
        for j in x:
                print(bd[i][j],end="")
        print()

Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  string T;
  cin >> T;
  for (char &i : T)
    if (i == '?')
      i = 'D';
  cout << T << endl;
  return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false) , cin.tie(0) ,cout.tie(0);
	
	string s;
	cin>>s;
	
	int n = s.length();
	ll range = (ll)(1 << (n-1));
	range -= 1;
	ll ans = 0;
	for(int i=0;i<=range;i++){
			ll curr = s[0] - '0';	
			for(int j=0;j<n-1;j++){
				if(i & (1 << j)){
						ans += curr;
						curr = s[j+1] - '0';
				}else{
						curr = curr * 10 + s[j+1] - '0';
				}
			}
			ans += curr;
	}
	cout<<ans;
	return 0;
} 

/*
 * 987456
 * 
 * 987456 + 9 + 87456 + 98 + 7456 + 987 + 456 + 
 * 98 + 74 + 56
 */


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <typeinfo>
    
using namespace std;
    
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(){
    string o, e;
    cin >> o;
    cin >> e;
    for(int i=0; i<o.size()+e.size(); i++){
        if(i & 1) cout << e[i/2];
        else cout << o[i/2];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
	int a,b,c;
	
	cin >> a >> b >> c;
	
	if(a > b){
		if(a>c && c>b)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else {
		if(b>c && c>a)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
		
	return 0;
}


Measured memory_bytes: 256
/*                        _
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                   ____/`---'\____
                  /  \\|     |//  \
                 / \\||| /:\ |||// \
                / _||||| -:- |||||- \
               |   | \\\ \-/ /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
            ____'. .'  /--.--\  `. .'_____
          /"" '<  `.___\_<|>_/___.' >' "" \
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` / _/
          `-.____`.___ \_____/___.-`___.-'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.    IIT PATNA    I_LOVE_ADITI_GOEL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long double DEL = 1e-12;
const int mod =  1000000007;
const int LIM = 100005;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mpq priority_queue<int,vector<int>,greater<int>>
#define deb(a) cerr << #a << ": " << a << endl
#define ftt cin>>t;for(int tt=1;tt<=t;++tt)
#define Rev(v) reverse(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end())
#define mem(a,b) memset(a,b,sizeof(a))
#define umii unordered_map<int,int>
#define all(a) a.begin() , a.end()
#define vvi vector<vector<int>>
#define pq priority_queue<int>
#define sqr(a) (((a) * (a)))
#define double long double
#define dbg cout<<"\nhi\n"
#define pii pair<int,int>
#define mii map<int,int>
#define vb vector<bool>
#define vi vector<int>
#define nl cout<<"\n"
#define pb push_back
#define int long long
#define sp <<" "<<
#define ss second
#define ff first
 
int fpow(int x, int n)
{
    int res = 1;
    while(n){
          if(n&1){
                res = res * x % mod;
          }
          x = x * x % mod;
          n>>=1;
    }
    return res;
}
int gcd(int a,int b)
{
    if(b == 0)
    {
          return a;
    }
    return gcd(b,a % b);
}
void sieve(int n)
{
      bool prime[5*LIM];
      memset(prime, true, sizeof(prime));
      int rootn = (int)sqrt(n);
      for (int p = 2; p <= rootn; p++)
      {
            if (prime[p] == true)
            {
                  for (int i = p*p; i <= n; i += p)
                  {
                        prime[i] = false;
                  }
            }
      }
      prime[1] = 0;
}
int cnt, sum, mid, mx, mn, ans, a[2*LIM];
int n, m, d, p, q, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;

//******************************************* CHECK CONSTRAINTS **************************************************


int32_t main()
{     fio;
      cin>>k;
      if(k%5==0||k%2==0)
      {
            cout<<-1;
            return 0;
      }
      int dp = 0;
      for(i=1;i<=1e7;i++)
      {
            dp = (dp*10 + 7)%k;
            if(!dp)break;
      }
      cout<<i;
     
}


Measured memory_bytes: 3660
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define __DEBUG__ 1

typedef   signed long long int slli;
typedef unsigned long long int ulli;
const slli MAX_SLLI = 0x7FFFFFFFFFFFFFFF;
const slli MIN_SLLI = 0x8000000000000000;
const ulli MAX_ULLI = 0xFFFFFFFFFFFFFFFF;
const ulli MIN_ULLI = 0x0000000000000000;

#define N_TIMES(i, n)     for (ulli i = 0;     i <  n; ++i)
#define N_TIMES_REV(i, n) for (slli i = n - 1; i >= 0; --i)

#ifdef __DEBUG__
template<typename T>
std::ostream& operator<<(std::ostream &os, const std::list<T> &list)
{
  const std::string delim = ", ";
  typename std::list<T>::const_iterator itr = list.begin();
  while (itr != list.end()) {
    os << *itr;
    ++itr;
    if(itr != list.end()) os << delim;
  }
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v)
{
  const std::string delim = ", ";
  for (unsigned n = 0; n < v.size(); ++n) {
    os << v[n];
    if((n + 1) < v.size()) os << delim;
  }
  return os;
}
#endif

int main()
{
  unsigned A, B;
  std::cin >> A >> B;

  if(A == 1) A += 13;
  if(B == 1) B += 13;
  
  std::cout << ((A == B) ? "Draw" : ((A > B) ? "Alice" : "Bob")) << std::endl;

  return 0;
}

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

int main(){
    ll ans = 0;
    int n;
    cin >> n;
    vector<int> a(n*3);
    rep(i,n*3) cin >> a[i];
    sort(a.begin(),a.end());
    for(int i = n; i < n*3; i += 2){
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}


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

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

  int n;
  cin >> n;

  for (int i = 0; i <= 50000; ++i) {
    int x = i * 1.08;
    if (x == n) {
      cout << i << '\n';
      return 0;
    }
  }

  puts(":(");

  return (0);
}

Measured memory_bytes: 3620
#include <iostream>

typedef long long ll;

using namespace std;

ll x, y;

int main() {
#ifdef __APPLE__
    freopen("input3.txt", "r", stdin);
#endif
cin >> x >> y;

    int counter = 0;

    while (x <= y) {
        x *= 2;
        ++counter;
    }

    cout << counter << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
using namespace std;
int n;
char s[100];
void dfs(int x, int y) {
    if (x == n) {
        printf("%s\n", s);
        return;
    }
    for (int i = 0; i <= y + 1; i ++) {
        s[x] = i+ 'a';
        dfs(x + 1, max(y, i));
    }
}
int main() {
    scanf("%d", &n);
    dfs(0, -1);
    return 0;
}

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

int main() {
  int N, A, b, c;
  cin >> N >> A;
  c = 0;
  for (int i = 0; i < N; i++) {
    cin >> b;
    if (b * 2 < (A - b) * 2 ) {
      c = c + b * 2;
    }
    else {
      c = c + (A - b) * 2;
    }
  }
  cout << c << endl;
      
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define Sort(v) sort(v.begin(), v.end())
#define For(m) for (auto it = m.begin(); it != m.end(); it++)
#define mp(p1,p2) make_pair(p1,p2)
#define sz(a) (ll)a.size()
#define mod 1000000007
#define PI 3.14159265358979323846
#define pii pair<ll ,ll>
#define ppii pair<ll,pii>
using namespace std;
#define fast                                                                   \
 ios_base::sync_with_stdio(false);                                            \
 cin.tie(NULL);                                                               \
 cout.tie(NULL);
const ll MAXN = 3000005;
const ll inf = 1e18;
int main()
{
   fast
  ll n;
  cin >> n;
  ll arr[n];
  fr(i,0,n)cin >> arr[i];
  ll dp[n];
  dp[0]=0;
  ll ans=0;
  fr(i,1,n)
  {
      if(arr[i]<=arr[i-1])
      {
          dp[i]=dp[i-1]+1;
      }
      else
       dp[i]=0;
       ans=max(ans,dp[i]);
  }
  cout << ans;

   return 0;      
}


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

int main(void){
	double r;
	double area, circ;
	scanf("%lf", &r);
	area = M_PI * r * r;
	circ = 2 * M_PI * r;
	printf("%.5lf %.5lf\n", area, circ);
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll n;

int main(){
	ll i = 1;
	cin >> n;
	while(1){
		if((i+1)*(i+1) > n)break;
		i++;
	}
	cout << i*i << endl;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] strArr = br.readLine().split(" ");
        int a = Integer.parseInt(strArr[0]);
        int b = Integer.parseInt(strArr[1]);
        int c = Integer.parseInt(strArr[2]);
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;

#define ll long long
#define ar array

int n, k, tmp;
int a[200000];

vector<int> v;

void solve(){
    
    cin >> n;

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

    sort(a, a+n, greater<int>());
    
    ll ans = (ll)a[0];
    int j = 1;
    for (int i = 2; i < n; i++)
    {
        ans += (ll)a[j];
        if(i%2) j++;
    }
    
    cout << ans << endl;

}





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 4328
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;
const ll MAXN = 100001;

ll W, H;

const ll MAXH = 101;
string S[MAXH];

ll dp[MAXH][MAXH];

ll dfs(ll x, ll y)
{
    if (dp[x][y]) { return dp[x][y] - 1; }

    ll res = MAXN;

    if (x < W - 1)
    {
        const auto neq = S[y][x] == '.' && S[y][x + 1] == '#';
        res = min(res, dfs(x + 1, y) + (neq ? 1 : 0));
    }

    if (y < H - 1)
    {
        const auto neq = S[y][x] == '.' && S[y + 1][x] == '#';
        res = min(res, dfs(x, y + 1) + (neq ? 1 : 0));
    }

    res = res != MAXN ? res : 0;
    return (dp[x][y] = res + 1) -1;
}

int main()
{
    cin >> H >> W;
    rep (i, H) { cin >> S[i]; }

    const ll ans = dfs(0, 0) + (S[0][0] == '#' ? 1 : 0);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
 
class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    String symbol;
 
    if (a < b) {
      symbol = " < ";
    } else if (a > b) {
      symbol = " > ";
    } else {
      symbol = " == ";
    }
    System.out.println("a" + symbol + "b");
  }
}


Measured memory_bytes: 26316
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using lli = long long int;

int main(){
  int n;
  std::cin >> n;
  vector<vector<lli> > adj(n, vector<lli>(n, 0));
  vector<vector<int> > mini;
  for (int i = 0; i < n; i++) {
    vector<int> tmp(3);
    for (int j = 0; j < n; j++) {
      std::cin >> adj[i][j];
      tmp[0] = adj[i][j], tmp[1] = i, tmp[2] = j;
      if(i < j)mini.push_back(tmp);
    }
  }
  sort(mini.begin(), mini.end());
  vector<vector<lli> > dist = adj;
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
      }
    }
  }

  if(dist != adj){
    std::cout << -1 << std::endl;
    return 0;
  }
  dist = vector<vector<lli> >(n, vector<lli>(n, 2e9));
  for (int i = 0; i < n; i++) dist[i][i] = 0;
  lli ans = 0;
  for (int i = 0; i < mini.size(); i++) {
    int u = mini[i][1], v = mini[i][2];
    bool flag = false;
    if(dist[u][v] <= adj[u][v])continue;
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        lli md = dist[j][u] + adj[u][v] + dist[v][k];
        if(md < dist[j][k]){
          dist[j][k] = dist[k][j] = md;
          flag = true;
        }
      }
    }
    if(flag) ans += adj[u][v];
  }
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 4788
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n, n)
    {
        int ans = 0;
        for(int i = 1; i < n; i++)
        {
            int sum = i;
            for(int j = i + 1; sum + j <= n; j++)
            {
                sum += j;
                if(sum == n) ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 3104
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(){
	char strk[1000001];
	bool bz=false;
	int sum=0,k=0;
	scanf("%s",strk);
	for(int i=0;i<=strlen(strk)-1;i++){
		if(strk[i]=='A')bz=true;
		if(bz==true)k++;
		if(strk[i]=='Z'&&bz==true){
			if(k>sum)sum=k;
		}
	}
	printf("%d\n",sum);
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> a,b;
  for(int i=0; i<n+1; i++){
    int tmp1;
    cin>>tmp1;
    a.push_back(tmp1);
  }
  for(int i=0; i<n; i++){
    int tmp1;
    cin>>tmp1;
    b.push_back(tmp1);
  }
  b.push_back(0);
  int lb=0;
  long long kill=0;
  for(int i=0;i<(n+1);i++){
    int rb=b.at(i);
    int ai=a.at(i);
    if(ai-lb<0){
      kill +=ai;
      lb=rb;
    }
    else{
      kill += lb;
      ai -=lb;
      kill +=min(ai,rb);
      lb =max(rb-ai,0);
    }
  }
  cout<<kill<<endl;
}

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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, l, t, w[114514], x[114514];
	pii a[214514];
	cin>>n>>l>>t;
	REP(i, n){
		cin>>x[i]>>w[i];
	}
	int cnt=0, m1=2*t/l, m2=2*t%l;
	if(w[0]==1){
		FOR(i, 1, n){
			if(w[i]==2){
				if(x[i]-x[0]<m2){
					cnt=(cnt+m1+1)%n;
				}
				else{
					cnt=(cnt+m1)%n;
				}
			}
		}
	}
	else{
		FOR(i, 1, n){
			if(w[i]==1){
				if(l-(x[i]-x[0])<m2){
					cnt=(cnt+m1+1)%n;
				}
				else{
					cnt=(cnt+m1)%n;
				}
			}
		}
	}
	int m=t%l;
	REP(i, n){
		if(w[i]==1){
			a[i]=pii((x[i]+m)%l, i);
		}
		else{
			a[i]=pii((x[i]-m+l)%l, i);
		}
	}
	sort(a, a+n);
	int s;
	REP(i, n){
		if(a[i].second==0){
			if(w[0]==2 && i+1<n && a[i].first==a[i+1].first){
				s=i+1;
			}
			else{
				s=i;
			}
			break;
		}
	}
	if(w[0]==1){
		s=(s-cnt+n)%n;
	}
	else{
		s=(s+cnt)%n;
	}
	REP(i, n){
		a[i+n]=a[i];
	}
	FOR(i, s, s+n){
		cout<<a[i].first<<'\n';
	}
	return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  ll x = N;
  ll sum = 0;
  while(x>0){
    sum += x%10;
    x /= 10;
  }

  if(N >= sum && N%sum==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}



Measured memory_bytes: 256
/************************************************
   Start coding only after you have clear idea. 
*************************************************/

#include <bits/stdc++.h>

#define x first
#define y second
#define pii pair<int,int>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
const int maxm = 2e3+23;
const int maxn = 2e5+35;
int n;
char s[maxn];
int main(){
    scanf("%d %s",&n,s+1);
    int num = 0;
    for(int i = 1;i <= n; ++i)
        if(s[i] == 'W') num += 1;
    int ans = 0;
    for(int i = n;i>0&&num;--i,--num){
        if(s[i] != 'W') ans += 1;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define range(c) c.begin() , c.end()
#define forn(i,n) for(ll i=0; i<n; ++i)
#define endl "\n"
#define MOD 1000000007
#define test ll t;cin >> (t);while(t--)
using namespace std;
//////////////////////////////////////////////////////////////
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
 ll h,w,mod=1000000007;
    cin>>h>>w;
    char a[h+2][w+2];
    ll dp[h+2][w+2];
    for(ll i=1;i<=h;i++){
        for(ll j=1;j<=w;j++){
            cin>>a[i][j];
            dp[i][j]=0;
        }
    }
    
    dp[1][1]=1;
    for(ll i=2;i<=w;i++){
        if(a[i][1]=='#')
        break;
        else
        dp[i][1]=1;
    }
    
    for(ll i=2;i<=w;i++){
        if(a[1][i]=='#')
        break;
        else
        dp[1][i]=1;
    }
    for(ll i=2;i<=h;i++){
        for(ll j=2;j<=w;j++){
            
            if(a[i][j] == '.')
            {
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            
            }
            else{
                dp[i][j]=0;
            }
        }
    }
    cout<<dp[h][w];

}

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

int main(){
	string s;
	cin >> s;
	bool A = true,C = false,AC = true;
	if(s[0] != 'A') A = false;
	for(int i = 1; i < s.length(); i++){
		if(i > 1  && i < s.length() - 1 && s[i] == 'C' && C == false) C = true;
		else if(!('a' <= s[i] && s[i] <= 'z'))AC = false;
	}
	if(A && C && AC)cout << "AC" << endl;
	else cout << "WA" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll f[60][60][6000];
ll a[60];
int sum[600]={};
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum[i]=sum[i-1]+a[i];
    }
    f[0][0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            for(int k=sum[i];k>=0;k--)
            {
                f[i][j][k]+=f[i-1][j][k];
                if(j>=1&&k>=a[i])
                {
                    f[i][j][k]+=f[i-1][j-1][k-a[i]];
                }
            }
        }
    }
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        sum+=f[n][i][m*i];
    }
    cout<<sum<<endl;
}


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

using namespace std;

int main(){
  using ll = int64_t;
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n), b(n);
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i]; 
  }
  ll ans = 0;
  for(int j=0;j<n;j++){
    if((k | a[j]) == k)ans += b[j]; 
  }
  for(int i=1;i<31;i++){
    if((k & (1LL << i)) == 0)continue;
    ll x = ((k >> i) << i) - 1;
    ll t = 0LL;
    for(int j=0;j<n;j++){
      if((x | a[j]) == x)t += b[j]; 
    }
    ans = max(ans, t);
    // cerr << i << " " << t << " " << ans << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
 
//#define READ_NUMBER(i) scanf("%d",i)
 
int main(){
	int N;
	cin >> N;

	int Ans;
	cin >> Ans;

	int x;
	for(int i = 0; i < N;i++){
		cin >> x;
		Ans = __gcd(Ans, x);
	}
	cout << Ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	int first;
	int second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int X = in.nextInt();
		int N = in.nextInt();
		boolean arr[] = new boolean[102];
		Arrays.fill(arr, true);
//		ArrayList<Integer> ans=new ArrayList<Integer>();
		int num[] = new int[N];
		for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		}
		int min = Integer.MAX_VALUE;
		int index = -1;
		for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		pw.println(index);

	}

	long __gcd(long a, long b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

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

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

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


Measured memory_bytes: 32808
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;

int counter(int x){
  if(x == 0) return 0;
  return counter(x>>1)+(x&1);
}

int main() {
  int n;
  int a[20];
  int x[20][20];
  int y[20][20];


  cin >> n;
  for(int i = 1; i <=n; ++i){
    cin >> a[i];
    for(int j = 1; j <= a[i]; ++j){
      cin >> x [i][j] >>y[i][j];
    }
  }
  int ans = 0;
  for(int bits = 1; bits < (1<<n); bits++){
    bool ok = true;
    for(int i = 1; i <= n; ++i){
      if(!(bits&(1<<(i-1)))) continue;
      for(int j = 1; j <= a[i]; j++){
        if(((bits>>(x[i][j]-1))&1)^y[i][j]) ok = false;
      }
    }
    if(ok) ans = max(ans,counter(bits));
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  bool ans = false;
  for(int i=0;i<s.size()-1;i++) {
    if(s.substr(i, 2) == "AC")
      ans = true;
  }
  if(ans) 
    cout << "Yes"<< endl;
  else
    cout << "No" << endl;

}


Measured memory_bytes: 256
H, W = [ int(x) for x in input().split() ]
a_s = [ input() for _ in range(H) ]

ans = ""
for i in range(W + 2):
    ans += "#"
ans += "\n"
for a in a_s:
    ans += "#" + a + "#"
    ans += "\n"
for i in range(W + 2):
    ans += "#"

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    int n, k;
    cin >> n >> k;
    vi v(n);
    for(int& x : v) cin >> x;
    sort(all(v));
    int ans = 0; 
    for(int i = 0; i < k; ++i) {
        ans += v[i];
    }
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define T int t = 0; cin >> t; while(t--)
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef  long double lld;
const ll mod = 1e9 + 7;
const ll mx = 1e5 + 1;

void input(){
    ll n, k; cin >> n >> k;
    vector<ll>h(n);
    f(i, n)cin >> h[i];
    if(k >= n){
        cout << 0 << endl;return;
    }
    sort(b_e(h), greater<ll>());
    ll ans = 0LL;
    for(int i = k; i < n; ++i)ans += h[i];
    cout << ans << endl;
}
int main(){
    input();
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int p[999],q[999],r[999],n,m;
int main(){
	cin>>m>>n;
	for(int i=0;i<n;i++)cin>>p[i];
	for(int i=0;i<n;i++){
		int sum=0;
		for(int j=1;j<=m;j++){
			cin>>q[j];
			if(q[j]!=p[i]){sum++;}
			else{r[j]++;}
		}
		r[p[i]]+=sum;
	}
	for(int i=1;i<=m;i++){
		cout<<r[i]<<endl;
	}
}

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

multiset<long long int> st={1000000000};

void f(long long int a){
  if(a > 1000000000) return;
  st.insert(a);
  f(10*a+3);
  f(10*a+5);
  f(10*a+7);
}

void g(long long int a){
  if(a > 1000000000) return;
  st.erase(a);
  g(10*a+3);
  g(10*a+5);
}
void h(long long int a){
  if(a > 1000000000) return;
  st.erase(a);
  h(10*a+3);
  h(10*a+7);
}
void i(long long int a){
  if(a > 1000000000) return;
  st.erase(a);
  i(10*a+5);
  i(10*a+7);
}

int main(){
  f(0);
  g(0);
  h(0);
  i(0);
  int N;
  cin >>N;
  st.insert(N);
  int ans = 0;
  for(auto itr = st.begin();itr != st.end();itr++){
    ans++;
    if(N < *itr) break;
  }
  cout << ans-2 << endl;
  return 0;
}
  


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

int main(){
	int N,M;
	cin >> N >> M;
	int L,R,roop;
	int maxL=1,minR=N;
	for(roop=0;roop<M;roop++){
		cin >> L >> R;
		if(maxL<L)
			maxL=L;
		if(minR>R)
			minR=R;
	}
	int ans=minR-maxL+1;
	if(ans<0)
		ans=0;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
int a,b;
int main(){
	in(a);in(b);
	if(a==b)cout<<a<<endl;
	else{
		int mid=(a+b)/2;
		if(mid*2!=a+b)puts("IMPOSSIBLE");
		else cout<<mid<<endl;
	}
	return 0;
}

Measured memory_bytes: 256