akhauriyash/Code-Regression huggingface dataset:
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>
#include <numeric>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);j++)
#define frk(n) for(k=0;k<(n);k++)
#define frl(n) for(l=0;l<(n);l++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vvvd vector<vector<vector<double>>>


//#define int long long

using namespace std;


const int MAX = 510000;

ll mod_inverse(int a,int M){
	int x=M-2;
	ll temp=a;
	ll ret=1;
	//a^(MOD-1)==1(mod MOD)を利用
	//a^-1==a^(MOD-2) (mod MOD)を繰り返し二乗法で求める

	while(x!=0){
		if(x%2==1){
			ret=(ret*temp)%M;
		}
		temp=(temp*temp)%M;
		x=x/2;
	}
	return ret;
}

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

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

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

signed compare_int(const void *a, const void *b)
{
	int *A = (int *)a;
	int *B = (int *)b;
	if (*A < *B) return 1;
	if (*A > *B) return -1;
	return 0;
}


int gcd(int a,int b){
	while(1==1){
		if(a==0||b==0){
			return a+b;
		}else if(a>b){
			a %= b;
		}else{
			b %= a;
		}
	}
}

signed main(void)
{
	//変数の宣言
	long long n,m,a,b;
	int h,w;
	static int s[100010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int temp3=0;
	vector<int> vec;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	static char stemp[100010];
	vvi graph;

	//データの読み込み


	scanf("%lld %lld %lld",&a,&b,&n);
	//scanf_s("%lld %lld %lld",&a,&b,&n);


	//scanf("%s",&s);
	//scanf_s("%s",&s,200010);


	/*for(i=0;i<n;i++){
	//scanf("%lld",&a[i]);
	scanf_s("%lld",&a[i]);
	}*/

	/*for(i=0;i<q;i++){
	//scanf("%d",&s[i]);
	scanf_s("%d",&s[i]);
	}*/



	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	//	clock_t start=clock();
	//	COMinit();

	n=min(n,b-1);

	printf("%lld",a*n/b);

	//	clock_t end=clock();

	//	printf("計算部分終了\n");

	//出力

	//printf("%d",(d[i-1][j-1]+1)/2);

	//	printf("time=%lf",(double)(end-start)/CLOCKS_PER_SEC);
	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 3788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=2e5+1;
int a[N],num[N];
 
int check(int x)
{
    if(x==a[x])return a[x];
    else return a[x]=check(a[x]);
}
 
void unionn(int x,int y)
{
    int aa=check(x);
    int bb=check(y);
    if(aa==bb) return ;
    a[bb]=aa;
 
    num[aa]+=num[bb];//很重要 -- ?序
}
 
int main()
{
    int m,n,x,y;
    cin>>n>>m;
        for(int i=1;i<N;i++)
        {
            a[i]=i;
            num[i]=1;
        }
        while(m--)
        {
            scanf("%d%d",&x,&y);
            unionn(x,y);
        }
        int ans=0;
        for(int i=1;i<N;i++)
        {
            if(a[i]==i)
                ans=max(ans,num[i]);
        }
        printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 5348
from itertools import combinations, chain, product

H, W, K = map(int, input().split())
board = [input() for _ in range(H)]

h_patterns = list(chain.from_iterable([set(combinations(range(H), i)) for i in range(H+1)]))
w_patterns = list(chain.from_iterable([set(combinations(range(W), i)) for i in range(W+1)]))

ans = 0
for h_pattern, w_pattern in product(h_patterns, w_patterns):
    
    count = 0
    for i in range(H):
        for j in range(W):
            if i in h_pattern or j in w_pattern:
                continue
            if board[i][j] == '#':
                count += 1
    
    if count == K:
        ans += 1
print(ans)

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


int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i, n)
    cin >> v[i];
  int ans = 0;
  rep(l, min(n + 1, k + 1))
    rep(r, min(n + 1, k + 1) - l)
      rep(d, k + 1 - l - r)
      {
        vector<int> g(l + r);
        rep(i, l)
          g.push_back(v[i]);
        rep(i, r)
          g.push_back(v[n-1-i]);
        sort(g.begin(), g.end());
        int total = 0;
        rep(i, g.size())
          if (i >= d || g[i] > 0)
            total += g[i];
        ans = max(ans, total);
      }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,i;
  int A[120];
  double sum = 0.0;
  cin >> N;
  for(i=0;i<N;i++){
      cin >> A[i];
  }

  for(i=0;i<N;i++){
      sum += 1.0/(double)A[i];
  }

  cout << (1.0/sum) << endl;
  

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int const MAXn = (1 << 18) + 2;

int arr[MAXn];

struct par{
    int num;
    int id;
    int num2;
    int id2;
}mask[MAXn];

bool cmp(pair < int , int > a, pair < int , int > b){
    return a.f > b.f;
}


void funt(int pos1, int pos2){
    if(!mask[pos2].num){
        mask[pos2] = mask[pos1];
        return;
    }
    vector < pair < int , int > > aux;
    if(mask[pos1].num) aux.push_back({mask[pos1].num, mask[pos1].id});
    if(mask[pos1].num2) aux.push_back({mask[pos1].num2, mask[pos1].id2});
    if(mask[pos2].num) aux.push_back({mask[pos2].num, mask[pos2].id});
    if(mask[pos2].num2) aux.push_back({mask[pos2].num2, mask[pos2].id2});
    sort(all(aux), cmp);
    mask[pos2].num = aux[0].f; mask[pos2].id = aux[0].s;
    int i = 1;
    while(i < aux.size() && mask[pos2].id == aux[i].s){
        i++;
    }
    if(i < aux.size()){
        mask[pos2].num2 = aux[i].f; mask[pos2].id2 = aux[i].s;
    }
}

int main(){

  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0; i < (1 << n); i++){
        int x;
        cin>>x;
        mask[i].num = x, mask[i].id = i;
	}
	int sol = 0;
	for(int i = 0; i < (1 << n); i++){
        if(i > 0){
            sol = mx(sol, mask[i].num + mask[i].num2);
            cout<<sol<<"\n";
        }
        for(int j = 0; j < n; j++){
            if(!(i & (1 << j)))
                funt(i, (i ^ (1 << j)));
        }
	}
    return 0;
}


Measured memory_bytes: 7296
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}
bool sosuu_check(int num) {
	int i;
	for (i = 2; i <= sqrt(num); ++i) {
		if (num%i == 0)
			return false;
	}
	return (num < 2) ? false : true;
}



