akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int A,B,C,X;
  cin>>A>>B>>C;
  if(A==B) X=C;
  else if(B==C) X=A;
  else X=B;
  cout<<X;
return 0;}

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

#define MAX(a , b) (a > b? a : b)
#define MIN(a , b) (a < b? a : b)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;

const double pi = 2.0*acos(0.0);

ll fun (int a,int b,int c)
{
    ll s = __gcd(a,__gcd(b,c));
    return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);

    int n;
    cin >> n;
    ll sum = 0;

    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=n;j++)
        {
            for (int k=1;k<=n;k++)
            {
               sum = sum + fun(i,j,k);
            }
        }
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<climits>
#include<string>
using namespace std;
#define lli long long int
#define f first
#define s second
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define pr(n) printf("%d",n);
#define prl(n) printf("%lld",n);
#define nl printf("\n");
#define all(c) (c).begin(), (c).end()
#define sz(a) int((a).size())
#define FN(i,n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++))
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
			cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
			const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
void optimizeIO()
{
	        ios_base:: sync_with_stdio(false);
		        cin.tie(NULL);
}

int main()
{
	int n,k;
	cin >> n >> k;
	int arr[111111];
	FN(i,n){
		cin >> arr[i+1];
	}

	int cost[111111];
	cost[1] = 0;
	cost[2] = abs(arr[2] - arr[1]);
	for(int i = 3; i <= n; i++)
	{
		int tmp = max(i-k,1);
		int cst = 1000000010;
//		cout << cst;
		for(int j=i-1;j>=tmp;j--)
			cst = min(cst, cost[j] + abs(arr[i] - arr[j]));
		cost[i] = cst;
	}
	cout << cost[n];
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(){
    int a, count, i;
    count = 0;
    char str[100];
    scanf("%d", &a);
    scanf("%s",str);
    for(i=0;i <= a - 2;i++) {
        if(str[i]=='A') {
            if(str[i+1] == 'B'){
                if(str[i+2] == 'C'){
                    count++;
                }
            }
        }
    }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 128
function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s[this._y++].split(" ");
    return f?s:s.map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};
var o=new gets(require("fs").readFileSync("/dev/stdin","utf8"));
var comb = [[1]];
var mod = 998244353;
function abmod(){var a=arguments,r=a[0],i=1;for(;i<a.length;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i++])%mod;return r;}

function fcomb(n,r){
  r++;
  for(var i = 1; i < n; i++){
    comb[i] = [1];
    var m = Math.min(i,r)
    for(var j = 1; j < m; j++){
      comb[i][j] = comb[i-1][j] + comb[i-1][j-1];
      comb[i][j] %= mod;
    }
    comb[i][i] = 1;
  }
}

console.log(main());
function main(){
  var k = o.a();
  var n = o.a();
  var ans = [];
  var nk1 = n + k - 1;
  fcomb(k + n, Math.max(n, k >> 1));
  for(var i = 0; i < k; i++){
    var u = i + 2 >> 1, v = Math.min(u, n >> 1), w = 1;
    ans[i] = 0;
    for(var j = 0; j <= v; j++){
      ans[i] += abmod(comb[u][j], comb[nk1-2*j][n-2*j]) * w;
      ans[i] %= mod;
      w *= -1;
    }
    if(ans[i] < 0)ans[i] += mod;
    i++;
    if(i < k)ans[i] = ans[i-1];
  }
  var k2 = 2*k-2;
  for(i = k; i <= k2; i++)ans[i] = ans[k2-i];
  return ans.join("\n");
}

Measured memory_bytes: 181060
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

memo = {}

for i in range(n):
    for j in range(n):
        if i != j:
            p1, q1 = info[i]
            p2, q2 = info[j]
            p, q = p1 - p2, q1 - q2
            
            if p not in memo:
                memo[p] = {}
            if q not in memo[p]:
                memo[p][q] = 1
            else:
                memo[p][q] += 1

ans = 0
for i in memo:
    for j in memo[i]:
        ans = max(ans, memo[i][j])
print(n - ans)

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

