akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    if (n < 3) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    for (int j = 1; j <= 5; j++) {   
        int tmp = (k + 13 - 9 * j % 11) * 7 % 11;
        if (tmp != 0 && tmp <= n - 2) ans++;
        ans += (n - 2 - tmp) / 11;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_b() {
	ll n, m;
	ll x, y;
	ll a, b, c;
	ll k;
	ll l;
	string s, t;
	ll l_ans = 0;
	float f_ans = 0;
	string s_ans;

	n = 5;
	V d(n);
	rep(i, n) cin >> d[i];

	ll idx = 0;
	ll val = 10;
	rep(i, n) {
		if (d[i] % 10 == 0)continue;

		if (val > (d[i] % 10)) {
			idx = i;
			val = d[i] % 10;
		}
	}

	rep(i, n) {
		if (i == idx) continue;

		if (d[i] % 10 == 0) {
			l_ans += d[i];
		}
		else {
			l_ans += (d[i] / 10) * 10 + 10;
		}
	}

	l_ans += d[idx];

	cout << l_ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(7);

	solve_abc_b();

	return 0;
}


Measured memory_bytes: 3648
#define len(arr) sizeof(arr) / sizeof(arr[0])
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
    int in[3];
    cin >> in[0] >> in[1] >> in[2];
    sort(in, in + len(in));
    string out = to_string(in[0]) + " " + to_string(in[1]) + " " + to_string(in[2]);
    cout << out << endl;
    return 0;
}



Measured memory_bytes: 3256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

typedef long long LL;

LL h, w, s;