int main() {
	int i;
	cin >> i;
	if (i == 25)
		cout << "Christmas" << endl;
	if (i == 24)
		cout << "Christmas Eve" << endl;
	if (i == 23)
		cout << "Christmas Eve Eve" << endl;
	if (i == 22)
		cout << "Christmas Eve Eve Eve" << endl;
}

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

using namespace std;

int main (void) {
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for ( int i=0; i<H; i++ )
        cin >> a.at(i);

    /* 1行目 */
    for ( int i=0; i<W+2; i++ )
        cout << "#";
    cout << endl;

    for ( int i=0; i<H; i++ )
        cout << "#" +  a.at(i) + "#" << endl;

    /* 最終行 */
    for ( int i=0; i<W+2; i++ )
        cout << "#";
    cout << endl;

    return 0;
}


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

using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main() {
    ll h, w;
    cin >> h >> w;

    vector<vector<char>> v(h, vector<char>(w));
    vector<vector<ll>> ways(h, vector<ll>(w,0));
    for(ll i = 0; i < h; i++) {
        for(ll j = 0; j < w; j++) {
            cin >> v[i][j];
        }
    }

    ways[0][0] = 1;
    for(ll i = 0; i < h; i++) {
        for(ll j = 0; j < w; j++) {
            if(v[i][j] == '#') continue;
            if(i > 0) {
                ways[i][j] += ways[i-1][j];
                ways[i][j] %= mod;
            }
            if(j > 0) {
                ways[i][j] += ways[i][j-1];
                ways[i][j] %= mod;
            }
        }
    }

    cout << ways[h-1][w-1] << endl;
}


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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if((a == b && b != c) || (a == c && b != c) || (b == c && c != a))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


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

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = c - a;
	int y = d - b;
	cout << c - y << " " << d + x << " " << a - y << " " << b + x;
}


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