int main()
{
    int n,t;
    int flag=0;
    int minn=1001;
    cin>>n>>t;
    for(int i=1; i<=n; i++)
    {
        int a,b;
        cin>>a>>b;
        if(b<=t)
        {
            if(a<minn)
            {
                minn=a;
                flag=1;
            }

        }

    }
    if(flag==0)
        cout<<"TLE"<<endl;
    else
        cout<<minn<<endl;
    return 0;
}


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



int main(){
    int N,M ,ans =0;
    cin >> N >> M;
    ans = N*(N-1)/2 + M*(M-1)/2;    
    cout << ans << endl;
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int n, ans; 

int main()
{
	gi(n);
	for (int i = 1; i <= n; ++i)
	{
		int x = F();
		if (x & 1) ++ans;
	}
	if (ans & 1) puts("NO");
	else puts("YES");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,x;

int main(){
  ll ans=0;
  cin >> n ;

  vi a(100),b(100);
  ll x=26;
  for(ll i=0;i<100;i++){
    a[i]=x;
    x=x*26;
  }
  
  ll an=0;
  for(ll i=1;i<100;i++){
    b[i]=a[i-1]+b[i-1];
    an=i;
    if (b[i]>(1000000000000001*26))break;
    //cout<<b[i]<<endl;
  }
  an++;

  

  for(ll i=0;i<an;i++){
    if ((n>b[i])&(n<=b[i+1]))
    {
      n-=b[i]+1;
      an=i+1;
      break;
    }
  }


  string anss="";
  for(ll k=0;k<an;k++){
    anss+=" ";
  }
  
  for(ll k=0;k<an;k++){
    anss[an-k-1]=97+n%26;
    n/=26;
  }






  
  cout<<anss<<endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define mn(a, b) (a < b ? a : b)
#define mx(a, b) (a > b ? a : b)
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
#define base 331

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int const MAXn = 1e5 + 2;

int dp[MAXn][3];

int main(){

    //freopen(".in","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int i = 1; i <= n; i++){
        int a, b, c;
        cin>>a>>b>>c;
        if(i == 1){
            dp[1][0] = a, dp[1][1] = b, dp[1][2] = c;
            continue;
        }
        dp[i][0] = mx(dp[i][0], mx(dp[i - 1][1], dp[i - 1][2]) + a);
        dp[i][1] = mx(dp[i][1], mx(dp[i - 1][0], dp[i - 1][2]) + b);
        dp[i][2] = mx(dp[i][2], mx(dp[i - 1][0], dp[i - 1][1]) + c);
    }
    cout<<mx(dp[n][0], mx(dp[n][1], dp[n][2]));
    return 0;
}


Measured memory_bytes: 1408
N, M, Q = map(int, input().split())

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

for _ in range(M):
    l, r = map(int, input().split())
    range_array[l - 1][r - 1] += 1

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum
'''
for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum
'''
for _ in range(Q):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    sum = 0
    for k in range(p, q + 1):
        sum += range_array[k][q]
    print(sum)


Measured memory_bytes: 57688
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int n; cin >> n;
    vector<pair<int, int>> p(n);
    
    REP(i, n) {
        cin >> p[i].first >> p[i].second;
    }

    sort(p.begin(), p.end(), [](auto i, auto j) {
        return i.second < j.second;
    });

    ll t = 0;
    REP(i, n) {
        t += p[i].first;

        if(t > p[i].second) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
template<typename T>
struct edge{
    int f,t;
    T c;
    int id;
    edge(){};
    edge(int f,int t,T c,int id = 0):f(f),t(t),c(c),id(id){};
    bool operator< (const edge &s){
        return c < s.c;
    }
};

template<typename T>
struct graph{
    std::vector<std::vector<edge<T> > > data;
    graph(int v):data(v){};
    void add_edge(edge<T> &e){
        data[e.f].push_back(e);
    }
    void add_edge(int f,int t,T c){
        data[f].emplace_back(f,t,c);
    }
    size_t size(){
        return data.size();
    }
    std::vector<edge<T>> make_edges(){
        std::vector<edge<T>> r;
        for(auto &i:data)std::copy(i.begin(),i.end(),std::back_inserter(r));
        return r;
    }
};

template<typename T>
std::vector<T> spfa(graph<T> &g,int s){
    //queue
    std::queue<int> q;
    q.emplace(s);
    //data init
    std::vector<T> data(g.size(),std::numeric_limits<T>::max()/4);
    std::vector<bool> isq(g.size(),false);
    std::vector<int> count(g.size(),0);
    data[s] = (T)0;isq[s] = true;++count[s];
    //solve
    while(!q.empty()){
        int cur = q.front();q.pop();
        isq[cur] = false;
        for(auto &e:g.data[cur]){
            if(data[e.f] + e.c < data[e.t]){
                data[e.t] = data[e.f] + e.c;
                if(++count[e.t]>=g.size()){
                    fill(data.begin(),data.end(),std::numeric_limits<T>::min());
                    return data;
                }
                if(!isq[e.t]){
                    q.push(e.t);
                    isq[e.t] = true;
                }
            }
        }
    }
    return data;
}

template<typename T>
std::vector<T> bellmanford(graph<T> &g, int s){
    T INF = std::numeric_limits<T>::max()/4;
    std::vector<T> data(g.size(),INF);
    data[s] = 0;
    for(int i=0;i<g.size()-1;i++){
        for(auto &v:g.data)for(auto &e:v){
            if(data[e.f]==INF)continue;
            data[e.t] = std::min(data[e.f] + e.c,data[e.t]);
        }
    }
    for(auto &v:g.data)for(auto &e:v){
        if(data[e.f]==INF)continue;        
        if(data[e.f] + e.c < data[e.t]){
            fill(data.begin(),data.end(),std::numeric_limits<T>::min());
            break;
        }
    }
    return data;
}

int main(){
    using namespace std;
    using i64 = long long int;
    int v,e,r;
    cin >> v >> e >> r;
    graph<i64> g(v);
    int f,t;i64 d;
    for(int i=0;i<e;++i){
        cin >> f >> t >> d;
        g.add_edge(f,t,d);
    }
    vector<i64> res = spfa(g,r);
    i64 INF = numeric_limits<i64>::max()/4;
    i64 NEG = numeric_limits<i64>::min();
    for(auto &x:res){
        if(x==NEG){
            cout << "NEGATIVE CYCLE" << endl;
            break;
        }
        if(x>=INF)cout << "INF" << endl;
        else cout << x << endl;
    }
}


Measured memory_bytes: 3204
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#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(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll a, std::string s) {
  if (a >= 3200)
    cout << s << endl;
  else
    cout << "red" << endl;
}

int main() {
  ll a;
  scanf("%lld", &a);
  std::string s;
  std::cin >> s;
  solve(a, s);
  return 0;
}


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

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

	ll s; cin >> s;
    ll ans = 0;
  for(int n = 1; n <= s/3; n++){
    ans = (ans + COM(s-2*n-1, n-1))%MOD;
	} 
    
  cout << ans << endl;
   return 0;
}


Measured memory_bytes: 3692
package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}