int main()
{
    read(h), read(w);
    if (h == 1 || w == 1) printf("1\n");
    else    printf("%lld\n", (h * w - 1) / 2 + 1);
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  string s; cin >> s;
  int K; scanf("%d", &K);
  set<string> subs;
  for (int i = 0; i < (int)s.size(); ++i) {
    for (int len = 1; len <= K; ++len) {
      subs.insert(s.substr(i, len));
    }
  }
  vector<string> v(subs.begin(), subs.end());
  sort(v.begin(), v.end());
  string ans = v[K - 1];
  printf("%s\n", ans.c_str());
  return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define yn(f) cout << (f ? "Yes" : "No") << endl;
#define YN(f) cout << (f ? "YES" : "NO") << endl;

int n,m,q,a[50],b[50],c[50],d[50],ans;

void kr(vector<int> v) {
    if (v.size() == n) {
        int tmpans = 0;
        rep(i,q) {
            if (v[b[i]] - v[a[i]] == c[i]) {
                tmpans += d[i];
            }
        }
        ans = max(ans, tmpans);
        return;
    }
    int f = (v.empty() ? 1 : v.back());
    for(int i=f; i<=m; ++i) {
        v.push_back(i);
        kr(v);
        v.pop_back();
    }
};

signed main() {
    cin >> n >> m >> q;
    rep(i,q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i], --b[i];
    }
    vector<int> v;
    kr(v);
    cout << ans << endl;
}




Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){
    int N;cin>>N;
    LL T[N],A[N];
    REP(i,N)cin>>T[i];
    REP(i,N)cin>>A[i];
    LL inf = 1e9+7;
    pll rangeT[N];
    pll rangeA[N];
    REP(i,N){
        if(i==0)rangeT[i]={T[i],T[i]};
        else{
            if(T[i]==T[i-1])rangeT[i]={1,T[i]};
            else rangeT[i]={T[i],T[i]};
        }
    }
    for(int i=N-1;i>=0;i--){
        if(i==N-1)rangeA[i]={A[i],A[i]};
        else{
            if(A[i]==A[i+1])rangeA[i]={1,A[i]};
            else rangeA[i]={A[i],A[i]};
        }
    }

    LL ans = 1;
    REP(i,N){
        LL next = min(rangeT[i].second,rangeA[i].second)-max(rangeT[i].first,rangeA[i].first)+1;
        if(next<=0)ans=0;
        ans = (ans*next)%inf;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=2e5+5;
ll dp[N];
ll a[N];
ll solve(int i)
{
  if(i<=1)
return 0;
else if(dp[i]!=-1)
return dp[i];
return dp[i]=min(abs(a[i]-a[i-2])+solve(i-2),abs(a[i]-a[i-1])+solve(i-1));
}
int main()
{
  int n;
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i],dp[i]=-1;
a[0]=INT_MAX;
cout<<solve(n)<<endl;
}

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

set<ll>s;

void primeFactors(ll n)
{

    while (n%2 == 0)
    {
        //printf("%d ", 2);
        s.insert(2);
        n = n/2;
    }


    for (ll i = 3; i <= sqrt(n); i = i+2)
    {

        while (n%i == 0)
        {
            //printf("%d ", i);
            s.insert(i);
            n = n/i;
        }
    }


    if (n > 2)
        //printf ("%d ", n);
        s.insert(n);

}

int main(){

    ll a,b;
    cin>>a>>b;

    ll gcd = __gcd(a,b);

    primeFactors(gcd);

    cout<<s.size()+1<<endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
 ll H,W;
  in(H>>W);
  vector<vector<char>> g(H,vector<char>(W));
  rep(i,H){
	rep(j,W){
     in(g[i][j]); 
    }
  }
  bool f =true;
rep(i,H){
rep(j,W){
 if(g[i][j]=='#'){
  int k=0;
  if(i+1<H&&g[i+1][j]=='.')k++;
  if(i-1>0&&g[i-1][j]=='.')k++;
  if(j+1<W&&g[i][j+1]=='.')k++;
   if(j-1>0&&g[i][j-1]=='.')k++;
   if(k==4) f = false;
 }
}
}
 if(f ) out("Yes");
  else out("No");
  
   
}	


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

int main() {
    int H, N;
    cin >> H >> N;

    bool ok = false;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        H -= A;
        if (H <= 0) {
            ok = true;
            break;
        }
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;

vector<int> p, club;

void init(int n) {
	for (int i = 0; i < n; ++i) p[i] = i;
}

int root(int x) {
	if (p[x] == x) return x;
	return p[x] = root(p[x]);
}

bool unite(int x, int y) {
	int rx = root(x), ry = root(y);
	if (rx != ry) {
		p[rx] = ry;
		if (club[rx] != club[ry]) {
			if (club[rx] && club[ry]) return false;
		}
		club[ry] = (club[rx] ? club[rx] : club[ry]);
	}
	return true;
}

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

int main() {
	int n, m, k; cin >> n >> m >> k;
	p.assign(n, 0); club.assign(n, 0);
	init(n);
	int ans = 0;
	for (int i = 1; i <= k; ++i) {
		int f; cin >> f;
		if (f == 1) {
			int a, b; cin >> a >> b; a--, b--;
			if (!unite(a, b)) {
				ans = i;
				break;
			}
		} else {
			int c, x; cin >> c >> x; c--;
			int cr = root(c);
			if (club[cr] && club[cr]!=x) {
				ans = i;
				break;
			}
			club[root(c)] = x;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int f(int *n,int l,int min,int max){
  int r=1,i,j,s[10000];
  for(s[i=0]=min-1;i<l;i++){
    for(s[j=r]=max+1;s[j-1]>=n[i];j--);
    s[j]=n[i];
    if(j==r)r++;
  }
  return r-1;
}
int main(){
  int n,m,a[110][2],b[110][2],c[210],i,j,ar,br;
  while(scanf("%d",&n),n){
    for(i=ar=0;i<n;i++)scanf("%d %d",&a[i][0],&a[i][1]);
    scanf("%d",&m);
    for(i=br=0;i<m;i++)scanf("%d %d",&b[i][0],&b[i][1]);
    a[n][0]=b[m][0]=10000;
    for(i=0;i<n+m;i++){
      if     (a[ar][0]<b[br][0])c[i]=a[ar++][1];
      else if(a[ar][0]>b[br][0])c[i]=b[br++][1];
      else{
	if   (a[ar][1]<b[br][1])c[i]=b[br++][1];
	else                    c[i]=a[ar++][1]; 
      }
    }
    printf("%d\n",f(c,n+m,0,1000));
  }
  return 0;
}

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

#define    ll     long long int

const int N = 200005;
vector<int> g[N];
int n, m;

int main( )
{
    cin >> n >> m;
    int i, j, k, u, v;
    for (i = 1; i <= m; i++) {
        cin >> j >> k;
        g[j].push_back(k);
        g[k].push_back(j);
    }
    for (i = 0; i < (int) g[1].size(); i++) {
        u = g[1][i];
        for (j = 0; j < (int) g[u].size(); j++) {
            v = g[u][j];
            if (v == n) {
                cout << "POSSIBLE\n";
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE\n";
    return 0;
}



Measured memory_bytes: 12016
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 10000000
#define INFTY 10000000

int H,A[MAX+1];
void maxHeapify(int i){
  int l,r,largest;
  l=2*i;
  r=2*i+1;
  if(l<=H && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest])largest=r;
  if(largest!=i){
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int maxcost;
  if(H<1)return -INFTY;
  maxcost=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return maxcost;
}

void increaseKey(int i,int key){
  if(key<A[i])return;
  A[i]=key;
  while(i>1&&A[i/2]<A[i]){
    swap(A[i],A[i/2]);
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];
  while(1){
    scanf("%s", com);
    if(com[0]=='e'&& com[1]=='n')break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n", extract());
    }
  }
  return 0;
}

Measured memory_bytes: 6660
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    int[] ss, ls, ps;
    foreach (_; 0..N) {
        auto slp = readln.split.to!(int[]);
        ss ~= slp[0];
        ls ~= slp[1];
        ps ~= slp[2];
    }
    auto DP = new int[][](N+1, 393+1);
    foreach (ref dp; DP) dp[] = int.min;
    DP[0][0] = 0;
    foreach (i; 0..N) {
        foreach (f; 0..393+1) {
            DP[i+1][f] = max(DP[i+1][f], DP[i][f]);
            foreach (d; ss[i]..ls[i]+1) {
                if (f+d <= 393) DP[i][f+d] = max(DP[i][f+d], DP[i][f] + ps[i]);
            }
        }
    }
    foreach (i; 1..N+1) {
        foreach (f; 0..393+1) {
            DP[i][f] = max(DP[i][f], DP[i-1][f]);
        }
    }
    auto M = readln.chomp.to!int;
    int[] res;
    foreach (_; 0..M) {
        auto m = DP[N][readln.chomp.to!int];
        if (m <= 0) {
            writeln(-1);
            return;
        }
        res ~= m;
    }
    foreach (r; res) writeln(r);
}


Measured memory_bytes: 3148
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

H, W, N = list(map(int, sys.stdin.readline().split()))
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]

hist = set()

count = defaultdict(int)
for a, b in AB:
    for dx, dy in itertools.product([0, 1, 2], repeat=2):
        count[(a + dx, b + dy)] += 1
ans = [0] * 10
for [a, b], cnt in count.items():
    if 3 <= a <= H and 3 <= b <= W:
        ans[cnt] += 1
print((H - 2) * (W - 2) - sum(ans[1:]))
print('\n'.join(map(str, ans[1:])))


Measured memory_bytes: 200832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
long long gcd(long long a, long long b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}
int main() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    rep(i, n) cin >> a[i];
    ll ans = gcd(a[0], a[1]);
    rep(i, n) {
        ans = gcd(ans, a[i]);
    }
    cout << ans << endl;
    return 0;
}



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

#define ll long long

ll n;
ll a[20];
ll x[20][20];
ll y[20][20];
 
ll co(ll x) {
    if(x == 0) return 0;
    return co(x >> 1) + (x & 1);
}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
    
    cin>>n;
    for(ll i = 1; i <= n; i++)
    {
        cin >> a[i];
        for(ll j = 1; j <= a[i]; j++) 
        {
            cin >> x[i][j] >> y[i][j];
        }
    }
    
    ll ans1 = 0;
    for(ll b = 1; b < (1 << n); b++) 
    {
        bool ok = true;
        for(ll i = 1; i <= n; i++) 
        {
            if(!(b & (1 << (i-1)))) 
            continue;
            for(ll j = 1; j <= a[i]; j++) 
            {
                if(((b >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans1 = max(ans1, co(b));
    }
    
    cout<<ans1<<endl;
    return 0;
}

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

int main() {
	int s;
	set<int> S;
	cin >> s;
	int i = 1;
	while (S.find(s) == S.end()) {
		S.insert(s);
		i++;
		s = (s % 2 == 0 ? s / 2 : 3 * s + 1);
	}
	cout << i << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int ans[24],pips[6],dice[6][6] = {{10,2,4,1,3,10},{3,10,0,5,10,2},{1,5,10,10,0,4},{4,0,10,10,5,1},{2,10,5,0,10,3},{10,3,1,4,2,10}};
	int i,j,k,l,top,front,right,q,a,b;

	for(i = 0;i < 6;i++){
		scanf("%d",&pips[i]);
	}
	scanf("%d",&q);
	for(j = 0;j < q;j++){
		scanf("%d %d",&a,&b);
                for(k = 0;k < 6;k++){
			if(pips[k] == a)top = k;
		}
		for(l = 0;l < 6;l++){
			if(pips[l] == b)front = l;
		}
		right = dice[top][front];
                ans[j] = pips[right];
	}
	for(j = 0;j < q;j++){
		printf("%d\n",ans[j]);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	map<int, int> prev;
	map<int, int> m;
	for(string s; getline(cin, s);) {
		if(s == "") break;
		rep(i,s.length()) if(s[i] == ',') s[i] = ' ';
		istringstream is(s);
		int a, b;
		is >> a >> b;
		prev[a]++;
	}
	for(string s; getline(cin, s);) {
		rep(i,s.length()) if(s[i] == ',') s[i] = ' ';
		istringstream is(s);
		int a, b;
		is >> a >> b;
		if(prev.find(a) != prev.end()) {
			m[a]++;
		}
	}
	each(it, m) {
		int sum = it->second + prev[it->first];
		cout << it->first << " " << sum << endl;
	}
	return 0;
}

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

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 2e6 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 4e3 + 17;

int n;
ll a[maxn];

bool read() {
    if (scanf("%d", &n) != 1)
        return false;

    for (int i = 0; i < n; ++i)
        scanf("%lld", a + i);

    return true;
}

void solve() {
    int mn = min_element(a, a + n) - a;
    int mx = max_element(a, a + n) - a;
    vector< pair<int, int> > ans;

    if (a[mx] <= 0 || abs(a[mn]) > abs(a[mx])) {
        for (int i = 0; i < n; ++i)
            if (i != mn) {
                ans.push_back(make_pair(mn, i));
                a[i] += a[mn];
            }

        for (int i = n - 1; i > 0; --i)
            if (a[i - 1] > a[i]) {
                a[i - 1] += a[i];
                ans.push_back(make_pair(i, i - 1));
            }
    } else {
        for (int i = 0; i < n; ++i)
            if (i != mx) {
                ans.push_back(make_pair(mx, i));
                a[i] += a[mx];
            }

        for (int i = 0; i + 1 < n; ++i)
            if (a[i] > a[i + 1]) {
                a[i + 1] += a[i];
                ans.push_back(make_pair(i, i + 1));
            }
    }

    printf("%d\n", sz(ans));

    for (auto i : ans)
        printf("%d %d\n", i.first + 1, i.second + 1);
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


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

int main() {
 ll N,M;
 cin >> N >> M;
 ll ans = 0;//必要な額
 ll c = M;//残りの本数
  
 vector<pair<ll,ll>> p(N);
 for(ll i = 0;i<N;i++){
    cin >> p[i].first;
    cin >> p[i].second;
 }
  
 sort(p.begin(),p.end());
  
 for(ll i = 0;i<N;i++){
   if(p[i].second <= c){
     ans += p[i].second*p[i].first;
     c -= p[i].second;
   }
   else if(p[i].second > c){
    ans += c*p[i].first;
    c = 0;
    }
   if(c == 0) break;
 }
  cout << ans << endl;

    
}


Measured memory_bytes: 1792
#include <stdio.h>

int main ()
{
    int a, b, c, x, i, j, k, cnt=0;
    scanf("%d%d%d%d", &a, &b, &c, &x);
    for (i=0; i <= a && 500*i<=x; i++)
    {
        for (j=0; j <= b && 100*j+500*i<=x; j++)
        {
            for (k=0; k <= c && 50*k+100*j+500*i<=x; k++)
            {
                if (500*i+100*j+50*k==x)
                {
                    cnt++;
                }
            }
        }
    }
    
    printf("%d", cnt);
        
    return 0;
}

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

int main()
{
	char X, Y;
	cin >> X >> Y;

	int x, y;
	
	if (X == 'A')
		x = 10;
	if (X == 'B')
		x = 11;
	if (X == 'C')
		x = 12;
	if (X == 'D')
		x = 13;
	if (X == 'E')
		x = 14;
	if (X == 'F')
		x = 15;

	if (Y == 'A')
		y = 10;
	if (Y == 'B')
		y = 11;
	if (Y == 'C')
		y = 12;
	if (Y == 'D')
		y = 13;
	if (Y == 'E')
		y = 14;
	if (Y == 'F')
		y = 15;

	if (x > y)
		cout << ">";
	if (x == y)
		cout << "=";
	if (x < y)
		cout << "<";

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll mod = 1'000'000'007;
// constexpr int max_n = 200'000 + 5;

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    int n; cin >> n;
    cout << 10 - n / 200 << endl;

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <deque>
using namespace std;

struct Process
{
  string name;
  int    time;
};

int main(void)
{
  int N;
  int Q;
  Process p;
  deque<Process> que;
  int time = 0;

  cin >> N >> Q;
  
  for (int i=0; i<N; ++i) {
    cin >> p.name >> p.time;
    que.push_back(p);
  }
  
  while (!que.empty()) {
    p = que.front();
    que.pop_front();
    if (p.time <= Q) {
      time += p.time;
      cout << p.name << " " << time << endl;
    } else {
      time += Q;
      p.time -= Q;
      que.push_back(p);
    }
  }
  return 0;
}

Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main()
{
string s,s1,s2;
cin>>s>>s1>>s2;
for(int i=0;i<s.size();i++)
{
    cout<<s[0];
    break;
}
for(int i=0;i<s1.size();i++)
{
    cout<<s1[1];
    break;
}
for(int i=0;i<s2.size();i++)
{
    cout<<s2[2];
    break;
}

}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
	int n, l;
	cin >> n >> l;
	vector<string> s(n);
	for (int i = 0; i < n; i++){
		cin >> s[i];
	}
	sort(all(s));
	string ans = "";
	for (auto &str: s) ans += str;
	cout << ans << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

static ll MOD = 1'000'000'007;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  ll res = 0;
  for (int i = 0; i < n; i++) {
    // 転倒数 a内
    // 転倒数 全体
    ll ina = 0;
    ll inTotal = 0;
    for (int j = i + 1; j < n; j++) {
      if (a.at(i) > a.at(j)) {
        ina++;
      }
    }
    for (int j = 0; j < n; j++) {
      if (a.at(i) > a.at(j)) {
        inTotal++;
      }
    }
    res += (ina * k) % MOD;
    res %= MOD;
    res += (inTotal * (((ll) k * (k - 1)) / 2 % MOD)) % MOD;
    res %= MOD;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3632
A = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
B = [int(input()) for i in range(n)]
C = []
for a in A:
    a = ['o' if x in B else x for x in a]
    C.append(a)
for c in C:
    if c==['o','o','o']:
        print('Yes')
        exit()
for c in zip(*C):
    if list(c)==['o','o','o']:
        print('Yes')
        exit()
if C[0][0]==C[1][1]==C[2][2]=='o' or C[0][2]==C[1][1]==C[2][0]=='o':
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C;
  cin>>A>>B>>C;
  
  
  bool check=false;
  
  for(int i=1;i<B;i++){
    if(i*A%B==C){
      check=true;
      break;
    }
  }
  
  if(check){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

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

long long rec(string s){
    long long ans = 0;
    int s_len = s.length();
    if(s_len == 1){
        return stol(s);
    }

    for(int i=1; i<s_len; i++){
        ans += stol(s.substr(0, i)) * (1 << (s_len-1-i)) + rec(s.substr(i,s_len+1-i));
    }
    return ans + stol(s);
}

int main(){
    string s;
    cin >> s;
    cout << rec(s) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_map>

//#include"GraphAlgorithm.hpp"
//#include"DataStructure.hpp"
//using namespace graph_algorithm;
//using namespace data_structure;

using namespace std;

const double pi=4*atan(1.0);

int mod=1000000007;

//int(leaf),int(height)
pair<int,int> get_height_dfs_helper(int root,const vector<vector<pair<int,int>>>& WeightEdges,vector<bool>& IsVisit,vector<int>& Parents){
	if(WeightEdges.empty() || Parents.empty() || WeightEdges.size()!=Parents.size() || root<0 || WeightEdges.size()-1<root)return make_pair(-1,-1);

	IsVisit[root]=true;
	pair<int,int> ans=make_pair(-1,-1);
	for(const auto& val:WeightEdges[root]){
		if(!IsVisit[val.first]){
			Parents[val.first]=root;
			auto tmp=get_height_dfs_helper(val.first,WeightEdges,IsVisit,Parents);
			if(ans.second<tmp.second+val.second){
				tmp.second+=val.second;
				ans=tmp;
			}
		}
	}

	if(ans.first<0)return make_pair(root,0);
	else return ans;
}

//int(leaf),int(height)
pair<int,int> get_height_dfs(int root,const vector<vector<pair<int,int>>>& WeightEdges,vector<int>& Parents){
	if(WeightEdges.empty() || root<0 || WeightEdges.size()-1<root)return make_pair(-1,-1);

	vector<bool> IsVisit(WeightEdges.size(),false);
	return get_height_dfs_helper(root,WeightEdges,IsVisit,Parents);
}

int main() {
	int n;
	cin>>n;
	vector<vector<pair<int,int>>> Edges(n);
	for(int i=0;i<n-1;++i){
		int u,v,w;
		cin>>u>>v>>w;
		Edges[u].push_back(make_pair(v,w));
		Edges[v].push_back(make_pair(u,w));
	}

	vector<int> Parents(Edges.size(),-1);
	auto farthest=get_height_dfs(0,Edges,Parents);

	for(auto& val:Parents)val=-1;
	farthest=get_height_dfs(farthest.first,Edges,Parents);

	//int(vertex),int(Height)
	vector<pair<int,int>> FarthestPath;
	FarthestPath.reserve(Edges.size());
	int vertex=farthest.first;
	int length=0;
	while(vertex>=0){
		FarthestPath.push_back(make_pair(vertex,max(length,farthest.second-length)));
		
		for(const auto& val:Edges[vertex]){
			if(val.first==Parents[vertex]){
				length+=val.second;
			}
		}

		vertex=Parents[vertex];
	}

	vector<bool> IsVisit(Edges.size(),false);
	for(const auto& val:FarthestPath)
		IsVisit[val.first]=true;

	vector<int> Ans(Edges.size(),0);
	for(const auto& val:FarthestPath){
		
		queue<pair<int,int>> Q;
		Q.push(val);
		while(!Q.empty()){
			auto now=Q.front();
			Q.pop();
			Ans[now.first]=now.second;

			for(const auto& edge:Edges[now.first]){
				if(!IsVisit[edge.first]){
					IsVisit[edge.first]=true;
					Q.push(make_pair(edge.first,now.second+edge.second));
					Ans[edge.first]=now.second+edge.second;
				}
			}
		}
	}

	for(const auto& val:Ans){
		cout<<val<<"\n";
	}

	//system("pause");
	return 0;
}

Measured memory_bytes: 4464
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
public static void main(String[] args) throws IOException {

BufferedReader br =new BufferedReader (new InputStreamReader (System.in));

String line = br.readLine( );
String[] list = line.split(" ");
int x = Integer.parseInt(list[0]);
int a = Integer.parseInt(list[1]);
int y=Integer. parseInt(list[2]);

String h="NO";

if(x==5|x==7|a==5|a==7|y==5|y==7){
if(x+y+a==17){
h="YES";
}}

System. out. println(h);

}}


Measured memory_bytes: 21332
# D - XXOR

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

count_1_per_bit = [0] * (len(bin(K)) - 2)
for a in A:
    for k_digit in range((len(bin(K)) - 2)):
        if a & (1 << k_digit):
            count_1_per_bit[k_digit] += 1
            
optimal_x = 0
for k_digit in reversed(range((len(bin(K)) - 2))):
    if optimal_x + (1 << k_digit) <= K and count_1_per_bit[k_digit] <= N//2:
        optimal_x += (1 << k_digit)

print(sum([a^optimal_x for a in A]))

Measured memory_bytes: 14208
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;

int main(){
  int N; int D; cin>>N>>D;
  int x[100][100];
  int ans = 0;

  int heihou[1000];

  for(int i=0;i<=999;i++){
    heihou[i] = i*i;
  }

  for(int i=1;i<=N;i++){
    for(int j=1;j<=D;j++){
      cin>>x[i][j];
    }
  }


  for(int i=1;i<=N;i++){
    for(int j=i+1;j<=N;j++){
      ll dist2 = 0;
      for(int k=1;k<=D;k++){
        dist2 += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
      }
      for(int k=0;k<=999;k++){
        if(dist2 == heihou[k]) ans++;
        if(heihou[k] > dist2) break;
      }



    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  int n;
  cin >> n;
  vector<vector<Pll>> g(n);
  vll dis(n);
  rep(i,n-1) {
    ll u, v, w;
    cin >> u >> v >> w;
    u--; v--;
    g[u].push_back(Pll(v,w));
    g[v].push_back(Pll(u,w));
  }
  rep(i,n) dis[i] = -1;
  dis[0] = 0LL;
  queue<ll> q;
  q.push(0LL);
  while(!q.empty()) {
    ll v = q.front();
    q.pop();
    for(auto e : g[v]) {
      if(dis[e.first]!=-1) continue;
      dis[e.first] = dis[v] + e.second;
      q.push(e.first);
    }
  }
  rep(i,n) {
    if(dis[i]%2==0) cout << 0 << endl;
    else cout << 1 << endl;
  }
  // rep(i,n) cout << dis[i] << endl;
  return 0;
}

Measured memory_bytes: 8704
//ΔARC093C
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 111111;
int n,a[N],b[N];
int main()
{
	int i,x;
	LL s=0;
	scanf("%d",&n);
	for(i=1;i<=n+1;i=i+1){
		if(i<=n)
			scanf("%d",a+i);
		b[i]=max(a[i]-a[i-1],a[i-1]-a[i]);
		s+=b[i];
	}
	for(i=1;i<=n;i=i+1)
		cout<<s-b[i]-b[i+1]+max(a[i+1]-a[i-1],a[i-1]-a[i+1])<<endl;
	return 0;
}

Measured memory_bytes: 2048
N, M = map(int, input().split())
ab = []
cd = []
for i in range(N):
    ab.append(list(map(int,input().split())))

for i in range(M):
    cd.append(list(map(int,input().split())))

for sx,sy in ab:
    dist_min = float('inf')
    num_min = -1
    for i in range(M):
        tmp = abs(sx-cd[i][0]) + abs(sy-cd[i][1])
        if dist_min > tmp:
            num_min = i + 1
            dist_min = tmp
    print(num_min)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000008
int w[300][300],dist[300][300];
int main()
{
    int n,i,j,k;
    long long ans=0,sum=0;
    cin>>n;
    for(i=0; i<n; i++)
    {
        for(j=0; j<n; j++)
        {
            cin>>dist[i][j];
            sum+=dist[i][j];
            //dist[i][j]=w[i][j];
        }
    }
    for(i=0; i<n; i++)
    {
        dist[i][i]=inf;
    }
    for (k = 0; k < n; k++)
    {
        // Pick all vertices as source one by one
        for (i = 0; i < n; i++)
        {
            // Pick all vertices as destination for the
            // above picked source
            for (j = i+1; j < n; j++)
            {
                if (dist[i][k] + dist[k][j] == dist[i][j])
                {
                    if(!w[i][j])
                    {
                        //cout<<dist[i][j]<<endl;
                        ans+=dist[i][j];
                        w[i][j]=1;
                    }
                }
                if (dist[i][k] + dist[k][j] < dist[i][j])
                {
                    dist[i][j] = dist[i][k] + dist[k][j];
                    printf("-1\n");
                    return 0;
                }
            }
        }
    }
    cout<<(sum/2)-ans<<endl;
}


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

int main(){
    int N;
    int result=1;
    cin>>N;

    while(true){
        if(result<N){
            result*=2;
        }else{
            break;
        }
    }

    if(result>N){
        cout<<result/2<<endl;
    }else{
        cout<<result<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int q;
    cin >> q;
    set<int> s;
    while (q--) {
        int c, x;
        cin >> c >> x;
        if (c == 0) {
            s.emplace(x);
            cout << sz(s) << endl;
        } else if (c == 1) {
            cout << s.count(x) << endl;
        } else if (c == 2) {
            s.erase(x);
        }
    } 
}



Measured memory_bytes: 12504
n, m, k = map(int, input().split())
flag = 0

for i in range(n+1):
    for j in range(m+1):
        if (i*m + j*n) -(2*i*j) == k:
            flag = 1
            break

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
   ll k,ans = 0;
   string n;
   cin >> n;
   stack<char> a;
   a.push(n[0]);
   for(int i = 1; i < n.size() ; i ++){
   	if(a.size() > 0){
   	if(a.top() == '0' && n[i] == '1'){
   			ans += 2;
   			a.pop();
		}
		else if(a.top() == '1' && n[i]== '0'){
			ans += 2;
			a.pop();
		}
		else
		a.push(n[i]);
	}
	else
	a.push(n[i]);
   }
   cout << ans <<"\n";
}  

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;

signed main(){
  ll n;cin >> n;
  vector< vector<ll> > a(n,vector<ll>(n,0));
  vector< vector<ll> > b(n,vector<ll>(n,0));
  for(ll i=0;i<n;i++)for(ll j=0;j<n;j++) cin >> a[i][j];
  bool f=false;
  for(ll k=0;k<n;k++){
    for(ll i=0;i<n;i++){
      for(ll j=0;j<n;j++){
        if(a[i][j]>a[i][k]+a[k][j]){
          f=true;
        }else if(i!=j and i!=k and j!=k and a[i][j]==a[i][k]+a[k][j]){
          b[i][j]=1;
        }
      }
    }
  }
  if(f){
    cout << -1 << endl;
  }else{
    ll cnt=0;
    for(ll i=0;i<n;i++){
      for(ll j=0;j<n;j++){
        if(b[i][j]==0){
          cnt+=a[i][j];
        }
      }
    }
    //ここでミスった最悪
    //戻り値は整数型ではない
    cout << ll(cnt/2) << endl;
  }
}


Measured memory_bytes: 1664
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:30:06 2020

@author: divyarth
"""

import sys
import heapq
import math

#sys.setrecursionlimit(100000)
#input=sys.stdin.readline
#print=sys.stdout.write

from collections import deque
from collections import defaultdict
from collections import Counter

modH=int(10**9)+7
I=lambda : list(map(int,input().split(' ')))
def PRINT(lst,sep=' '): print(sep.join(map(str,lst)))

s=input()
stack=[]
mm=0
for i in range(len(s)):
    if s[i]=='R':
        stack.append('R')
    else:
        cnt=0
        while len(stack):
            stack.pop()
            cnt+=1
        mm=max(mm,cnt)        
cnt=0
while len(stack):
    stack.pop()
    cnt+=1
mm=max(mm,cnt)
print(mm)

    


Measured memory_bytes: 65172
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
	Scanner sc=new Scanner(System.in);
	int N=sc.nextInt();
	int M=sc.nextInt();
	int X=sc.nextInt();
	int C[]=new int[N];
	int A[][]=new int[N][M];
	int B[]=new int[M];
	int Cmax=0;
	for(int i=0;i<N;i++) {
		C[i]=sc.nextInt();
		for(int j=0;j<M;j++) {
		A[i][j]=sc.nextInt();
		B[j]=0;
		}
	}
	for(int i=0;i<Math.pow(2, N);i++) {
		String bin=Integer.toBinaryString(i);
		int Ct=0;
		for(int j=0;j<bin.length();j++) {
			int b=bin.length()-j-1;
		String a=bin.substring(b,b+1);
		if(a.equals("1")) {
			Ct+=C[j];
			for(int k=0;k<M;k++) {
				B[k]+=A[j][k];
			}
		}
		}
		
		int tot=0;
		for(int j=0;j<M;j++) {
			if(B[j]>=X) {
				tot++;
				}
		}
		if(tot==M) {
			if(Cmax==0) {
				Cmax=Ct;
			}
			else{
				Cmax=Math.min(Ct,Cmax);
			}
		}
		for(int j=0;j<M;j++) {
			B[j]=0;
			}
		
	}
	if(Cmax==0) {
		System.out.println(-1);
	}
	else {
		System.out.println(Cmax);
	}
	}
	
}


Measured memory_bytes: 40872
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
int S[100001];
int dp[100001];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N, M;
    cin >> N >> M;
    for(int i = 0; i <= N; i++){
        char c;
        cin >> c;
        S[i] = c-'0';
    }
    dp[N] = 0;
    int cur = N;
    int l = N;
    int prev = N;
    //cout << 'H' << endl;
    while(cur != 0 && l != 0){
        //cout << 'H' << ' ' << prev << endl;
        for(int i = l-1; i >= max(0, prev-M); i--){
            if(S[i] == 0) cur = i;
            l = i;
            //cout << i << endl;
        }
        dp[cur] = dp[prev]+1;
        
        if(cur == prev) break;
        prev = cur;
    }
    if(cur == 0){
        int prev = 0;
        for(int i = 1; i < N; i++){
            if(dp[i] != 0) {
                cout << i-prev << ' ';
                prev = i;
            }
        }
        cout << N-prev << endl;
    }else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 1280
import sys
input = sys.stdin.readline
from operator import itemgetter

def main():
	n = int(input().strip())
	v = list(map(int, input().strip().split()))
	diff = []
	for i in range(n-1):
		diff.append(v[i+1] - v[i])
	ans = 0
	tmp = 0
	for k in diff:
		if k > 0:
			ans = max(ans, tmp)
			tmp = 0
		else:
			tmp += 1
	ans = max(ans, tmp)
	print(ans)

if __name__ == '__main__':
	main()


Measured memory_bytes: 63856
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){


    int a,b,c,C;
    double a_d, b_d, c_d;
    cin >> a >> b >> C;
    a_d = double(a);
    b_d = double(b);
    C = double(C);

    // change to radian
    double C_rad;
    C_rad = C/180.0 * M_PI;

    double S, L, h;

    h = b_d*sin(C_rad);
    S = a_d*h*0.5;
    c_d = sqrt(a_d*a_d + b_d*b_d - 2*a_d*b_d*cos(C_rad));
    L = a_d+b_d+c_d;

    cout << fixed;
    cout << setprecision(10) << S << endl;
    cout << setprecision(10) << L << endl;
    cout << setprecision(10) << h << endl;

    return 0;
}



Measured memory_bytes: 3516
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		HashMap<Integer, Integer> kamikire = new HashMap<Integer, Integer>();
		for (int i = 0; i < N; i++) {
			int num = sc.nextInt();
			if (kamikire.containsKey(num)) {
				int value = kamikire.get(num);
				kamikire.put(num, ++value);
			} else {
				kamikire.put(num, 1);
			}
		}
		int counter = 0;
		for (int i : kamikire.keySet()) {
			if (kamikire.get(i) % 2 != 0) {
				counter++;
			}
		}
		System.out.println(counter);

	}
}


Measured memory_bytes: 61304
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>

using namespace std;

int main(void){
    int N, M;
    cin >> N >> M;
    vector<long long> X(M);
    for(int i = 0; i < M; i++) cin >> X[i];
    
    if(N >= M){
        cout << 0 << endl;
        return 0;
    }

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

    vector<long long> d(M - 1);
    for(int i = 0; i < M - 1; i++){
        d[i] = X[i + 1] - X[i];
    }
    sort(d.rbegin(), d.rend());
    
    long long ans = X[M - 1] - X[0];
    for(int i = 0; i < N - 1; i++) ans -= d[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
while(1):
    n=int(raw_input())
    if n==0:
        break
    else:
        [s,t,b]=raw_input().split()
        rm='ABCDEFGHI'
        nxt={}
        A={}
        B={}
        nxt["A"]='AABD'
        nxt["B"]='ABEC'
        nxt["C"]='CCBF'
        nxt["D"]='ADEG'
        nxt["E"]='BDHF'
        nxt["F"]='CEFI'
        nxt["G"]='GGDH'
        nxt["H"]='GHEI'
        nxt["I"]='IIHF'
        for r in rm:
            A[r]=0
            B[r]=0
        A[s]=1
        for i in range(n):
            for r in rm:
                B[r]=0
            for r in rm:
                for c in nxt[r]:
                    if c==b:
                        B[r]+= A[r]*0.25
                    else:
                        B[c]+= A[r]*0.25
            A=B.copy()
        print A[t]

Measured memory_bytes: 6340
from collections import defaultdict
import queue

N = int(input())
to = defaultdict(list)
for i in range(N - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    to[u].append((v, w))
    to[v].append((u, w))

ans = [-1] * N
ans[0] = 0
q = queue.Queue()
q.put(0)
while not q.empty():
    u = q.get()
    for v, w in to[u]:
        if ans[v] != -1:
            continue
        ans[v] = (ans[u] + w) % 2
        q.put(v)

for i in range(N):
    print(ans[i])


Measured memory_bytes: 86996
#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <bits/stdc++.h>
#include <string>
#include <stdlib.h>
#include <vector>
#include <sstream>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;
int main(){ 
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long x = min(a, b), y = min(c, d);
    cout << x+y;
	return 0;
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int val;
    cin >> val;
    if (k <= val) {
      cnt++;
    }
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct unionfind{
  int par[10010]; // 親ノード  必要に応じて要素数を変えよう
  int rank[10010]; // ランク　必要に応じて要素数を変えよう
  unionfind(int n){
    init(n);
  }
  void init(int n){
    for(int i=0;i<=n;i++){
      par[i]=i;
      rank[i]=1;
    }
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      return par[x] = root(par[x]);
    }
  }
  int size(int x){
    return rank[root(x)];
  }
  bool same(int x,int y) {
    return root(x) == root(y);
  }
  void unite(int x,int y) {
    x=root(x);
    y=root(y);
    if(x==y){
      return;
    }
    if(rank[x]<rank[y]){
      swap(x,y);
    }
    rank[x]=rank[x]+rank[y];
    par[y]=x;
  }
};
int main(){
  int i,n,q,a,b,c;
  scanf("%d %d\n",&n,&q);
  unionfind tree(10005);
  for(i=0;i<q;i++){
    scanf("%d %d %d\n",&a,&b,&c);
    if(a==0){
      tree.unite(b,c);
    }
    else{
      cout << tree.same(b,c) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3304
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
const long long MOD = 1e9 + 7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}



signed main(){
	int N,K;
	cin>>N>>K;
	string s;
	cin >> s;
	int cnt = 0;
	REP(i,(int)s.size()-1){
		if(s[i]==s[i+1])cnt++;
	}
	REP(i,K){
		cnt = min(N-1,cnt+2);
	}
	cout<<cnt<<endl;
}

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

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

const long long MOD = 1000000007;

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(){
  int64_t n;
  int64_t ans=0;
  cin >> n;
  if(n==1) cout << 0 << endl;
  else{
    for(auto p:prime_factor(n)){
      int64_t t=1,a=p.second;
      while(a>=t){
        ans++;
        a-=t;
        t++;
      }
    }
    cout<< ans << endl;
  }
}


Measured memory_bytes: 3636
# 再帰の深さが1000を超えそうなときはこれをやっておく
import sys
sys.setrecursionlimit(10**7)
#二部グラフになっている時の色の塗り分けを聞いている
n=int(input())
es=[[] for i in range(n)]
for i in range(n-1):
  u,v,w=list(map(int,input().split()))
  es[u-1].append([v,w])
  es[v-1].append([u,w])

colors=[0 for i in range(n)]
#深さ優先探索　頂点vをcolorで塗ることを考える
def dfs(v,color):
  colors[v-1]=color
  for i in es[v-1]:
    if i[1]%2==0 and colors[i[0]-1]==0:
      dfs(i[0],color)
    elif i[1]%2==1 and colors[i[0]-1]==0:
      dfs(i[0],(-1)*color)
  return colors

    
a=dfs(1,-1)
for i in a:
  if i==-1:
    print(0)
  else:
    print(1)
  


Measured memory_bytes: 84432
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
char tolowr(char c){//小文字へ
    return(c + 0x20);
}
char toupr(char c){//大文字へ
    return(c - 0x20);
}
int main(){
    string s; getline(cin, s);
    for(int i=0; i<s.size(); i++){
        if('A'<=s.at(i)&&s.at(i)<='Z') s.at(i) += 32;
        else if('a'<=s.at(i)&&s.at(i)<='z') s.at(i) -= 32;
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/

int main() {
  int n;
  cin >> n;
  int count=0;
  int tmp;
  rep(i,n){
    cin >>tmp;
    if(i%2==0 && tmp%2==1){
      count++;
    }
  }
  cout << count;

  return 0;
}


Measured memory_bytes: 3584