using namespace std;

int main()
{
    long long N;
    array<int, 1000> X;
    double p = 0;
    cin >> N;
    for(int i = 0; i< N;i++){
        cin >> X[i];
        p += X[i];
    }
    p /= N;
    long long p_n = round(p);
    long long sum = 0;
    for(int i = 0; i < N; i++){
        sum += (X[i] - p_n) * (X[i] - p_n);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, i;
	cin >> n;
	int arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	
	ll ans = 0;
	fo(i, 1, n) {
	    if(arr[i] >= arr[i - 1]) continue;
	    ans += arr[i - 1] - arr[i];
	    arr[i] = arr[i - 1];
	}
	cout << ans;
}

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

int main(){

    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    for(int i = 0; i < N; i++) cin >> h[i];

    vector<long long> dp(1e5+1, 1e10);
    dp[0] = 0;

    for(int i = 0; i < N; i++){
        for(int j = 1; j <= K; j++){
            int jump = (dp[i] + abs(h[i] - h[i + j]));
            if(dp[i + j] > jump) dp[i + j] = jump;
        }
    }

    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;

namespace AtCoderA
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadIntArray(2);
            if (a[0] == a[1])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
S = input()
count1 = 0
count2 = 0

check = 0
for char in S:
    if int(char) != check:
        count1 += 1
    check = (check+1)%2
check = 1
for char in S:
    if int(char) != check:
        count2 += 1
    check = (check+1)%2

print(min([count1,count2]))    
    

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;
typedef long long ll;

const int INF = INT_MAX/3;

int main(){
    int H, W;
    cin >> H >> W;
    while(H!=0 || W!=0){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout << "#" ;
            }
            cout << endl ;
        }
        cout << endl;
        cin >> H >> W;
    }
    return 0;
}

Measured memory_bytes: 3104
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = 0;
		for(int i = 0; i < n; i++) {
			int s = sc.nextInt();
			boolean ok = false;
			for(int j = 1; j <= Math.sqrt(s)+1; j++) {
				if((s - j) % (1 + 2 * j) == 0) {
					ok = true;
					break;
				}
			}
			if(!ok) count++;
		}
		System.out.println(count);
	}
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i < (n)i++)
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define abs(a) llabs(a)
#define int long long
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

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

   int a, b;
   cin >> a >> b;

   if (a == 1)
   {
      if (b == 2)
      {
         cout << 3 << '\n';
      }
      else
      {
         cout << 2 << '\n';
      }
   }
   else if (a == 2)
   {
      if (b == 1)
      {
         cout << 3 << '\n';
      }
      else
      {
         cout << 1 << '\n';
      }
   }
   else
   {
      if (b == 1)
      {
         cout << 2 << '\n';
      }
      else
      {
         cout << 1 << '\n';
      }
   }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nm = Input.ar;
        var ct = new int[nm[0] + 1];
        while(nm[1]-->0)
        {
            var ab = Input.ar;
            ct[ab[0]]++;ct[ab[1]]++;
        }
        WriteLine(ct.All(v => v % 2 == 0) ? "YES" : "NO");
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static string[] strs(int n)
        => Enumerable.Repeat(0, n).Select(_ => read).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)                                                             \
  sort(x.begin(), x.end());                                                    \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y)                                                           \
  cerr << "(" << #x << ", " << #y << ") = "                                    \
       << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

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

  string s;
  cin >> s;

  vector<int> v;

  int ss = s.size();

  rep(i, ss) {
    if (s[i] == '0') {
      v.push_back(0);
    } else if (s[i] == '1') {
      v.push_back(1);
    } else {
      if (v.size() == 0) { continue; }
      v.pop_back();
    }
  }

  for (int i : v) { cout << i; }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