Measured memory_bytes: 1100
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int del;

int main(void) {
    string s;
    cin >> s;
    int n = (int)s.size();

    int S = 0;
    rep(i, 0, n) {
        if (s[i]=='S') S++;
        else {
            if(S>0) {
                del+=2;
                S--;
            }
        }
    }
    


    cout << n-del << endl;

	return 0;
}


Measured memory_bytes: 640
#include <iostream>  
#include <algorithm> 
#include <string> 
#include <cstdlib>
using namespace std;
int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(abs(x-b) > abs(x-a)){
    cout << "A" << endl;
  }
  else{
    cout << "B" << endl;
  }
}

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

int main()
{
    int n,x,ans;

    while(1){
        cin>>n>>x;
        if(n==0&&x==0)break;

        ans=0;

        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x)ans++;
                }
            }
        }
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 3088
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int w[100],b[21],e[21],s[21],m,n,y,wmn,bmn;
  for(;;){
    cin>>m>>n;
    if(m+n==0)
      break;
    y=0;
    for(i=0;i<n;i++){
      cin>>w[i];
      y=max(y,w[i]);
    }
    i=0;
    j=0;
    s[i]=w[j];
    b[i]=j;
    e[i]=j;
    for(j++;j<n;j++){
      if(s[i]+w[j]<=y){
	s[i]+=w[j];
	e[i]=j;
      }else{
	i++;
	s[i]=w[j];
	b[i]=j;
	e[i]=j;
	if(i==m)
	  break;	
      }
    }
    if(j!=n){
      for(;;){
	wmn=y;
	for(i=0;i<m;i++){
	  if(s[i]+w[b[i+1]]-y<wmn){
	    wmn=s[i]+w[b[i+1]]-y;
	    bmn=i;
	  }
	}
	y+=wmn;
	i=bmn;
	j=e[bmn];
	for(j++;j<n;j++){
	  if(s[i]+w[j]<=y){
	    s[i]+=w[j];
	    e[i]=j;
	  }else{
	    i++;
	    s[i]=w[j];
	    b[i]=j;
	    e[i]=j;
	    if(i==m)
	      break;	  
	  }
	}
	if(j==n)
	  break;
      }
    }
    cout<<y<<endl;
  }
  return 0;
}    

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

