akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb emplace_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> ostream& operator<<(ostream &os,const vector<vector<T> > &v) {
    ITR(u,begin(v),end(v))ITR(w,begin(*u),end(*u))os<<*w<<(w==end(*u)-1?"\n":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed << setprecision(10) << val;

int n;
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> n;
  int ans = 0;
  erep(i, 1, n) {
    int p = i;
    int cnt = 0;
    while (p > 0) {
      p /= 10;
      cnt++;
    }
    if (cnt % 2) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
d = {}
ans = 0
for i in a:
    try:
        d[i] += 1
    except:
        d[i] = 1
for i in d:
    cnt = d.get(i-1, 0) + d.get(i, 0) + d.get(i+1, 0)
    if cnt > ans:
        ans = cnt
print(ans)

Measured memory_bytes: 14180
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s,t; cin >> s >> t;
  int ans = 0;
  REP(i,s.size()){
    if(s[i]!=t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 2e5 + 10 , N = 2e6 + 10 , SQ = 320 , base = 1999 , mod = 1e9 + 7 , INF = -1e18 , lg = 33;

int32_t main() {
    FAST
    int x;
    cin >> x;
    cout << (x == 0 ? 1 : 0) << '\n';
}


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

int main() {
  ll N;
  cin >> N;
  ll min = 10000000000;
  ll max = 0;
  ll a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    if (min > a) min = a;
    if (max < a) max = a;
  }
  cout << max - min << endl;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
typedef long long ll;

ll n, a[10000], ans, sum;

int main() {
  while (scanf("%lld", &n), n) {
    sum = ans = 0;
    for (ll i = 0; i < n; i++) scanf("%lld", &a[i]), sum += a[i];
    for (ll i = 0; i < n; i++) if (a[i] * n <= sum) ans++;
    printf("%lld\n", ans);
  }
}



Measured memory_bytes: 2768
#include <cstdio>
#include <iostream>
#define MAX 100000
using namespace std;
typedef signed int llong;
int n,k;
llong T[MAX];
int check(llong P){
  int i=0;
  for(int j=0;j<k;j++){
    llong s=0;
    while(s+T[i]<=P){
      s+=T[i++];
      if(i==n)return n;
    }
  }
  return i;
}
int solve(){
  llong left=0;
  llong right=100000*10000;
  llong mid;
  while(right-left>1){
    mid=(left+right)/2;
    int v=check(mid);
    if(v>=n)right=mid;
    else left=mid;
  }
  return right;
}
int main(){
  scanf("%d %d",&n,&k);
  for(int i=0;i<n;i++)scanf("%d",&T[i]);
  llong ans=solve();
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll MOD = 1e9 + 7;
const ll dx[4] = { -1,1,0,0 };
const ll dy[4] = { 0,0,-1,1 };
const ll MAX = 1e5 + 50 ;
const ll oo = 1e16;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
long long gcd(long long  a, long long  b) { return (b == 0 ? a : gcd(b, a % b)); }
ll n , m , ans , k ; string s ;
int t[5];

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

    vector < long long > v ;
    for(int i = 0 ; i < 5 ; ++i)
        cin >> t[i];

   sort(t , t + n);

   ans = 1e9 ;

    do{
        ll time = 0 ;
        for(int i = 0 ; i < 5 ; ++i){
            if(time%10)
                time = (time/10 + 1)*10;
            time += t[i];
        }
        ans = min(ans , time);

    }while(next_permutation(t , t + 5));

    cout << ans << '\n';


     return 0;
}


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

using namespace std;

using ll = long long;

ll arr[100001];

int main(){
    ll n;
    cin >> n;
    ll sum = 0;
    for(ll i = 0; i < n; ++i){
        ll tmp; cin >> tmp;
        arr[tmp]++;
        sum += tmp;
    }
    ll q;
    cin >> q;
    while(q--){
        ll a, b;
        cin >> a >> b;
        arr[b] += arr[a];
        sum += (b - a) * arr[a];
        arr[a] = 0;
        cout << sum << endl;
    }
    return 0;

}


Measured memory_bytes: 4380
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int K = sc.nextInt();
      int X = sc.nextInt();
      if(K*500>=X){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}

Measured memory_bytes: 35760
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int m=1<<(n-1);
    long long ans=0;
    for(int i=0;i<m;i++)
    {
        long long t=s[0]-'0';
        for(int j=0;j<n;j++)
        {
            if(j==n-1||i&1<<j)      //切的方法 
            {
                ans+=t;
                t=0;
                if(j==n-1)  break;
            }
            t*=10;
            t+=s[j+1]-'0';
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

int main() {
	int n, k;
    cin >> n >> k;

    vector<int> p(n);
    for(int i=0; i < n; i++) cin >> p[i];
    sort(p.begin(), p.end());

    int minDis = p[n-1] - p[0];

    for(int i=0; i <= n-k; i++) {
        minDis = min(minDis, p[i+k-1] - p[i]);
    }

    cout << minDis;

    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;
typedef long long int lli;
typedef pair<int, int> ii;

int main() {
    int N;
    cin >> N;
    ii a[200009];
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        a[i] = ii(i, x);
    }

    sort(a, a + N, [](ii x, ii y) {
        return x.second < y.second;
    });

    int m1 = a[N/2-1].second;
    int m2 = a[N/2].second;
    for (int i = 0; i < N/2; i++) {
        a[i].second = m2;
    }
    for (int i = N/2; i < N; i++) {
        a[i].second = m1;
    }

    sort(a, a+N, [](ii x, ii y) {
        return x.first < y.first;
    });
    for (int i = 0; i < N; i++) {
        cout << a[i].second << endl;
    }
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, k, c;
    std::string s;
    std::cin >> n >> k >> c >> s;
    ++c;

    std::vector<int> dp(n);
    std::vector<std::vector<int>> vs;
    dp[0] = s[0] == 'o';
    for (int i = 1; i < n; i++) {
        if (s[i] == 'o') dp[i] = i < c ? 1 : dp[i - c] + 1;
        else dp[i] = dp[i - 1];
    }

    for (int i = 0; i < n; i++) if (s[i] == 'o') {
        if (dp[i] > vs.size()) vs.push_back({ i });
        else vs.back().push_back(i);
    }

    if (vs.size() > k) {
        return 0;
    }

    assert(vs.size() == k);

    std::vector<int> w;
    for (auto &v : vs) w.push_back(v.size() - 1);
    for (int i = vs.size() - 1; i > 0; --i) {
        while (vs[i - 1][w[i - 1]] > vs[i][w[i]] - c) w[i - 1]--;
    }

    for (int i = 0; i < vs.size(); i++) {
        if (!w[i]) std::cout << vs[i][0] + 1 << '\n';
    }

    return 0;
}


Measured memory_bytes: 15408
n = int(input())
a = list(map(int,input().split()))
search = [-1 for i in range(n)]
l,r = -1,-1
for i,x in enumerate(a):
    if search[x-1] == -1:
        search[x-1] = i
    else:
        l = search[x-1]
        r = i
#print(l,r)
p = 10**9 + 7

#前計算
comb1 = [0 for _ in range(n+1)]
comb1[0] = n+1
x = n+1
for i in range(1,n+1):
    x = (x*(n-i+1))%p
    x = (x*pow(i+1,p-2,p))%p
    comb1[i] = x

comb2 = [0 for _ in range(n+1)]
comb2[0] = 1
x = 1
for i in range(1,l+n-r+1):
    x = (x*(n+l-r-i+1))%p
    x = (x*pow(i,p-2,p))%p
    comb2[i] = x

for i in range(n+1):
    ans = comb1[i]-comb2[i]

    print(ans%p)

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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

#define fi first
#define se second
#define all(A) A.begin(),A.end()

using namespace std;

/////////////////////////////////////////////////////
void mxin(ll &a,ll b){
    if(a<b)
        a = b;
}

ll R,C,K;
ll ms[3030][3030];
ll dp[3030][3030][5];
ll mk2[5050];

ll i, j, k;

int main(){
    scanf("%lld%lld%lld", &R,&C,&K);
    rep(i,0,K){
        ll r, c, v;
        scanf("%lld%lld%lld", &r, &c, &v);
        ms[r-1][c-1] = v;
    }
    dp[0][0][1] = ms[0][0];
    rep(i,0,R){
        rep(j,0,C){
            rep(k,0,4){
                if(ms[i+1][j]>0){
                    mxin(dp[i + 1][j][1], dp[i][j][k] + ms[i + 1][j]);
                }
                mxin(dp[i+1][j][0], dp[i][j][k]);
                if(ms[i][j+1]>0&&k<3){
                    mxin(dp[i][j + 1][k + 1], dp[i][j][k] + ms[i][j + 1]);
                }
                mxin(dp[i][j + 1][k], dp[i][j][k]);
            }
        }
    }
    ll ans = 0;
    rep(i,0,4){
        mxin(ans,dp[R - 1][C - 1][i]);
    }
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 429672
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int N = 50;
		long[] ans = new long[N];
		for(int i=0;i<N;i++) ans[i] = K/N + N-1;
		int c = 0;
		for(int i=0;i<K%N;i++){
			if(ans[c] + N > 10000000000000000L + 1000) c++;
			for(int j=0;j<N;j++){
				if(j != c) ans[j]--;
				if(j == c) ans[j]+=N;
			}
		}
		
		Console.WriteLine(N);
		Console.WriteLine(String.Join(" ",ans));
		
	}
	long K;
	public Sol(){
		K = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
#include<cstdio>
#include<vector>
#include<queue>
#include<ctime>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<bitset>
using namespace std;

typedef long long LL;
typedef double DL;

const int INF = 2147483647;

LL n,p,ans; 

inline LL getint()
{
	LL ret = 0,f = 1;
	char c = getchar();
	while (c < '0' || c > '9')
	{
		if (c == '-') f = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') 
		ret = ret * 10 + c - '0',c = getchar();
	return ret * f;
}

inline LL qpow(LL a,int b)
{
	LL ret = 1;
	while (b)
	{
		if (b & 1) ret = ret * a;
		a = a * a; b >>= 1;
	}
	return ret;
}

int main()
{
	#ifdef AMC
		freopen("AMC1.txt","r",stdin);
	#endif
	n = getint(); p = getint(); 
	int cap = sqrt(p); ans = 1;
	for (int i = 2; i <= cap; i++)
	{
		int cnt = 0;
		while (p % i == 0)
			cnt++ , p /= i;
		ans = ans * qpow(i,cnt / n);
	}
	if (p > 1 && n == 1) ans *= p; 
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

int main(){
  int n;
  cin>>n;
  vector<int>v;
  for(int i=0;i<n;++i){
    int x;
    cin>>x;
    v.push_back(x);
  }
  long long ans=0;
  int curr_max=v[0];
  for(int i=1;i<n;++i){
    if(v[i]<curr_max){
      ans+=curr_max-v[i];
    }
    else{
      curr_max=v[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

void optimize_cpp_stdio() {
    std::ios::sync_with_stdio(false);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main() {
    optimize_cpp_stdio();
    int n, m;
    std::cin >> n >> m;
    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        --a[i];
    }
    std::vector<std::vector<int>> G(n);
    for (int i = 0, u, v; i < m; i++) {
        std::cin >> u >> v;
        G[--u].push_back(--v);
        G[v].push_back(u);
    }
    int ans = 0;
    std::vector<bool> vis(n);
    for (int i = 0; i < n; i++) {
        if (vis[i]) continue;
        std::vector<int> index, value;
        std::queue<int> q({i});
        vis[i] = true;
        for (; !q.empty(); q.pop()) {
            int u = q.front();
            index.push_back(u);
            value.push_back(a[u]);
            for (int v : G[u]) {
                if (vis[v]) continue;
                vis[v] = true;
                q.push(v);
            }
        }
        std::sort(index.begin(), index.end());
        for (int it : value)
            ans += std::binary_search(index.begin(), index.end(), it);
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6992
#include<iostream>
using namespace std;
typedef long long ll;
int n;
const int maxn=1e5+7;
int h[maxn];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	int maxlen=0,cnt=0;
	for(int i=1;i<n;i++){
		if(h[i-1]>=h[i]){
			cnt++;
			maxlen=max(maxlen,cnt);
		}
		else{
			cnt=0;
		}
		
	}
	cout<<maxlen<<endl;
	
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
#define int long long
const int inf = 999999999999999999;
typedef long long ll;
typedef long double ld;
signed main() {
	string s;
	cin >> s;
	if (s[0] == s[2])
		cout << "Yes\n";
	else
		cout << "No\n";
	getchar(); getchar();
}

Measured memory_bytes: 256
import java.lang.Math

val MOD: Int = 1000000000 + 7
val MODL: Long = MOD.toLong()

fun main(args: Array<String>)
{
    val n = read().toInt()
    val (s, t) = read().split(" ").map{it.toCharArray()}

    var ans: String = ""
    for (i in 0 until n) {
        ans += s[i]
        ans += t[i]
    }

    println(ans)
}

fun read(): String = readLine()!!


Measured memory_bytes: 37892
#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)
#define endl "\n"
#define ii pair<int,int>
#define fi first
#define se second
#define ll long long
#define FIO() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FI(task) freopen(task".inp","r",stdin)
#define FO(task) freopen(task".out","w",stdout)

using namespace std;

const int N = 1e5+7;
const int M = 1e9+7;

int a[N], f[N];
int n, k;

#define task "test"

int main(){
    FIO();
    //FI(task);
    ///FO(task);

    cin >> n >> k;
    _u(i,1,n) cin >> a[i]; fill(f, f+n+1, M); f[1] =0;
    _u(i,2,n)
     _u(j,max(1,i-k),i-1)
      f[i] = min(f[i], f[j] + abs(a[j] - a[i]));
    cout << f[n];
    return 0;
}


Measured memory_bytes: 1024
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int n;
	cin >> n;
	ll ans[100];
	ans[0] = 2;
	ans[1] = 1;
	for (int i = 2; i <= n; i++)
		ans[i] = ans[i - 1] + ans[i - 2];
	cout << ans[n] << endl;
	return 0;
}

Measured memory_bytes: 256
public class Main{
	
	public static void main(String[] args){
		if(java.util.stream.IntStream.rangeClosed(1, 9).peek(I -> {
			if(java.util.stream.IntStream.rangeClosed(1, 9).peek(J ->
				System.out.println(I + "x" + J + "=" + I * J)
			).count() == 0){}
		}).count() == 0) {}
	}
	
}

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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;


void solve() {
	lli n, m, _max;
	cin >> n >> m;
	
	_max = m/n;
	
	vcI cd;
	
	for (int i = 1; i*i <= m; ++i) {
		if ( m%i == 0 ) {
			cd.push_back(i);
			if ( i*i != m ) cd.push_back( m/i );
		}
	}
	
	sort( cd.begin(), cd.end() );
	
	int now = 1;
	
	for (auto x : cd) {
		if ( x > _max ) break;
		else now = x;
	}
	
	cout << now << '\n';
}

int main() {
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}


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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
	int A, B;
	cin >> A >> B;
	cout << A*B << endl;
}


Measured memory_bytes: 3624
#include <cstring>
#include <iostream>

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
int dp[3][100005];
int main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	rep(i, h) {
		rep(j, w) {
			if ((i < b and j < a) or (b <= i and a <= j))
				cout << 0;
			else
				cout << 1;
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;
const int maxn = 1e5+7;
typedef long long ll;

int main()
{
	string s,ss;
	cin>>s>>ss;
	int cnt=0;
	for(int i=0;i<s.size();i++){
		if(s[i]==ss[i]){
			cnt++;
		}
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    long long n, m;
    cin >> m >> n;
    vector<long long> a(n);
    for (auto &e : a) cin >> e;
    
    long long s = accumulate(a.begin(), a.end(), 0LL);
    
    long long ans = max(-1LL, m - s);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3668
import math

N,M = map(int,input().split(' '))
An = [ int(input()) for _ in range(M)]

'''
factorial_list = [1] * (N+1)
for i in range(1,N+1):
    factorial_list[i] = factorial_list[i-1] * i

def combinations_count(n, r):
    return factorial_list[n] // (factorial_list[n - r] * factorial_list[r])
'''

feruma_list = [1] * (N+1)
for i in range(2,N+1):
    feruma_list[i] = feruma_list[i-2] + feruma_list[i-1]


def nCk(n, k):
    ret = 1
    mo = 10**9 + 7
    for i in range(k):
        ret = ret * (n - i) * pow(i + 1, mo - 2, mo) % mo
    return ret

def one_two_comb(N):
    two_n = N//2
    comb_list = []
    for i in range(1,two_n+1):
        comb_list.append([N-i,i])
    return comb_list

def sum_comb(comb_list):
    comb_sum = 0
    for val in comb_list:
        comb_sum += nCk(val[0],val[1])
    return comb_sum
    

diff_list = []
current_num = 0
max_diff = -1
for a in An:
    diff = a - current_num
    if diff == 0:
        print(0)
        exit(0)
    diff_list.append(diff)
    current_num = a +1
diff = N+1 - current_num
diff_list.append(diff)
#print(diff_list)


all_sum = 1
for idx,diff in enumerate(diff_list):
    
    if idx == 0 or len(diff_list):
        diff -= 1
    '''
    if diff == 0:
        all_sum *= 1
    else:
        internal_comb_list = one_two_comb(diff)
        comb_count = sum_comb(internal_comb_list) + 1
        if all_sum > 10**9+7:
            all_sum = all_sum%(10**9+7)
        all_sum *= comb_count
    '''

    comb_count = feruma_list[diff]
    if all_sum > 10**9+7:
        all_sum = all_sum%(10**9+7)
    all_sum *= comb_count

print(all_sum%(10**9+7))




Measured memory_bytes: 479492
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <map>


using namespace std;


bool pairCompare(const  pair<int, int>& firstElof, const pair<int, int>& secondElof)
{
  return firstElof.second < secondElof.second;
}

int main()
{
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> r(M);
  vector <bool> li(N , false);//Nを代入


  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    r[i] = make_pair(a, b );
  }

  sort(r.begin(), r.end(), pairCompare);//２つ目が小さい順にソート

  int count = 0;


  for (int i = 0; i < M; i++) {
    int f, e;
    f = r[i].first;
    e = r[i].second;
    bool iscover = false;

    for (int j = f; j <= e-1 ; j++) {
      if (li[j] >0) {
        iscover = true;
        break;
      } else {
        // li[j]-=N-(e-1);
      }
    }

    if (iscover == false) {
      li[e-1] = true;
      // for (int j = f; j <= f + e - 1 ; j++) {
      //   li[j] -=N-(e-1);
      // }
      count++;
    }



    // cout <<f <<"-" << e;
    // if (iscover==false)cout << "**";
    // cout << endl;
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 1024
import collections
N = int(input())
A = list(map(int,input().split()))

C = collections.Counter(A)
#print(C)
calc = {}
for i,cnt in C.items():
    calc[i] = cnt*(cnt-1)//2
#print("calc:",calc)
calc_sum = sum(calc.values())
for i in range(N):
    ans = calc_sum - calc[A[i]]
#    print("ans",ans)
#    print("A[i]",A[i],"calc[A[i]]",calc[A[i]])
    if calc[A[i]] != 0:
        ans += (C[A[i]]-1)*(C[A[i]]-2)//2
#        print((calc[A[i]]-2)*(calc[A[i]]-1)//2)
#        ans += (calc[A[i]]-2)*(calc[A[i]]-1)//2
    print(ans)


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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define mp(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ar[n];
    for (int i = 0; i < n; i++) {
        cin >> ar[i];
    }
    sort(ar, ar + n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (ar[i] == ar[j]) continue;
            for (int k = j + 1; k < n; k++) {
                if (ar[i] + ar[j] > ar[k] && ar[i] != ar[k] && ar[j] != ar[k]) ans++;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3648
// Created by Rg
#include        "bits/stdc++.h"
using namespace std;
#define          f first
#define          endl '\n'
#define          sc second
#define          N (int)2e5+5
#define          pb push_back
#define          PI acos(-1.0)
#define          int long long 
#define          mod 1000000007
#define          ld long double
#define          vi vector<int>
#define          eb emplace_back
#define          vpii vector<pii>
#define          mii map<int,int>
#define          pii pair<int,int>
#define          pq priority_queue
#define          test(x) while(x--)
#define          hii cout << "hii" << endl
#define          si size()
#define          all(x) begin(x),end(x)
#define          allr(x) rbegin(x),rend(x)
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
// inline void INP()
// {
//     #ifndef ONLINE_JUDGE
//         freopen("input.txt","r",stdin);   
//         freopen("output.txt","w",stdout);
//     #endif 
// }

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,m,k,q,x,y;
string s;
vi adj[N];
int vis[N],par[N],a[N];

void go()
{
    cin>>n;

    int ans=0;

    if(n>=500) {
        int d=n/500;
        ans=d*1000;

        int r=n-d*500;
        r=r/5;
        ans+=r*5;
    }

    else {
        int r=n/5;
        ans+=r*5;
    }

    cout << ans <<endl;

}

int32_t main()
{
    // INP(); 
    FAST;     
    int t=1; 
    // cin>>t;
    test(t) go();
}


Measured memory_bytes: 5504
import numpy as np
N,M,C = map(int, input().split())
B = input().split()
Bs = np.array([float(b) for b in B])
A = np.zeros((N,M))
for i in range(N):
    A_i = input().split()
    A_i = [float(a) for a in A_i]
    A[i] = A_i
W = np.dot(A,Bs.T)
print(len(W[W+C>0]))


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


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

  int64_t sum=0;
  for(int i=0;i<n.size();i++){
    char cwk=n.at(i);
    sum+=cwk-'0';
  }

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

	return 0;
}



Measured memory_bytes: 3716
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	int n,k;
	cin >> n >> k;
	int d[10] = {};
	REP(i,k) {
		int in;
		cin >> in;
		d[in] = 1;
	}
	
	int num = n;
	while(true){
		bool ok = true; 
		string s = to_string(num);
		REP(i,s.size()){
			if(d[s[i]-'0']) ok = false;
		}
		if(ok) break;
		else num++;
	}
	
	cout << num << endl;

	return 0;
}

Measured memory_bytes: 3676
antennas = []
5.times do
    line = gets.chomp.to_i
    antennas.push(line)
end

k = gets.chomp.to_i

flag = true
for i in 0..3
    for j in (i + 1)..4
        flag = false if antennas[j] - antennas[i] > k
    end
end

if flag
    puts "Yay!"
else
    puts ":("
end


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main(){
  int N;
  string s;
  cin >> N;
  int flag = 0;
  if(N >= 1000){
    flag =1;
  }

  if(flag){
    printf("ABD\n");
  }else{
    printf("ABC\n");

  }
  return 0;

}


Measured memory_bytes: 256
fun main(arr: Array<String>) {
    val (n,d) = readLine()!!.split(" ").map { it.toInt() }
    val pos = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }
    val ans = pos.indices.map{ idx-> pos.indices.count { idx2 -> (idx!=idx2) && (isSquare(getDist(pos[idx], pos[idx2]))) } }.sum()
    println(ans/2)
}

fun getDist(pos1:List<Int>, pos2:List<Int>):Int {
    return pos1.indices.map { (pos1[it]-pos2[it])*(pos1[it]-pos2[it]) }.sum()
}
fun isSquare(num:Int):Boolean {
    for(i in (1..num)) {
        val tmp = i*i
        if(tmp == num) {
            return true
        }
        if(tmp > num) {
            break
        }
    }
    return false
}


Measured memory_bytes: 36684
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N,Ma,Mb;
  cin>>N>>Ma>>Mb;
  int a[N],b[N],c[N];
  int sumA=1;
  int sumB=1;
  REP(i,N){
    cin>>a[i]>>b[i]>>c[i];
    sumA+=a[i];sumB+=b[i];
  }
  int dp[sumA][sumB];
  REP(ia,sumA)REP(ib,sumB)dp[ia][ib]=9999;
  dp[0][0]=0;
  REP(i,N){
    for(int ia=sumA-1;ia>=a[i];ia--)for(int ib=sumB;ib>=b[i];ib--){
      dp[ia][ib]=min(dp[ia][ib],dp[ia-a[i]][ib-b[i]]+c[i]);
    }
  }
  int ans=9999;
  FOR(ia,1,sumA)FOR(ib,1,sumB){
    if(ia*Mb==ib*Ma)ans=min(ans,dp[ia][ib]);
  }
  // REP(ia,sumA){
  //   REP(ib,sumB)cerr<<dp[ia][ib]<<" ";
  //   cerr<<endl;
  // }
  if(ans==9999)ans=-1;
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  int b=1;
  sort(a.begin(),a.end());
  for(int i=0;i<N-1;i++){
    if(a.at(i)!=a.at(i+1)){
      b++ ;
    }
  }
  cout<< b <<endl;
}


Measured memory_bytes: 3644
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
# sys.setrecursionlimit(10000)
import sys,collections
sys.setrecursionlimit(100000)
a,b = map(int,sys.stdin.readline().split())
print(a*b)


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

using namespace std;

int main() {
    std::ios::sync_with_stdio(false); 
    cin.tie(nullptr);
    
    int N;
    cin >> N;
    string S;
    cin >> S;
    int cnt_w = count(begin(S), end(S), '.');
    int cur_w = 0;
    int mn = cnt_w;
    for (int i = 0; i < N; ++i) {
        cur_w += (S[i] == '.');
        int cost_l = (i + 1) - cur_w;
        int cost_r = cnt_w - cur_w;
        mn = min(mn, cost_l + cost_r);
    }
    cout << mn << endl;


    return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ist insert
#define vec vector <int>
#define vecc vector <char>
#define vecs vector <string>
#define vecl vector <ll int>
#define vecp vector <pair<int,int>>
#define vecpl vector <pair<ll int,ll int>>
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define bg begin()
#define en end()
#define el endl
#define ff first
#define ss second
#define fr(i,n) for(int i=0;i<n;i++)
#define rp(i,a,b) for(int i=a;i<b;i++)
#define rr(i,a,b) for(int i=a;i>=b;i--)
#define ft(x) for(auto it : x)
#define wl while
#define sz size()
#define mapi map<int,int>
#define mapl map<ll int,ll int>
#define mapc map<char,ll int>
#define maps map<string,ll int>
#define mapss map<string,string>
#define scni(x) scanf("%d",&x)
#define scns(x) scanf("%s",x)
#define scnc(x) scanf("%c",&x)
#define pti(x) printf("%d",x)
#define pts(x) printf("%s",x)
#define ptc(x) printf("%c",x)
#define test(t) int t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
const int mod=1e9+7;
const int mex=1e6+1;
ll power(ll a,ll b)
{
    ll ans=1,temp=a;
    while(b!=0)
    {
        if(b&1)
        ans=ans*temp;
        ans=ans%mod;
        temp=temp*temp;
        temp=temp%mod;
        b/=2;
    }
    return ans;
}
int spf[mex];
void seive()
{
    int p[mex];
    for(int i=0;i<mex;i++) p[i]=1;
    p[0]=0;
    p[1]=0;
    for(int i=2;i*i<mex;i++)
    {
        if(p[i])
        for(int j=i*i;j<mex;j+=i)
        p[j]=0;
    }
    
}
ll int x1,x2,d1;
void exeu(ll int a1,ll int b1)
{
    if(b1==0)
    {
        x1=1;
        x2=0;
        d1=a1;
    }
    else
    {
        exeu(b1,a1%b1);
        ll int temp=x1;
        x1=x2;
        x2=temp-(a1/b1)*x2;
    }
}
ll int modinv(ll int A,ll int M)
{
    exeu(A,M);
    return (x1%M+M)%M;
}
int main()
{
    fast
    ll int n,k;
    cin>>n>>k;
    ll int a[n],b[n]={0},c[n]={0},ans=0,ans1,ans2;
    fr(i,n) cin>>a[i];
    fr(i,n)
    {
        rp(j,i+1,n)
        {
            if(a[i]>a[j]) b[i]++;
        }
    }
    fr(i,n)
    {
        fr(j,n)
        {
            if(a[i]>a[j]) c[i]++;
        }
    }
    fr(i,n)
    {
        ans1=(k*(k-1)/2)%mod;
        ans1=(ans1*c[i])%mod;
        ans2=(b[i]*(k))%mod;
        ans=(ans+ans1)%mod;
        ans=(ans+ans2)%mod;
    }
    cout<<ans<<el;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll n,k,a[105];
bool dp[100005][2];
int main(void){
    scanf("%lld%lld",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%lld",a+i);
    }
    for(int i=0;i<=k;i++)dp[i][1]=true;
    for(int i=0;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i-a[j]>=0){
                dp[i][0]|=dp[i-a[j]][1];
                if(dp[i-a[j]][0]==false)dp[i][1]=false;
            }
        }
    }
    if(dp[k][0])printf("First\n");
    else printf("Second\n");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<int,int>
#define iil pair<ll,ll>
#define se second
#define ld long double
#define mod 1000000007
#define popcount __builtin_popcountll
#define x0 zxcxzcsacasd
#define x1 ghfghujfgfg
#define y0 olkjhdnncvcv
#define y1 bhvgrewm345345435
#define debug(x) std::cerr<<#x<<": "<<(x)<<'\n'
#define all(x) x.begin(), x.end()
using namespace std;
ll p(ll a, ll b){
	if(b==0)return 1;
	ll ret=p(a, b/2);
	ret*=ret;
	ret%=mod;
	if(b%2)ret*=a;
	return ret%mod;
}
int main(){
	int n;
	cin>>n;
	ll amid = p(10, n);
	amid-=2*p(9, n);
	amid%=mod;
	if(amid<0)amid+=mod;
	amid+=p(8, n);
	amid%=mod;
	cout<<amid<<endl;
}


Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,q=map(int,input().split())
STX=[tuple(map(int,input().split())) for i in range(n)]
D=[int(input()) for i in range(q)]
event=[]
for si,ti,xi in STX:
  event.append((si-xi,0,xi))
  event.append((ti-xi,-1,xi))
for di in D:
  event.append((di,1,di))
event.sort()
hq=[]; S=set()
ans = []
for time, query, number in event:
  if query == 0:
    heapq.heappush(hq,number)
    S.add(number)
  elif query == -1:
    S.remove(number)
  else:
    while hq and hq[0] not in S:
      heapq.heappop(hq)
    if not hq:
      ans.append(-1)
    else:
      ans.append(hq[0])
print(*ans,sep="\n")




Measured memory_bytes: 120636
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    long long int n,m,x=0,y=0;
    cin>>n>>m;
    vector<long long int>a(1000000);
    vector<long long int>b(1000000);
    for(long long int i=0;i<n;i++){
        cin>>a[i];
        x+=((2*i-n+1)*a[i]);
    }
    for(long long int i=0;i<m;i++){
        cin>>b[i];
        y+=((2*i-m+1)*b[i]);
    }
    x%=1000000007;
    y%=1000000007;
    cout<<(x*y)%1000000007<<endl;
    return 0;
}


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

#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<ll, ll> P;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 100 + 5;
const int MAX_N = 1e5 + 5;

int main() {
  string s, t;
  cin >> s >> t;
  ll ans = 0;
  vector<vector<int>> a(26);
  int sz_s = s.size();
  int sz_t = t.size();
  
  rep(i, sz_s) {a[s[i]-'a'].push_back(i);}
  rep(i, sz_s) {a[s[i]-'a'].push_back(i+sz_s);}

  int pos = 0;
  rep(i, sz_t) {
    int ch = t[i] - 'a';
    if(a[ch].size() == 0) {
      cout << -1; return 0; 
    }
    
    pos = *lower_bound(a[ch].begin(), a[ch].end(), pos) + 1;
    if(pos >= sz_s) {
      ans += sz_s;
      pos -= sz_s;
    }
  }
  
  cout << ans + pos << endl;
  
  return 0; 
}

Measured memory_bytes: 1724
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"


int main() {
	cout << fixed << setprecision(22);
	while (1) {

		ld X, H; cin >> X >> H;
		if (X < eps)break;
		ld a = sqrt(H*H + X*X / 4);
		cout << X*a * 2 + X*X << endl;
	}

	return 0;
}

Measured memory_bytes: 3256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int main(){
	int n;
	int a[5010];
	for(;cin>>n,n;){
		int max=0;
		int m=0;
		bool f=false;
		for(int i=0;i<n;i++){
			cin>>a[i];
			if(a[i]>0)m+=a[i],max=max<m?m:max,f=true;
			else if(a[i]+m>0)m+=a[i];
			else m=0;
		}
		if(f)cout<<max<<endl;
		else{
			int mx=-10000000;
			rep(i,n)mx=mx<a[i]?a[i]:mx;
			cout<<mx<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h> 
using namespace std; 
int main() {
  int n; 
  scanf("%d\n", &n); 
  string s; 
  getline(cin, s); 
  int nbRouges = 0; 
  int reponse = 0; 
  for (int i = 0; i < n; i ++) {
   	if (s[i] == 'R') {
      nbRouges ++; 
    }
  }
  int l = 0; 
  while (nbRouges > 0) {
    if (s[l] == 'W') {
     	reponse ++;  
    }
    nbRouges --;
    l ++; 
  }
  cout << reponse; 
 
}

Measured memory_bytes: 3808
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;
#define vel vector<int>
#define vvel vector<vel>
#define sor(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define upperbound(v,val) upper_bound(v.begin(),v.end(),val)
#define lowerbound(v,val) lower_bound(v.begin(),v.end(),val)
signed main() {
	string qs; cin >> qs;
	int n = qs.size();
	vel s(n);
	rep(i, n) { s[i] = qs[i] - '0'; }
	if ((s[n - 1] == 1) or (s[0] == 0)) { cout << -1 << endl; return 0; }
	rep(i, n - 1) {
		if (s[i] != s[n - 2 - i]) { cout << -1 << endl; return 0; }
	}
	s[n - 1] = 1;
	vel pa(n, -1);
	int back = 0;
	for (int i = 1; i < n; i++) {
		if (s[i] == 1) {
			for (int j = back; j < i; j++) {
				pa[j] = i;
			}
			back = i;
		}
	}
	rep(i, n - 1) {
		cout << i+1 << " " << pa[i] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 2432
import sys

def input():
    return sys.stdin.readline()[:-1]

N, K = map(int, input().split())
A = [i for i in map(int, input().split())]


def func(A, town):
    return A[town]

att = 1

visited = set([1])
loopend = 0
loopstart = 0
if K > N:
    for i in range(N):
        att = func(A, att-1)
        #print(visited)
        if att in visited:
            visited = list(visited)
            loopstart = visited.index(att)
            break
        else:
            visited.add(att)
    loop = visited[loopstart:] # 周回する街
    rem = (K - loopstart) % len(loop)
    att = loop[rem]
else:
    for _ in range(K):
        att = func(A, att-1)

print(att)

Measured memory_bytes: 107164
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "A"
int n;
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    cin>>n;
    if(max(n/10, n%10)==9) cout<<"Yes";
    else cout<<"No";
}

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

flag = False

for i in range(0, n + 1):
    if 10000 * i > y:
        break

    for j in range(0, n + 1 - i):
        k = n - i - j
        money = 10000 * i + 5000 * j + 1000 * k

        if money > y:
            break

        if money == y:
            print(i, j, k)
            flag = True # 多重ループ抜ける用
            break

    if flag:
        break


if not(flag):
    print(-1, -1, -1)


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

int main() {
    int N;
    int a;

    int cnt = 0;
    cin >> N;
    for (int i =1;i<N+1;i++){
        cin >> a;
        if((i%2 != 0)&(a%2 != 0)){
            cnt++;
        }
    }
    cout << cnt;
    return 0;

}

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

using namespace std;

struct odd : public unary_function<int, bool> { bool operator () (int x) const { return (x % 2) != 0; } };
void dis(int *Array, int N) { for(int i = 0; i < N; ++i) {std::cout.width(1); std::cout << Array[i];} std::cout << std::endl;}
signed fac(int n){return (n==1 || n==0) ? 1: n * fac(n - 1);}
bool V(char x) {return (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u'); } 
template<typename T, typename U> inline signed  amin(T &x, U y) { if(y < x) x = y; return x;}
template<typename T, typename U> inline signed  amax(T &x, U y) { if(x < y) x = y; return x;}
//signed m(){long long T, pp,p,ppp, ct, nn, xx; cin >> p; cin.ignore(); for(int k=0;k<n;k++){for(int l=0;l<(k+1);l++){cin>>a[k][l];}}
#define inn freopen("input.txt", "r", stdin) 
#define outt freopen("output.txt", "w",stdout)
#define all(cont) cont.begin(), cont.end()
#define ll          long long
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)

ll n,E,E1,D,D1,k=0,arr1[12345],max1=0,a,b,d,e,f,flag=0,max2=0;

vector<ll int>fi;
vector<string>s1;

int main () {
    
    ll t=1;
    string s;
            cin>>s;
            if(s=="Sunny")
            {cout<<"Cloudy"<<"\n";
            }
            else if(s=="Rainy")
            {cout<<"Sunny"<<"\n";
            }
            else if(s=="Cloudy")
            {cout<<"Rainy"<<"\n";
            }
  
    	

   return 0;
}


Measured memory_bytes: 256
L,R= map(int,input().split())
#境界条件
bool = True
flag = False
for i in range(L,R):
    for j in range(i+1,R+1):
        temp = (i * j) % 2019
        if bool:
            min = temp
            ans = min
            bool = False
        elif min > temp:
            min = temp
            ans = min
        if min == 0:
            flag = True
            break
    if flag:
        break
print(ans)

Measured memory_bytes: 38896
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    ll l = 0;

    ll r = total;

    ll ans = INF;

    for(int i = 0; i < n; i++){
        l += a[i];
        r -= a[i];
        ans = min(ans, abs(l - r));
    }

    cout << ans << endl;
    



}

Measured memory_bytes: 1792
#include<iostream>
#include<array>

int main(){
	std::array < int, 4>a;
	std::array < int, 4>b;
	
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		int hit, blow;
		hit = blow = 0;
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		for(int i=0; i<4; ++i){
			if(a[i] == b[i]){
				++hit;
			} else{
				for(int j=0; j<4; ++j){
					if(a[i] == b[j]){
						++blow;
					}
				}
			}
		}
		std::cout << hit << ' ' << blow << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#define N 100000
int main(void){
    int n,i,a[N];
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    a[n]=a[n-1]/2;
    for(i=0;i<n;i++){
        if(a[i]!=a[i+1]) {
            printf("%d",a[i]);
            if(i!=n-1) printf(" ");
            else printf("\n");
        }
    }
    
    return 0;
}



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

int main()
{
    string S;
    cin >> S;
    int N = S.size();
    bool alp[26];
    rep(i, 26) alp[i] = false;
    rep(i, N)
    {
        int ii = S[i] - 'a';
        alp[ii] = true;
    }
    rep(i, 26)
    {
        if (alp[i] == false)
        {
            char c = i + 'a';
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if((pow(a-c, 2)<=d*d) || ((pow(a-b, 2)<=d*d)&&(pow(b-c, 2)<=d*d))){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256