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

vector<long long int> p;
vector<long long int> p2;

int main(void){
	int a,b,n,m;
	while(1){
		long long int ans=0;
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;
		p.clear();
		p2.clear();
		for(a=0;a<n;a++){
			int num;
			scanf("%d",&num);
			p.push_back(num);
		}
		sort(p.begin(),p.end());
		p2.push_back(0);
		for(a=0;a<n;a++){
			p2.push_back(p[a]);
			for(b=0;b<n;b++){
				p2.push_back(p[a]+p[b]);
			}
		}
		p2.push_back(0);
		sort(p2.begin(),p2.end());
		for(a=0;a<p2.size();a++){
			long long int res=m-p2[a];
			if(m-p2[a]<0)continue;
			long long int pp=*(lower_bound(p2.begin(),p2.end(),res)-1);
			if(ans<pp+p2[a])ans=pp+p2[a];
			//cout << pp+p2[a] << endl;
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

#define int long long

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

signed main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A + B >= C) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class  Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if ((a < c && c < b) || (b < c && c < a)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<set>
#include<string>
 
int n, k;
std::string cards[11];
std::set<std::string>s;
 
void makecard(int p, std::string res, bool used[11]){
    if (p == k){
        s.insert(res);
        return;
    }
 
    for (int i = 0; i < n; i++){
        if (!used[i]){
            used[i] = true;
            makecard(p + 1, res + cards[i], used);
            used[i] = false;
        }
    }
}
 
int main(){
 
    while (std::cin >> n >> k, n || k){
        s.clear();
        for (int i = 0; i < n; i++){
            std::cin >> cards[i];
        }
        bool used[11];
        for (int j = 0; j < 11; j++)used[j] = false;
 
        makecard(0, "", used);
 
        std::cout << s.size() << std::endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    string s, t;
    int i, dap=0;
    cin>>s;
    cin>>t;
    
    for(i=0;i<s.length();i++)
    dap+=(s[i]!=t[i]);
    
    
    if(dap)
    printf("No");
    else
    printf("Yes");
    
    
    
    
    
    return 0;
}

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

using namespace std;

string s;

int main()
{
    int n;
    long long rez = 0;

    int mx = 0;
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        mx = max(mx, x);
        rez += mx - x;
    }

    cout << rez << "\n";

    return 0;
}


Measured memory_bytes: 3636
N = int(input())
A = [int(_) for _ in input().split()]
 
ans = []
t = []
c = 0
for i in range(N):
    c += A[i]
    t.append(c)
    
l = 0
r = 0

for _ in range(1, N-1):
    while t[_] > t[l]+t[l+1]:
        l += 1
    while t[-1]+t[_] > t[r]+t[r+1]:
        r += 1
    n = [t[l], t[_]-t[l], t[r]-t[_], t[-1]-t[r]]
    ans.append(max(n)-min(n))
print(min(ans))

Measured memory_bytes: 29008
#include<cstdio>
#include<cstring>
#define maxn 100005
using namespace std;
int n,k,Q,a[maxn];
inline int read(){
	int ret=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return ret*f;
}
int main(){
	n=read();k=read();Q=read();
	for (int i=1;i<=Q;i++) a[read()]++;
	for (int i=1;i<=n;i++)
	if (a[i]+k-Q>0) printf("Yes\n");else printf("No\n");
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> price(N);
    for (int i = 0; i < N; i++){
        cin >> price.at(i);
    }
    int max_price = price.at(0);
    for (int i = 1; i < N; i++){
        max_price = max(max_price, price.at(i));
    }
    int sum_price = 0;
    for (int i = 0; i < N; i++){
        sum_price += price.at(i);
    }
    int total = sum_price - max_price / 2;
    cout << total << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.entranceExamination();
    }

    private void entranceExamination() {
        try (Scanner scan = new Scanner(System.in)) {
            int t = Integer.parseInt(scan.next());
            int x = Integer.parseInt(scan.next());

            System.out.println((double)t / (double)x);
        }
    }
}


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

public class Main {
	
  public static void main(String[] args) {
	  FastReader in = new FastReader();
    
    int N = in.nextInt();
    Num[] original = new Num[N];
    Num[] sorted = new Num[N];
    
    for (int i = 0; i < N; i++) {
    	int n = in.nextInt();
    	original[i] = new Num(i, n);
    	sorted[i] = new Num(i, n);
    }
    
    Arrays.sort(sorted);
    Map<Integer, Integer> order = new HashMap<Integer, Integer>(); // Keeps index in original => index in sorted
    for (int i = 0; i < N; i++) {
    	order.put(sorted[i].index, i);
    }
    
    for (int i = 0; i < N; i++) {
    	int index = order.get(original[i].index);
    	
    	if (index < N / 2) {
    		System.out.println(sorted[N / 2].n);
    	} else {
    		System.out.println(sorted[N / 2 - 1].n);
    	}
    }
  }
}

class Num implements Comparable<Num> {
	int index;
	int n;
	
	public Num(int index, int n) {
		this.index = index;
		this.n = n;
	}

	@Override
	public int compareTo(Num o) {
		return this.n - o.n;
	}
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br = new BufferedReader(new
                 InputStreamReader(System.in));
    }

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

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

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

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

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

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

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

int main() {
    long long int n;
    cin >> n;

    vector<string> str{"3", "5", "7"};

    int idx = 0;

    for (int i = 2; i <= 10; i++){
        vector<string> str2;

        for (int j = idx; j < str.size(); j++) {
            str2.push_back("3" + str[j]);
            str2.push_back("5" + str[j]);
            str2.push_back("7" + str[j]);
        }
        idx = str.size();
        str.insert(str.end(), str2.begin(), str2.end());
    }

    vector<long long int> v(str.size());

    rep(i, str.size()){
        v[i] = stoll(str[i]);
    }

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

    rep(i, str.size()){
        str[i] = to_string(v[i]);
    }

    long long int cnt = 0;
    for (int i = 0; i < str.size(); i++) {
        string temp = str[i];

        if(stoll(temp)>n){
            break;
        }else{
            if((temp.find("3")<temp.size())&&(temp.find("5")<temp.size())&&(temp.find("7")<temp.size())){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 5800
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  string s;
  cin>>s;
  string c = "CODEFESTIVAL2016";
  int ans=0;
  for(int i = 0; i < 16; i++)
  {
    if(c[i] != s[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#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, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	int A, B;

	cin >> A >> B;

	if (A <= B * 2) {
		cout << 0 << endl;
	}
	else {
		cout << A-B*2 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////
map<ll,ll> mp;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  ll t=1;
  while(t--)
  {
    ll n,m;
    cin>>n>>m;
    priority_queue<ll> q;
    ll a;
    REP(i,n)
    {
        cin>>a;
        q.push(a);
    }
    while(m)
    {
        a=q.top();
        q.push(a/2);
        q.pop();
        m--;
    }
    ll ans=0;
    while(n--)
    {
        ans+=q.top();
        q.pop();
    }
    cout<<ans;
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define FOR(i,x,y) for(int i = x;i < y;i++)
using namespace std;

int ctoi(char c){
  string s = "0123456789";
  FOR(i,0,10)if(c == s[i])return i;
  return 0;
}

int op[] = {-1,1};

int main(){
  string S;
  cin >> S;
  int A = ctoi(S[0]);
  int B = ctoi(S[1]);
  int C = ctoi(S[2]);
  int D = ctoi(S[3]);
  FOR(i,0,2)FOR(j,0,2)FOR(k,0,2){
    if(A+op[i]*B+op[j]*C+op[k]*D == 7){
      cout << A;
      i ? cout << "+" : cout << "-";
      cout << B;
      j ? cout << "+" : cout << "-";
      cout << C;
      k ? cout << "+" : cout << "-";
      cout << D << "=7" << endl;
      i = 2;
      j = 2;
      k = 2;
    }
  }
}


Measured memory_bytes: 256
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
s=input()
ans=0
st=0
en=len(s)-1
while(st<en):
    if(s[st]!=s[en]):
        ans+=1 
    st+=1
    en-=1
print(ans)

Measured memory_bytes: 38380
#include <iostream>
#include <string>
#include <vector>
#define _USE_MATH_DEFINENS
#include <cmath>

using namespace std;

#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int n;
    cin >> n;

    if(n >= 100 && n <= 111) p(111)
    else if(n >= 112 && n <= 222) p(222)
    else if (n >= 223 && n <= 333) p(333)
    else if (n >= 334 && n <= 444) p(444)
    else if (n >= 445 && n <= 555) p(555)
    else if (n >= 556 && n <= 666) p(666)
    else if (n >= 667 && n <= 777) p(777)
    else if (n >= 778 && n <= 888) p(888)
    else if (n >= 889 && n <= 999) p(999);
}


Measured memory_bytes: 256
//Author:- Yatin Patel
//Mail:- yatinpatel.gt@gmail.com

#include <bits/stdc++.h>
#define FILEIN ifstream fin;fin.open("input.txt");
#define FILEOUT ofstream fout;fout.open("output.txt");

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

#define FAST ios::sync_with_stdio(false);ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> >
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))

#define MOD 1000000007
#define INF LONG_MAX
#define MINF LONG_MIN

ll power(ll x, unsigned ll y){
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}

//#define fin cin
//#define fout cout

int main(){

    FAST;
    ll n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1);
    return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    int ans = 0;
    REP(i,n) {
        int x; cin >> x;
        while (x % 2 == 0)
        {
            x /= 2;
            ans++;
        }
    }

    cout << ans << '\n';

    return 0;
}

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

using namespace std;

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

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

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

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

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,q;
    cin>>n;
    vi s(n);
    REP(i,n)cin>>s[i];
    cin>>q;
    vi t(q);
    REP(i,q)cin>>t[i];

    sort(ALL(s));
    s.erase(unique(ALL(s)), s.end());
    sort(ALL(t));
    
    int ans=0;
    REP(i,q){
        REP(j,n){
            if(t[i]<s[j]) break;
            if(t[i]==s[j]){
                ans++; break;
            }
        }
    }

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


Measured memory_bytes: 3208
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


signed main() {
    int N, H, W;
    cin >> N >> H >> W;
    cout << (N - H + 1) * (N - W + 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
using namespace std;
const long long int mod = 1e9 + 9;
#define mat vector< vector<long long int> >

mat matrix_product(const mat &A, const mat &B){
  int n = A.size(), m = B[0].size(), l = A[0].size();
  mat ret(n,vector<long long int>(m));
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < m; ++j){
      ret[i][j] = 0;
      for(int k = 0; k < l; ++k){
        ret[i][j] += (A[i][k]*B[k][j])%mod;
        ret[i][j] %= mod;
      }
    }
  }
  return ret;
}

mat matrix_pow(const mat &P, long long int N){
  mat ret(P.size(),vector<long long int>(P.size(),0)), t = P;
  for(int i = 0; i < P.size(); ++i) ret[i][i] = 1;
  int k = 0;
  while((1LL<<k) <= N){
    if((N>>k)&1LL){
      ret = matrix_product(ret,t);
    }
    ++k;
    t = matrix_product(t,t);
  }
  return ret;
}

int main(){
  long long int W, H, N;
  for(int i = 0; ; ++i){
    cin >> W >> H >> N;
    if(!H) break;
    long long int y;
    int x;
    map<long long int, vector<int> > M;
    for(int j = 0; j < N; ++j){
      cin >> x >> y;
      M[y-1].push_back(x-1);
    }
    long long int t = 0;
    mat ans(1,vector<long long int>(W,0)), A(W,vector<long long int>(W));
    for(int i = 0; i < W; ++i){
      A[i][i] = 1;
      if(i > 0) A[i][i-1] = 1;
      if(i < W-1) A[i][i+1] = 1;
    }
    ans[0][0] = 1;
    for(map<long long int, vector<int> >::iterator itr = M.begin(); itr != M.end(); ++itr){
      long long int d = itr->first - t;
      ans = matrix_product(ans,matrix_pow(A,d));
      vector<int> V = itr->second;
      for(int j = 0; j < V.size(); ++j){
        ans[0][V[j]] = 0;
      }
      t = itr->first;
    }
    long long int d = H - 1 - t;
    ans = matrix_product(ans,matrix_pow(A,d));
    printf("Case %d: %lld\n", i + 1, ans[0][W-1]);
  }
  return 0;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
#define MOD 1000000007

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;}
template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){return a/GCD(a,b)*b;}

const int INF=1e9;
const double eps=0.0000000001;

int main(){
  int n;
  cin >> n;
  int a[1000000];
  int d[1000000]={0};
  FOR(i,n){
    cin >> a[i];
    d[a[i]]++;
  }
  int ans=0;
  FOR(i,99999){
    chmax(ans,d[i]+d[i+1]+d[i+2]);
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 8064
/**
 * author: Behradm
 * Created: 2020.09.13 16:25:12
 * In The Name of God
**/
#include <bits/stdc++.h>

using namespace std;

int main() {   
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x;
  cin >> x;
  cout << (x == 1 ? 0 : 1) << '\n';
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>

using namespace std;

int main() {
    int n, max = 0;
    string s;
    cin >> n >> s;
    for (int i = 1; i < n - 1; ++i) {
        string x = s.substr(0, i), y = s.substr(i);
        int cnt = 0;
        for (char c = 'a'; c <= 'z'; ++c) {
            if (x.find(c) != string::npos && y.find(c) != string::npos) ++cnt;
        }
        if (max < cnt) max = cnt;
    }
    cout << max << endl;
    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n), p(n), q(n);
  rep(i, n) a[i] = i + 1;
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];
  sort(a.begin(), a.end());
  int A = 0, B = 0, cnt = 0;
  do
  {
    cnt++;
    int cntA = 0, cntB = 0;
    rep(i, n)
    {
      if (a[i] == p[i])
        cntA++;
      if (a[i] == q[i])
        cntB++;
    }
    if (cntA == n)
      A = cnt;
    if (cntB == n)
      B = cnt;
  } while (next_permutation(a.begin(), a.end()));
  cout << abs(A - B) << endl;
  return 0;
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  LL n, m;
  Solver2(LL n, LL m) : n(n), m(m){};

  void solve() {
    cout << lcm(n, m) << endl;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, m;
  std::cin >> n >> m;

  Problem::Solver2 sol(n, m);
  sol.solve();
  return 0;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self,n):
        self.n=n
        self.parents=[-1]*n
        self.rank=[0]*n

    def find(self,x):
        if self.parents[x]<0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]

    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)

        if x==y:
            return 

        if self.rank[x]<self.rank[y]:
            self.parents[y]+=self.parents[x]
            self.parents[x]=y
        else:
            self.parents[x]+=self.parents[y]
            self.parents[y]=x

            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1

    def are_same(self,x,y):
        return self.find(x)==self.find(y)

    def element_count(self,x):
        x=self.find(x)
        return -self.parents[x]

    def group_count(self):
        count=0
        for e in self.parents:
            if e<0: count+=1
        return count

from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N,M=map(int,readline().split())
    a=[0]*M
    b=[0]*M
    for i in range(M):
        a[i],b[i]=map(lambda x:int(x)-1,readline().split())
    
    res=0
    for i in range(M):
        t=UnionFind(N)
        for j in range(M):
            if j==i:
                pass
            else:
                t.union(a[j],b[j])
        if t.group_count()==2:
            res+=1
    
    print(res)

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("inputh.txt", "r", stdin);
    freopen("outputh.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
   // cin>>test;
    while(test--)
    {

            ll n;
            cin>>n;
            ll m[n+1][3],t[n+1][3];
            for(int j=0;j<3;j++)
                t[0][j]=0;
            for(int i=1;i<=n;i++)
                for(int j=0;j<=2;j++)
                cin>>m[i][j];
            for(int i=1;i<=n;i++)
            {
                for(int j=0;j<=2;j++)
                {
                    t[i][j]=m[i][j]+max(t[i-1][(j+1)%3],t[i-1][(j+2)%3]);
                }
            }
            cout<<max(max(t[n][0],t[n][1]),t[n][2]);
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not




Measured memory_bytes: 8232
MOD = 10**9+7

S = input()
N = len(S)
dp = [[0]*4 for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    s = S[i]
    for j in range(4):
        if s == "?":
            dp[i+1][j] += dp[i][j]*3
        else:
            dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= MOD
        if j < 3 and (s == "?" or s == "ABC"[j]):
            dp[i+1][j+1] += dp[i][j]
            dp[i+1][j+1] %= MOD
print(dp[N][3]%MOD)


Measured memory_bytes: 27584
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
ans = [0]*N
for i in range(N):
    for j in range(i+1,N):
        ans[min(abs(i-j), abs(X-i)+abs(Y-j)+1)] += 1
for x in ans[1:]:
    print(x)

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>

using namespace std;

int n;

int main() {

	cin >> n;
	vector<long long> data(n);

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

	if (n == 2)
	{
		cout << abs(data[1] - data[0]) << endl;
		return 0;
	}

	sort(data.begin(), data.end(), greater<int>());

	long long ans = 0;
	if (n == 3)
	{
		ans = max(data[1] + data[0] - data[2] * 2,
				data[0] * 2 - data[1] - data[2]);
		cout << ans << endl;
		return 0;
	}

	if ((n&1) == 0)
	{
		int i = 0;
		for ( ; i < n/2 - 1; ++i)
			ans += data[i]*2;

		ans += data[i] - data[i+1];
		i += 2;
		for ( ; i < n; ++i)
			ans -= data[i]*2;

	} else {

		long long tmp = 0;
		int i = 0;
		for ( ; i < n/2 - 1; ++i)
			tmp += data[i]*2;

		tmp += data[i] + data[i+1];
		i += 2;
		for ( ; i < n; ++i)
			tmp -= data[i]*2;

		ans = tmp;
		tmp = 0;
		i = 0;
		for ( ; i < n/2; ++i)
			tmp += data[i]*2;

		tmp += - data[i] - data[i+1];
		i += 2;
		for ( ; i < n; ++i)
			tmp -= data[i]*2;

		// printf("tmp:%lld\n", tmp);
		ans = max(ans, tmp);
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

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

    int n,num,ans=0;
    cin>>n;

    for(int i=1;i<=n;i++){
        cin>>num;

        if(i%2==1 && num%2==1){
            ans++;
        }
    }
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3604
import math

def main():
    N, D = map(int, input().split())
    X = [list(map(int, input().split())) for _ in range(N)]
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            v = sum((y - z) ** 2 for y, z in zip(X[i], X[j]))
            dist = round(math.sqrt(v))
            if v == dist ** 2:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62556
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int x = Integer.parseInt(in.next());
            int ans = 10 - x / 200;

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 35740
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimmize("unroll-loops")

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "-1\n"; return;}

const int N = 1e6 + 7;

int a[N];
bool p[N];
bool is_comp[N];
vector <int> primes;

void precalc() {
    for (int i = 2; i < N; ++i) {
        if (!is_comp[i]) {
            primes.pb(i);
            for (ll j = (ll)i * i; j < N; j += i)
                is_comp[j] = 1;
        }
    }
}

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

void solve() {
    int n; cin >> n;
    bool pwc = 1;
    int g;
    loop(i, n) {
        int x; cin >> x;
        if (i == 0)
            g = x;
        else
            g = gcd(g, x);
        if (pwc) {
            for (int i = 2; (ll)i * i <= x; ++i) {
                if (x % i == 0) {
                    if (p[i]) {
                        pwc = 0; break;
                    }
                    p[i] = 1;
                    while (x % i == 0)
                        x /= i;
                }
            }
            if (x > 1) {
                if (p[x])
                    pwc = 0;
                p[x] = 1;
            }
        }
    }
    cout << (pwc ? "pairwise coprime" : (g == 1 ? "setwise coprime" : "not coprime"));
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 4636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	vector<ll> sum(n + 1);
	rep(i, n) sum[i + 1] = sum[i] + a[i];
	ll ans = INF;
	for (int i = 1; i < n; i++) chmin(ans, abs(sum[i] * 2 - sum[n]));
	cout << ans << '\n';
}

Measured memory_bytes: 3328
h,w = (int(i) for i in input().split())
d = {}
nei = [-101,-100,-99,-1,1,99,100,101]
for i in range(h):
  s = input()
  for j in range(w):
    d[(i+1)*100+j+1] = s[j]
for k in d:
  if d[k] == '.':
    cnt = 0
    for l in nei:
      if k+l in d:
        if d[k+l] == '#':
          cnt += 1
    d[k] = cnt
for i in range(h):
  ans = ''
  for j in range(w):
    ans += str(d[(i+1)*100+j+1])
  print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ins insert
#define Pq priority_queue
#define u_set unordered_set
#define MOD 1000000007
#define MAXN 100001
#define set_val(arr,v) memset(arr, v, sizeof(arr))
#define FOR(i,from,to) for(int i=from; i<to; i++)
#define FOL(i,from,to) for(int i=from; i>=to; i--)
#define B() begin()
#define E() end()
#define F first
#define S second


int main() {
	ios::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
	ll n,k;
	cin >> n >> k;
	vector<ll> h(n);
	for(auto& x : h) cin >> x;

	ll sum = 0;
	sort(h.B(), h.E());
	FOR(i,0,n-k) {
		sum += h[i];
	}
	cout << sum << endl;
	return 0; 
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;
vector<ll> h, dp;
ll k;

ll rec(int i) {
  if (dp[i] < INF) return dp[i];
  if (i == 0) return 0;

  ll res = INF;

  rep(i, k) {
    if (i-k >= 0) chmin(res, dp[i-k] + abs(h[i] - h[i-k]));
  }

  return dp[i] = res;
}

int main() {
  ll n;
  cin >> n >> k;
  h.resize(n);

  rep(i, n) cin >> h[i];
  dp.assign(n, INF);

  dp[0] = 0;

  rep(i, n) {
    repI(j, 1, k+1) {
      if (i - j >= 0)
        chmin(dp[i], dp[i-j] + abs(h[i]-h[i-j]));
      else break;
    }
  }
  cout << dp[n-1] << endl;

  return 0;
}


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

#define      pb    push_back
#define      ff    first
#define      ss    second
#define      ll    long long int
#define      endl  "\n"
#define      FASTIO        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define      TEST    ll t ; cin >> t ; while( t -- )


//------------------------------------------------------------------------//

#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)

//------------------------------------------------------------------------//

const ll big = 10e15 ;

int  main (  ) {

    FASTIO ;

    ll a , b , c , k , ans = 0 ;
    cin >> a >> b >> c >> k ;

    if( a >= k ){
        cout <<  min( k , a ) ;
    }
    else{
        ans = a ;
        k -= a ;

        if( k <= b ) cout << ans ;
        else {
            k -= b ;

            ans -= min( k , c )  ;

            cout << ans ;
        }
    }

    return  0 ;
}


Measured memory_bytes: 3648
#include<stdio.h>
int main(){
  int a,b,c,max;
  scanf("%d%d%d",&a,&b,&c);
  if(a<b) {if(b<c) max=c;
           else max=b;}
  else {if(a<c)max=c;
        else max=a;}
  printf("%d",a+b+c-max);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define U(i, a, b) for (int i = (a); i <= (b); ++i)
#define D(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;
int gi() {
  int f = 1, x = 0; char ch = getchar();
  while (ch < '0' || ch > '9') { if (ch == '-') f = -f; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return f * x;
}
typedef long long LL;
typedef pair<int,int> pi;

int x[6];
int main() {
	U(i, 1, 6) {
		cin >> x[i];
		if (x[i] == 0) return cout << i, 0;
	}
  return 0;
}

Measured memory_bytes: 3624
// C++ program to compute mod of a big number represented
// as string
#include<iostream>
using namespace std;
typedef  long long  ll;

// Function to compute num (mod a)
int mod(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

// Driver program
int main()
{
    string num;

    string str;
    cin>>str;
    ll n=mod(num, 9);

    ll sum=0;


    for(ll i=0;str[i];i++)
    {
        sum+=(str[i]-'0');

    }

    if(sum%9==0 && n==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3720
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"3 2
#.#
.#.
#.#
#.
.#"# => r#"Yes"#,

r#"4 1
....
....
....
....
#"# => r#"No"#,

r#"3 2
###
.#.
#.#
#.
.#"# => r#"Yes"#,

r#"3 2
###
.##
#.#
#.
.#"# => r#"No"#,

}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize, m: usize,
        a: [chars; n],
        b: [chars; m]
    }
    // println!("{:?}", a);
    // println!("{:?}", b);
    let mut ans = "No";

    'main: for ax in 0..n {
        for ay in 0..n {
            if a[ax][ay] != b[0][0] {
                continue;
            }
            // println!("--------------------");


            let mut cnt = 0;
            for bx in 0..m {
                for by in 0..m {
                    if ax + bx >= n || ay + by >= n {
                        continue;
                    }
                    // print!("a[{}][{}]={}, b[{}][{}]={}:", ax + bx, ay + by, a[ax + bx][ay + by], bx, by, b[bx][by]);

                    if a[ax + bx][ay + by] != b[bx][by] {
                        // println!(" ng");
                        continue;
                    }
                    cnt += 1;
                    // println!(" ok");
                }
            }

            if cnt == m * m {
                ans = "Yes";
                break 'main;
            }
        }
    }

    ans.to_string()
}

Measured memory_bytes: 4352
h1,m1,h2,m2,k=map(int,input().split())
tot=0
if m2>=m1:
	tot+=(m2-m1)+60*(h2-h1)
else:
	h2=h2-1
	m2=60+m2
	tot+=(h2-h1)*60+(m2-m1)
	
print(max(0,tot-k))


Measured memory_bytes: 61756
n=int(input())
if n==0:
  print('0')
else:
  ls=[]
  while(n!=0):
    ls.append(str(n%2))
    n=-1*(n-n%2)//2
  ls.reverse()
  oneLinerString="".join(ls)
  print(oneLinerString)

  
    


Measured memory_bytes: 2940
#include <iostream>
#define TYPE long int
using namespace std;

int main(){
  int n;
  TYPE a[5010], s[5010];
  while(cin>>n && n){
    for( int i=1;i<=n;i++ )
      cin >> a[i];

    TYPE mx = a[1];
    for( int i=1;i<=n;i++ ){
      s[i] = a[i];
      mx = max(mx, s[i]);
      for( int j=i+1;j<=n;j++ ){
	s[j] = s[j-1] + a[j];
	mx = max(mx, s[j]);
      }
    }

    cout << mx << endl;
  }
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()

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

  int A, B;
  cin >> A >> B;

  if(A <= 8 && B <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int length;
  int n[100];
  int i,j;
  int tmp;
  int flag;
  int count = 0;

  scanf("%d", &length);
  for(i = 0; i < length; i++)
    {
      scanf("%d",&n[i]);
    }
  
  for(i = 0; i < length; i++)
    {
      flag = 0;
      for(j = length - 1; j > i; j--)
	{
	  if(n[j - 1] > n[j]) 
	    {
	      tmp = n[j];
	      n[j] = n[j - 1];
	      n[j - 1] = tmp;
	      flag = 1;
	      count++;
	    }
	}
      if(flag == 0) break;
    }

  for(i = 0; i < length - 1; i++)
    {
      printf("%d ", n[i]);
    }
  printf("%d\n%d\n", n[length - 1], count);

  return 0;
}

Measured memory_bytes: 600
n, k, c = map(int, input().split())
s = input()

foward = [0] * (k + 1)
backward = [0] * (k + 1)

# foward check
day = 1
i = 0
while i < n and 0 < day <= k:
    if s[i] == "o":
        foward[day] = i
        i += c
        day += 1
    i += 1

# backward check
day = k
i = n - 1
while 0 <= i and 0 < day <= k:
    if s[i] == "o":
        backward[day] = i
        i -= c
        day -= 1
    i -= 1

for day in range(1, k + 1):
    if foward[day] == backward[day]:
        print(foward[day] + 1)


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

int main(){
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k=0;
    scanf("%d",&k);
    printf("%d",a[k-1]);
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X, N;
	cin >> X >> N;
	int p[N];
	for(int i=0;i<N;i++){
		cin >> p[i];
	}
	int ans = 0;
	int MIN = 1000;
	for(int i=0;i<=101;i++){
		if(abs(X - i) < MIN){
			int chk = 0;
			for(int j=0;j<N;j++){
				if(i == p[j])chk++;
			}
			if(chk == 0){
				ans = i;
				MIN = abs(X - i);
			}
		}
	}
	cout << ans << endl;
}


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

using namespace std;

int main() {
  int x, n; cin >> x >> n;
  unordered_set<int> ps;
  for(int i = 0; i < n; ++i) {
    int p; cin >> p;
    ps.insert(p);
  }
  for(int d = 0; ; ++d) {
    if(ps.count(x - d) == 0) {
      printf("%d\n", x - d);
      break;
    }
    if(ps.count(x + d) == 0) {
      printf("%d\n", x + d);
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3736
import bisect
import heapq
import sys
import queue


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class V:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)

    def get(self):
        return self.v


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    N = int(input())
    D = {}
    for _ in range(N):
        s = input().strip()
        D[s] = D.setdefault(s, 0) + 1

    vm = max(D.values())
    ks = [k for k, v in D.items() if v == vm]
    ks.sort()
    print("\n".join(ks))


if __name__ == "__main__":
    main()


Measured memory_bytes: 35028
import heapq

N = int(raw_input())
v = list(map(int,raw_input().split()))
heapq.heapify(v)
for i in range(0,N-1):
  v1 = heapq.heappop(v)
  v2 = heapq.heappop(v)
  
  heapq.heappush(v, (v1+v2)/float(2))
print v[0]

Measured memory_bytes: 2692
N = input()
t_list = list(map(int,input().split()))

c = 0
for i in range(len(t_list)):
  for j in range(len(t_list)):
    if (i == j):
      pass
    else:
      c += t_list[i] * t_list[j]
print(c // 2)
  


Measured memory_bytes: 2940