using namespace std;

int main(){
  int h1, h2, m1, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int t1 = h1*60 + m1, t2 = h2*60 + m2;
  if(t1>t2)t2 += 24*60;
  cout << max(0, t2 - t1 - k) << endl;
}



Measured memory_bytes: 3632
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.channels.NonWritableChannelException;
import java.util.*;

 
public class Main {
	static final long MOD1=1000000007;
	static final long MOD2=998244353;
	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(System.out);
		InputReader sc=new InputReader(System.in);
		double n=sc.nextDouble();
		double m=sc.nextDouble();
		double d=sc.nextDouble();
		if (d==0) {
			System.out.println((m-1)/n);
		}else {
			System.out.println(((m-1)*2*(n-d))/(n*n));
		}
	}
		static class InputReader { 
		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;
		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}
 
		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}
 
		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}
 
		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}
 
		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}
 
		public boolean hasNext() {
			skip();
			return hasNextByte();
		}
 
		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
 
		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
 
		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 33216
#include <bits/stdc++.h>
#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 OUT(s) cout << s << "\n";

int N;
using namespace std;
// https://atcoder.jp/contests/abc162/tasks
void Main()
{
    string tmp = to_string(N);
    int a = tmp.find("7");
    if (a == -1) {
        OUT("No");
    } else {
        OUT("Yes");
    }

}

int main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
	// cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

constexpr int MAX_N = 100000;
int par[MAX_N];
int rank[MAX_N];
int sz[MAX_N];

void init(int n)
{
  for (int i = 0; i < n; ++i)
  {
    par[i] = i;
    rank[i] = 0;
    sz[i] = 1;
  }
}

int find(int x)
{
  if (par[x] == x)
    return x;
  else
    return par[x] = find(par[x]);
}

int size(int x)
{
  return sz[find(x)];
}

void unite(int x, int y)
{
  x = find(x);
  y = find(y);
  if (x == y)
    return;
  if (rank[x] < rank[y])
  {
    par[x] = y;
    sz[y] += sz[x];
  }
  else
  {
    par[y] = x;
    sz[x] += sz[y];
    if (rank[x] == rank[y])
      ++rank[x];
  }
}

bool same(int x, int y)
{
  return find(x) == find(y);
}

int main()
{
  long long N, M;
  std::cin >> N >> M;
  std::vector<std::pair<int, int>> edges(M);
  for (auto& edge: edges)
    std::cin >> edge.first >> edge.second;

  init(N);
  int i = M - 1;
  std::vector<long long> ans(M);
  ans[i] = (N * (N - 1)) / 2;
  for (i = M - 1; i > 0; --i)
  {
    int x = edges[i].first;
    int y = edges[i].second;
    if (same(x, y))
    {
      ans[i - 1] = ans[i];
    }
    else
    {
      int sx = size(x);
      int sy = size(y);
      unite(x, y);
      ans[i - 1] = ans[i] - sx*sy;
    }
  }

  for (auto& val: ans)
    std::cout << val << "\n";
  std::cout << std::flush;

  return 0;
}



Measured memory_bytes: 4096
/* ex5_3
   moka223711 */

#include <stdio.h>
#define row 101
#define col 101