lis = inpl()
counts = [0]*(N+10)
for i in lis:
    counts[i] += 1

S = 0
for i in lis:
    S += counts[i] - 1

S //= 2

for i in lis:
    print(S - counts[i] + 1)

Measured memory_bytes: 26992
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define ppb pop_back
#define F frist
#define S second

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

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

    string s;
    cin >> s;
    for(int i = 0;i<s.size();i++){
        int x = s[i] - '0';
        if(x == 7){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define int         long long
    #define pb          push_back
    #define vi          vector<int>
    #define all(a)      (a).begin(),(a).end()
    #define F           first
    #define S           second
    #define INF         1e18
    const int N = 300 + 5, K = 501;

    void solve(){
        int n;
        cin>>n;
        string s;
        map<string,int> m;
        for(int i=0; i<n; i++){
            cin>>s;
            m[s]++;
        }
        cout<<"AC x "<<m["AC"]<<endl;
        cout<<"WA x "<<m["WA"]<<endl;
        cout<<"TLE x "<<m["TLE"]<<endl;
        cout<<"RE x "<<m["RE"]<<endl;
    }

    int32_t main()
    {
        IOS;
        int TESTS=1;
        // cin>>TESTS;
        while(TESTS--)
        {       
            solve();
        }
        return 0;
    }

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

// Template Headers {{{
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long; using vll = vector<long long>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}

int solve(int n, int m, int p) {
	vpii mvs(p); cin >> mvs;
	for (auto &p : mvs) p.first--, p.second--;
	vector<vvi> hehe(n, vvi(n));
	for (int i = 0; i < p; i++) {
		int ux, uy; tie(ux, uy) = mvs[i];
		int t = i & 1;
		int uz = hehe[ux][uy].size();
		hehe[ux][uy].push_back(t);
		int mxLine = 0;
		for (int dx = -1; dx <= 1; dx++) for (int dy = -1; dy <= 1; dy++) for (int dz = -1; dz <= 1; dz++) {
			if (dx == 0 && dy == 0 && dz == 0) continue;
			int posd = 0, negd = 0;
			auto chk = [&] (int xx, int yy, int zz) {
				if (xx < 0 || xx >= n) return false;
				if (yy < 0 || yy >= n) return false;
				if (zz < 0 || zz >= int(hehe[xx][yy].size())) return false;
				return hehe[xx][yy][zz] == t;
			};
			while (chk(ux + dx * (posd + 1), uy + dy * (posd + 1), uz + dz * (posd + 1))) posd++;
			while (chk(ux + dx * -(negd + 1), uy + dy * -(negd + 1), uz + dz * -(negd + 1))) negd++;
			mxLine = max(mxLine, posd + negd + 1);
		}
		if (mxLine >= m) {
			cout << (t ? "White" : "Black") << ' ' << i + 1 << '\n';
			return 0;
		}
	}
	cout << "Draw" << '\n';
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	// precompute();
	// int t; cin >> t; for (int i=1;i<=t;i++)
	for (;;) {
		int n, m, p; cin >> n >> m >> p;
		if (n == 0 && m == 0 && p == 0) break;
		solve(n, m, p);
	}
	// cout << "Case #" << i << ": ", solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


Measured memory_bytes: 3104
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int i, j;
	int n;
	vector<int>list;


	cin >> n;

	for (i = 0; i < n; i++) {
		int num;
		cin >> num;
		list.push_back(num);
	}

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

	int sum = list[0] / 2;

	for (i = 1; i < n; i++) {
		sum += list[i];
	}
	cout << sum << endl;












	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

typedef long long ll;

const int NIL = -1;
const int MAX = 2147483647;
const int N = 100001;
clock_t START, END;
bool debug = false;

ll minv[500000], addv[500000];
ll ql, qr, p, v;
ll _min;

/*void pushdown(int o)
{
	int lc = o * 2, rc = o * 2 + 1;
	if (addv[o] > 0) {
		addv[lc] = addv[rc] = addv[o];
		addv[o] = 0;
	}
}*/

void maintain(ll o, ll L, ll R)
{
	ll lc = o * 2, rc = 2 * o + 1;
	minv[o] = 0;
	if (R > L) {
		minv[o] = min(minv[lc], minv[rc]);
	}
	minv[o] += addv[o];
}

void query(ll o, ll L, ll R, ll add)
{
	ll M = L + (R - L) / 2;
	if (ql <= L && qr >= R) {
		_min = min(_min, minv[o] + add);
	}
	else {
		if (ql <= M)
			query(o * 2, L, M, add + addv[o]);
		if (qr > M)
			query(o * 2 + 1, M + 1, R, add + addv[o]);
	}
}

void update(ll o, ll L, ll R)
{
	ll M = L + (R - L) / 2;
	ll lc = o * 2, rc = o * 2 + 1;
	if (ql <= L && qr >= R) {
		addv[o] += v;
	}
	else {
		if (ql <= M)
			update(lc, L, M);
		if (qr > M)
			update(rc, M + 1, R);
	}
	maintain(o, L, R);
}


int main(void)
{
	if (debug) {
		START = clock();
		freopen("in12.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int n, q, com;
	scanf("%d%d", &n, &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &com);
		if (com) {
			scanf("%lld%lld", &ql, &qr);
			ql++;
			qr++;
			_min = MAX;
			query(1, 1, n, 0);
			printf("%lld\n", _min);
		}
		else {
			scanf("%lld%lld%lld", &ql, &qr, &v);
			ql++;
			qr++;
			update(1, 1, n);
		}
	}
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 7280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    rep(i, 0, n) {
        int x, y;
        cin >> x >> y;
        if (x == y) cnt++;
        else cnt = 0;
        if (cnt >= 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
ll k,a,b,c,ans;
int main()
{
	scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
	printf("%lld",k&1?b-a:a-b);
	return 0;
}

Measured memory_bytes: 128
( r, c) = [int(i) for i in  input().split()]
num = []
for i in range(r):
    num.append( [ int(i) for i in input().split()])
    #sum r
    num[i].append( sum( num[i]))

# sum c
last_row = [ 0 for _ in range( c+1)]
for rc in range(r):
    for cc in range( c+1):
        last_row[cc] += num[rc][cc]
num.append( last_row)
'''
for i in range(r):
     print( sum( [ num[js] for js in range(c)])
    #last_row[i] = sum( [ num[js] for js in range(c)])
'''

for rc in range( r+1):
    print( ' '.join( [ str(a) for a in num[rc]]))

Measured memory_bytes: 7804
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,x;
    cin>>a; cin>>b; cin>>c;
    if(a>b){
        x=a; a=b; b=x;
    }
    if(b>c){
        x=b; b=c; c=x;
    }
    if(a>b){
        x=a; a=b; b=x;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    
}



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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        long[] a = sc.LongArray();
        long[] afterSum = new long[n + 1];
        for (int i = n; i >= 0; i--)
        {
            if (i == n)
            {
                afterSum[i] = a[i];
            }
            else
            {
                afterSum[i] = a[i] + afterSum[i + 1];
            }
        }

        if (n == 0)
        {
            if (a[0] == 1)
            {
                Console.WriteLine(1);
                return;
            }
            else
            {
                Console.WriteLine(-1);
                return;
            }
        }

        if (a[0] != 0)
        {
            Console.WriteLine(-1);
            return;
        }

        long answer = 1;
        long current = 1;

        for (int i = 1; i <= n; i++)
        {
            current *= 2;
            if (a[i] > current)
            {
                Console.WriteLine(-1);
                return;
            }
            current = Math.Min(afterSum[i], current);
            answer += current;
            current -= a[i];
            if (current < 0)
            {
                Console.WriteLine(-1);
                return;
            }
            if (i == n && current != 0)
            {
                Console.WriteLine(-1);
                return;
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 38268
using System;
using System.Collections.Generic;

class Program {
  static void Main(string[] args) {
    int n = int.Parse(Console.ReadLine());
    Dictionary<int,bool> dict = new Dictionary<int, bool>();
    for (int i = 0; i < n; ++i) {
      int a = int.Parse(Console.ReadLine());
      if (dict.ContainsKey(a)) {
        dict.Remove(a);
      }
      else {
        dict.Add(a, true);
      }
    }

    Console.WriteLine(dict.Count);
  }
}


Measured memory_bytes: 21088
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let x: usize = read();
    let ans = if x == 1 {
        0
    } else {
        1
    };
    println!("{}", ans)
}

#[allow(dead_code)]
fn solve() {
}

#[cfg(test)]
#[allow(unused_imports)]
mod tests {
    #![allow(unused_imports)]
    use super::*;

    #[test]
    fn test1() {
        assert_eq!(true, true);
    }
}


Measured memory_bytes: 2172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ABC125C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var H = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var canSee = 1;
            for (int i = 1; i < H.Count; i++)
            {
                var then = H.Take(i+1).ToArray();
                if (then.Max() == H[i])
                {
                    canSee++;
                }
            }
            Console.WriteLine(canSee);
        }
    }
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

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

static const ll INF = 1e15;

static const ll mod = 1e9 + 7;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int> ds(n);
	rep(i, n) {
		ds[i] = s[i] - '0';
	}
	vector<vector<ll>> dp;
	dp.assign(n, vector<ll>(13, 0));
	if (s[0] == '?') {
		rep(i, 10) {
			dp[0][i] = 1;
		}
	}
	else {
		dp[0][ds[0]] = 1;
	}
	for (int i = 1; i < n; i++) {
		if (s[i] == '?') {
			rep(k, 10) {
				rep(j, 13) {
					auto num = dp[i - 1][j];
					ll m = j * 10 + k;
					m %= 13;
					dp[i][m] += num;
					dp[i][m] %= mod;
				}
			}
		}
		else {
			rep(j, 13) {
				auto num = dp[i - 1][j];
				ll m = j * 10 + ds[i];
				m %= 13;
				dp[i][m] += num;
				dp[i][m] %= mod;
			}
		}
	}
	cout << dp[n - 1][5] << endl;
	return 0;
}
	

Measured memory_bytes: 16928
#include <stdio.h>

int main(void)

{
    int a,b;

    scanf("%d %d",&a,&b);
    if(a==b)
     printf("%d\n",a + b);
    else
     if(b>a)
     printf("%d\n",b + (b - 1));
     else
     printf("%d\n",a + (a - 1));
     

    return(0);
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	sn := 0
	n := N
	for n > 0 {
		sn += n % 10
		n /= 10
	}
	if N%sn == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1768
x, k, d = map(int, input().split())

if x < 0:
    flag = -1
else:
    flag = 1

if abs(x) >= k * d:
    ans = x - k * d * flag
else:
    k -= abs(x) // d
    x = abs(x) % d * flag
    ans = x if k % 2 == 0 else x - d * flag

print(abs(ans))


Measured memory_bytes: 8948
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    sort(s.begin(), s.end());
    do {
        if (s == "abc") {
            cout << "Yes" << endl;
            return 0;
        }
    } while (next_permutation(s.begin(), s.end()));
    cout << "No" << endl;
}


Measured memory_bytes: 256
//ProblemC

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//for
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define forbe(i, begin, end) for(decltype(begin) i = (begin); i != (end); ++i)
#define forbes(i, begin, end, step) for(decltype(begin) i = (begin); i != (end); i += (step))

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
#define fi first
#define se second

//vector
template <typename Value>
static inline void fillv(Value& x, const Value& val) { x = val; }
template <typename Vector, typename Value>
static inline void fillv(Vector& v, const Value& val) { for (auto& x : v) fillv(x, val); }

static inline void Solve();

int main(int argc, char* argv[]) {
#ifdef REDIRECT_STDIO
	REDIRECT_STDIO;
#endif // REDIRECT_STDIO

	Solve();
	return 0;
}

//ProblemC
void Solve() {
	int n, d, m;
	cin >> n >> m >> d;

	double b = (2 * d + 1 > n || d == 0) ? n : 2 * (n - d);
	cout  << setprecision(15) << (m - 1) * b / n / n << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b){
  if (b==0) return a;
  else return gcd(b,a%b);
}


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 1000; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j])%mod;
//       }
//     }
//   }
//   return 0;
// }


// int factorial(int n){
//   if(n == 0) return 1;
//   return n*factorial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   pascal_triangle();
//   return memo[n][k];
// }

// int cans(bool f){
//   if(f) cout << "Yes" << endl;
//   else cout << "No" << endl;
//   return 0;
// }









const int MAX = 510000;
const int MOD = 1000000007;

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

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

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


int main() {
  int N;
  string s;
  cin >> N >> s;
  rep(i,s.size()){
    char c = s[i];
    int num = c - 'A';
    num+=N;
    num%=26;
    num += 'A';
    s[i] = num;
  }
  cout << s << endl;
  return 0;
}




// int main(){
//   ll X,Y,ans=0;
//   cin >> X >> Y;
//   if((X+Y)%3 == 0){
//     ans = combination((X+Y)/3,(2*X-Y)/3);
//   }
//   else ans = 0;
//   cout << ans << endl;
// }










Measured memory_bytes: 256
n,m = map(int, input().split())
H = list(map(int, input().split()))
adjacent = {i: [] for i in range(n)}
for _ in range(m):
    a, b = map(int, input().split())
    adjacent[a-1].append(b-1)
    adjacent[b-1].append(a-1)
good = 0
for i in range(n):
    h = H[i]
    for j in adjacent[i]:
        if h <= H[j]:
            break
    else:
        good += 1
print(good)

Measured memory_bytes: 37904
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define y first
#define x second

using namespace std;
typedef unsigned long long ll;

int main()
{
    int n, t;
    cin >> n >> t;
    int a[n];
    fr(i, 0, n){
        cin >> a[i];
    }
    int mi = a[0];
    int c = 0;

    int di = -1e9;

    fr(i, 1, n){
        if(a[i] > mi){
            if(a[i] - mi > di){
                c = 1;
                di = a[i] - mi;
            }
            else if(a[i] - mi == di){
                c ++;
            }
        }
        else{
            mi = a[i];
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a, b, c=0;
    cin>>b>>a;
    if(2 * b <= a)
    {
        c += b;
        if(a % 2 == 0)
            a -= 2 * b;
        else
            a -= 2 * b;
        while(a >= 4)
        {
            c++;a -= 4;
        }
    }
    else if(2 * b > a)
    {
        c += a / 2;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
a = int(input())
print(a+a*a+a*a*a)

Measured memory_bytes: 10520
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		int n = in.nextInt();
		int l = in.nextInt();
		int[] a = new int[n];
		int p = -1;
		for (int i=0; i<n; i++) {
			a[i] = in.nextInt();
			if (i != 0) {
				if (a[i] + a[i-1] >= l) p = i-1;
			}
		}

		if (p >= 0) {
			out.println("Possible");
			for (int i=0; i<p; i++) {
				out.println(i+1);
			}
			for (int i=n-1; i>p; i--) {
				out.println(i);
			}
		} else {
			out.println("Impossible");
		}
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 25164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef pair<int,int> P;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n,j) for (int i = n; j<i;i--)
#define print(out) cout<< out  << "\n";
#define all(vec) vec.begin(),vec.end()
#define mod 1000000007
const int INF = 1e9;

int main(){
  ll N;string S;cin>>N>>S;
  vector<ll> left_v(N,0), right_v(N,0);
  if(S.at(0)!='E')left_v[0]=1;
  if(S.at(N-1)!='W')right_v[N-1]=1;
  REP(i,1,N){
    if(S.at(i)!='E')left_v[i]=left_v[i-1]+1;
    else left_v[i]=left_v[i-1];
  }
  RREP(i,N-2,-1){
    if(S.at(i)!='W')right_v[i]=right_v[i+1]+1;
    else right_v[i]=right_v[i+1];
  }
  ll ans=min(left_v[N-1],right_v[0]);
  REP(i,1,N-1){
    ans=min(ans,left_v[i-1]+right_v[i+1]);
    
  }
  print(ans)
}


Measured memory_bytes: 5380
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

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

const int DES = 22 ;
const double CTOM = 1 / 100 / 100;
typedef pair<double, int> pp;

int main()
{
    int n, id;
    double h, w, bmi;
    while(cin >> n && n)
    {
        vector<pp> p;
        REP(n) 
        {
            cin >> id >> h >> w;
            h /= 100;
            bmi = w / h / h;

            p.push_back(pp(max(DES-bmi, bmi - DES) , id));
        }
        sort(all(p));
        
        cout << p[0].second << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

constexpr char* S_OUT[31] = {
    "0\n", "1\n", "2\n", "3\n", "4\n", "5\n", "6\n", "7\n", "8\n", "9\n", "10\n",
    "11\n", "12\n", "13\n", "14\n", "15\n", "16\n", "17\n", "18\n", "19\n", "20\n",
    "21\n", "22\n", "23\n", "24\n", "25\n", "26\n", "27\n", "28\n", "29\n", "30\n"
};

constexpr unsigned int InputSize = 3e6;
constexpr unsigned int OutputSize = 3e5;
char Input[InputSize];
char* pointer = Input;
char Output[OutputSize];
char* m_buffer = Output;

inline unsigned int getInt(void){
    unsigned int res = 0;
    do{ res = 10 * res + (*(pointer++) - '0'); } while(*pointer >= '0');
    return res;
}

inline void out(int v){
    char* str = S_OUT[v];
    while(*str) *(m_buffer++) = *(str++);
}

unsigned int n;
unsigned int N;
constexpr unsigned int SIZE = (1U << 19) + 1;
unsigned int data[2 * SIZE];

inline void set(void){
    n = getInt(); N = 1U << (31 - __builtin_clz(n)); while(N < n) N <<= 1;
    ++pointer; // \n
    unsigned int i, j;
    for(i = 0, j = N; i < n; ++i, ++j) data[j] = 1U << (*(pointer++) - 'a');
    for(i = N - 1; i ; --i) data[i] = data[i << 1] | data[(i << 1) | 1U];
}

inline void query(void){
    pointer += 3;
    if(*(pointer - 2) == '1'){
        unsigned int index = getInt() - 1;
        unsigned char idx = *((++pointer)++) - 'a';
        data[index += N] = 1U << idx;
        while(index >>= 1) data[index] = data[index << 1] | data[(index << 1) | 1U];
    }
    else{
        unsigned int l = getInt() + N - 1; pointer++;
        unsigned int r = getInt() + N;
        unsigned int res = 0;
        while(l < r){
            if(l & 1) res |= data[l++]; l >>= 1;
            if(r & 1) res |= data[--r]; r >>= 1;
        }
        out(__builtin_popcount(res));
    }
}

int main(void){
    fread(Input, sizeof(char), InputSize, stdin);
    set(); ++pointer;
    unsigned int q = getInt();
    while(q--) query();
    setvbuf(stdout, 0, _IONBF, 0);
    fputs(Output, stdout);
    return 0;
}


Measured memory_bytes: 6272