int main(void){
    int height, width, i, j, black_r[row] = {0}, black_c[col] = {0}, id = 0;
    char sq[row][col];
    scanf("%d %d", &height, &width);
    for(i = 0; i < height; i++){
        for(j = 0; j < width; j++){
            scanf(" %c", &sq[i][j]);
            if(sq[i][j]=='#'){
                black_r[i] = 1;
                black_c[j] = 1;
            }
        }
    }
    for(i = 0; i < height; i++){
        for(j = 0; j < width; j++){
            if(black_r[i] == 0){
                id = 0;
                continue;
            }
            if(black_c[j] == 1){
                id = 1;
                printf("%c", sq[i][j]);
            }
        }
        if(id == 1){
            printf("\n");
        }
    }
    
    return 0;
}


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

int main() {
    long long N, A, B;
    cin >> N >> A >> B;

    long long ans = 0;
    if (N == 1 && A == B) ans = 1;
    else if (N == 1 && A != B) ans = 0;
    else if ( A > B) ans = 0;
    else ans = (N - 2) * (B - A) + 1;
    cout << ans << endl;
}

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

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll a[4];
	rep(i,0,4){
		cin >> a[i];
	}
	sort(a,a+4);
	if(a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9) cout << "YES";
	else cout << "NO";
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


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

using namespace std;

const int N=1e5+5,MOD=1e9+7;

typedef long long ll;

int n,c,u,m,z,v,w,k,tc,ans,root[N];

vector<int> g[N];

bool vis[N];

int Find(int u){
    if (root[u]==u)
        return u;
    return root[u]=Find(root[u]);
}

int main() {
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)
        root[i]=i;
    while(m--){
        scanf("%d%d%d",&u,&v,&z);
        g[--u].push_back(--v);
        g[v].push_back(u);
        int _u=Find(u),_v=Find(v);
        if (_u!=_v)
            root[_u]=_v;
    }
    for(int i=0;i<n;i++)
        ans+=root[i]==i;
    printf("%d",ans);
}


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

int main() {
    int n;
    cin >> n;
    priority_queue<double> vs;
    rep(i, n) {
        int v;
        cin >> v;
        vs.push(-v);
    }
    rep(i, n-1) {
        double out1, out2;
        out1 = -vs.top(); vs.pop();
        out2 = -vs.top(); vs.pop();
        vs.push(-(out1 + out2) / 2);
    }
    cout << -vs.top() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

LL n,t,ans = 0;
LL w[3005],v[3005];
LL dp1[3005][3005] = {0},dp2[3005][3005] = {0};

int main(){
	cin >> n >> t;
	for(LL i = 1;i <= n;i ++) cin >> w[i] >> v[i];
	
	for(LL i = 1;i <= n;i ++){
		for(LL j = 0;j <= t;j ++){
			dp1[i][j] = dp1[i - 1][j];
			if(j >= w[i]) dp1[i][j] = max(dp1[i][j],dp1[i - 1][j - w[i]] + v[i]);
		}
	}
	for(LL i = n;i >= 1;i --){
		for(LL j = 0;j <= t;j ++){
			dp2[i][j] = dp2[i + 1][j];
			if(j >= w[i]) dp2[i][j] = max(dp2[i][j],dp2[i + 1][j - w[i]] + v[i]);
		}
	}
	
	for(LL i = 0;i < n;i ++){
		for(LL j = 0;j < t;j ++){
			ans = max(ans,dp1[i][j] + dp2[i + 2][t - 1 - j] + v[i + 1]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 141312
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    int a,b;
    cin >> a >> b;
    if(a+b>=10){
        cout << "error" << endl;
    }else{
        cout << a+b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int N;
int a[100010],check[100010];

signed main(){
  cin>>N;
  for(int t=0;t<N;t++)cin>>a[t];

  sort(a,a+N);

  int cont=0;
  for(int t=0;t<N;){
    int k=upper_bound(a,a+N,a[t])-lower_bound(a,a+N,a[t]);
    if(k>a[t])cont+=k-a[t];
    if(a[t]>k)cont+=k;
    t+=k;
  }

  cout<<cont<<"\n";
  return 0;
}


Measured memory_bytes: 1024
import sys, re
input = sys.stdin.readline

n = int(input())
a = [int(input()) for x in range(n)]

# a をソートして、一番大きい要素を取り出す
temp_list = sorted(a)
m = temp_list[::-1][0]


# 最も大きな数が複数あった場合
if temp_list[::-1][1] == m:
    m_dash = m
else:
    m_dash =temp_list[::-1][1]

for a_i in a:
  if a_i == m:
    print(m_dash)
  else:
    print(m)

Measured memory_bytes: 15684
// ????´???????n?????§????????????????????£??¨?????????????????¨????????°??§??????????????????????????????????????°????????§?????????????????????????????????????????????????????????
// ?????¶ O(???n)
#include <bits/stdc++.h>
#define eps 1e-2
using namespace std;

int main()
{
	int n, nn;
	vector<int> res;
	cin >> n;
	nn = n;
	for (int i = 2; i <= sqrt(n) + eps; i++) {
		while (nn % i == 0) {
			res.push_back(i);
			nn /= i;
		}
	}
	if (nn != 1)res.push_back(nn);
	cout << n << ':';
	for (int i = 0; i < res.size(); i++) {
		cout << ' ' << res[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3156
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
//#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007, C=25600; // 998244353
int A[80][80],B[80][80];
bool dp[80][80][C*2+5];
int n,m;
int32_t main(){
	boost;
	cin>>n>>m;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			cin>>A[i][j];
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			cin>>B[i][j];
	dp[0][0][C]=1;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			for (int a = 0; a <= C*2; ++a)
			{
				if(!dp[i][j][a])continue;
				if((i+1)<n){
					if(a+(A[i][j]-B[i][j])<=(C*2)&&(a+(A[i][j]-B[i][j]))>=0)
						dp[i+1][j][a+(A[i][j]-B[i][j])]=1;
					if(a+(B[i][j]-A[i][j])<=(C*2)&&(a+(B[i][j]-A[i][j]))>=0)
						dp[i+1][j][a+(B[i][j]-A[i][j])]=1;
						
				}
				if((j+1)<m){
					if(a+(A[i][j]-B[i][j])<=(C*2)&&(a+(A[i][j]-B[i][j]))>=0)
						dp[i][j+1][a+(A[i][j]-B[i][j])]=1;
					if(a+(B[i][j]-A[i][j])<=(C*2)&&(a+(B[i][j]-A[i][j]))>=0)
						dp[i][j+1][a+(B[i][j]-A[i][j])]=1;
				}
			}
		}
	}
	int ans=INF;
	for (int i = 0; i <= C*2; ++i)
		if(dp[n-1][m-1][i])ans=min(ans,min(abs(i+A[n-1][m-1]-B[n-1][m-1]-C),abs(i-A[n-1][m-1]+B[n-1][m-1]-C)));
	cout<<ans;
	return 0;
}
//long long
//array bounds
//special cases
//binary search

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

int main() {
    int k,l;
    cin>>k>>l;
    char a[60][60];
    for(int i=0;i<k;i++){
        for(int j=0;j<l;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<k;i++){
        for(int j=0;j<l;j++){
            int count=0;
            if(a[i][j]=='#'){
                cout<<'#';
            }
            else{
                if(a[i][j-1]=='#'){
                   count++; 
                }
                if(a[i][j+1]=='#'){
                   count++; 
                }
                if(a[i-1][j]=='#'){
                   count++; 
                }
                if(a[i+1][j]=='#'){
                   count++; 
                }
                if(a[i+1][j+1]=='#'){
                   count++; 
                }
                if(a[i-1][j-1]=='#'){
                   count++; 
                }
                if(a[i-1][j+1]=='#'){
                   count++; 
                }
                if(a[i+1][j-1]=='#'){
                   count++; 
                }
                cout<<count;
            }
            
                
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	cat S, X = 1000000000;
	cin >> S;
	if(S == X*X) cout << X << " 0 0 " << X << " 0 0\n";
	else cout << (S/X+1) << " " << 1 << " " << (X-S%X) << " " << X << " 0 0\n";
	return 0;
}

// look at my code
// my code is amazing


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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int N;
std::string s;

int main(){
    INIT;
    cin >> N; cin >> s;

    LL m1 = 0;
    LL m2 = 0;
    REP(i,N) if(s[i] == '.') m2++;
    LL ans = m2;
    if(m2 == N || m2 == 0) ans = 0;

    REP(i, N) {
        if(s[i] == '#') m1++;
        if(s[i] == '.') m2--;
        CHMIN(ans, m1+m2);
    }

    cout << ans << "\n";
}

Measured memory_bytes: 720
#include<stdio.h>

#define N 101
#define INF (1<<21)
#define NIL -1
#define Black -2
#define White -3
 
typedef struct{
  int dis;
  int color;
}tree;
 
int main(){
  int e, i, j, k, n, u[N], A[N][N], sum = 0;
  tree d[N];
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      scanf("%d", &e);
      A[i][j] = (e == -1)?INF:e;
      d[i].color = White;
      if(i == 0)d[i].dis = 0;
      else d[i].dis = INF;
    }
  }
  u[0] = 0;
  d[0].color = Black;
  for(k = 1;k < n;k++){
    for(i = 0;i < k;i++){
      for(j = 0;j < n;j++){
    if(d[k].dis > A[u[i]][j] && d[j].color != Black){
      d[k].dis = A[u[i]][j];
      u[k] = j; 
    }
      } 
    }
    d[u[k]].color = Black;  
    sum += d[k].dis;
  }
  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>

using namespace std;

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


int main(){
    int N;
    int p[110];
    int a, b;
    cin >> N;
    cin >> a >> b;
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }

    int x = 0, y = 0, z = 0;
    for(int i = 0; i < N; i++){
        if(p[i] <= a){
            x++;
        }
        else if(p[i] <= b){
            y++;
        }
        else{
            z++;
        }
    }

    cout << min(x, min(y, z)) << endl;


    return 0;

}



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

int main(){
    int X,N;
    cin >> X >> N;
    vector<int> p(N);
    for(int i = 0; i < N; i++){
        cin >> p.at(i);
    }

    int kotae = 1000000;
    int sa = 1000000;
    bool isOK = false;
    for(int i = 0;i <= 200; i++){
        isOK = true;
        if(abs(X - i) < sa){
            for(int j = 0; j < N; j++){
                if(i == p.at(j) && i > kotae){
                    isOK = false;
                }
            }
            if(isOK){
                sa = abs(X -i);
                kotae = i;
            }
        }
    }

    cout << kotae << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string S;
    cin >> S;
    int flag=0;
    FOR(i,1,S.size()){
        if((S.size()-i)%2 == 1) continue;
        flag =1;
        FOR(j,0,(S.size()-i)/2){
            if(S[j] != S[(S.size()-i)/2+j]){
                flag =0;
            }
        }
        if(flag ==1){
            cout << S.size()-i;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    char str1[100], str2[100];
    char bur[10000];
    scanf("%s %s", str1, str2);
    
    sprintf(bur, "%s%s", str1, str1);
        if (strstr(bur,  str2) == NULL )
            printf("No\n");
        else printf("Yes\n");

}



Measured memory_bytes: 2048
object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)
    val n = scanner.nextInt()
    val m = scanner.nextInt()

    val a = Array.ofDim[Int](n, m)
    val b = new Array[Int](m)
    for {
      i <- 0 until n
      j <- 0 until m
    } {
      a(i)(j) = scanner.nextInt()
    }
    for (j <- 0 until m) {
      b(j) = scanner.nextInt()
    }

    a.map(_.zip(b).map { case (a, b) => a * b }.sum)
      .foreach(println)
  }
}

Measured memory_bytes: 59656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
  ll si[55];
  int N;
  ll X;
  cin >> N >> X;
  si[0] = 1;
  for (int i = 1; i <= N; i ++) {
    si[i] = si[i - 1] * 2 + 3;
  }
  ll pt[55];
  pt[0] = 1;
  for (int i = 1; i <= N; i ++) {
    pt[i] = pt[i - 1] * 2 + 1;
  }
  ll ans = 0;
  while (N > 0 && X > 0) {
    if (X >= si[N - 1] + 1) {
      ans += pt[N - 1];
      X -= (si[N - 1] + 1);
      if (X > 0) {
        ans ++;
        X --;
      }
    }
    else {
      X --;
    }
    N --;
    //cout << ans << endl;
  }
  if (X >= 1) ans ++;
  cout << ans << endl;
}




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

int main()
{
    string S;
    cin >> S;

    int ans1 = 0, ans2 = 0;
    for (int i = 1; i < S.size(); i++)
    {
        if (S[i] != S[i - 1])
        {
            ans1++;
        }
    }
    for (int i = S.size() - 2; i >= 0; i--)
    {
        if (S[i] != S[i + 1])
        {
            ans2++;
        }
    }

    cout << min(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 512
package main 

import (
        "fmt"
)

func main () {
        var n, d, lo int
        a := []int{}
        an :=[]int{}
        fmt.Scan(&n)
        for i := 0 ; i < n ; i++ {
                fmt.Scan(&d)
                a = append (a, d)
        }
        m := n -1
        an = append(an, a[m])
        for k := 0 ; k < n ; k++ {
                lo = 0
                for i := 0 ; i < len(an)  ; i++ {
                        if a[k] == an[i]{
                                lo +=1
                        }
                }
                if lo == 0{
                        an = append(an, a[k])
                }
        }
        fmt.Println(len(an))

}


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

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

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

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

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; }

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n, k;
	cin >> n >> k;
	vll h(n);
	rep(i, n) cin >> h[i];

	sort(all(h));
	rep(i, n) cerr << h[i] << ' ';
	cerr << endl;
	ll ans = INFLL;
	for(int i = 0; i <= n-k; i++)
	{
		chmin(ans, h[i+k-1] - h[i]);
		cerr << h[i+k-1] - h[i] << endl;
	}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x << "  = " << x << endl
typedef long long int ll;
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

#define dbg2(x, y)                                                       \
    {                                                                    \
        cout << #x << ": " << (x) << " , " << #y << ": " << (y) << endl; \
    }
#define fo(i, n) for (int i = 0; i < n; i++)
#define fok(i, k, n) for (int i = k; i < n; i++)
#define foA(i, A) for (auto i : A)
const int mxN=101;
const int modd=1e9+7;

int a[mxN];
int n;
int dp[100005][2];

bool rfun(int k, bool ch){
    if(k<a[0])return 0;
    if(dp[k][ch]!=-1)return dp[k][ch];
    for(int i=0;i<n;i++){
        if(k-a[i]<0)break;
        if(rfun(k-a[i], !ch)==0)return dp[k][ch]=1;
    }
    return dp[k][ch]=0;
}

int main(){
    int k;
    cin>>n>>k;
    fo(i, n)cin>>a[i];
    sort(a, a+n);
    memset(dp, -1, sizeof dp);
    if(rfun(k, 0))cout<<"First";
    else cout<<"Second";
}

Measured memory_bytes: 12208
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(void){
    ll M,N;
    ll a;
    cin >> N>>M;
    
    N=N%M;
    
    while(N>abs(N-M)){
        N=abs(N-M);
    }
    cout << N;
}

Measured memory_bytes: 256
s = input()
l, r = 0, len(s) - 1
ans = 0
while l < r:
    # print(l, r)
    if s[l] == s[r]:
        l += 1
        r -= 1
    else:
        if s[l] == "x":
            l += 1
        elif s[r] == "x":
            r -= 1
        else:
            print(-1)
            exit()
        ans += 1
print(ans)


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

int main() {
  string S, ans;
  cin >> S;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '0') {
      ans.push_back('0');
    }
    else if (S[i] == '1') {
      ans.push_back('1');
    }
    else {
      if (ans.size() > 0) {
        ans.pop_back();
      }
    }
  }
  cout << ans;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
       int H, W, h, w;
    cin >> H >> W >> h >> w;

    if (H%h == 0 && W%w == 0) {
        cout << "No" << endl;
        exit(0);
    }

    cout << "Yes" << endl;
    if (H%h) {
        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                if (i%h == 0) cout << M << " ";
                else if (i%h == h-1) cout << -M-1 << " ";
                else cout << 0 << " ";
            }
            cout << endl;
        }
    }
    else if (W%w) {
        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                if (j%w == 0) cout << M << " ";
                else if (j%w == w-1) cout << -M-1 << " ";
                else cout << 0 << " ";
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 2304