akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1 , -1 , 0 , 0};
int fy4[] = {0 , 0 , 1 , -1};
int Kfx[]= {-2,-2,2,2,1,1,-1,-1}; ///knight move x - exis
int Kfy[]= {1,-1,1,-1,2,-2,2,-2}; ///knight move y- exis
int fx8[]= {1,1,1,0,0,-1,-1,-1};
int fy8[]= {0,1,-1,1,-1,0,1,-1};
#define ll long long int
#define pii pair<int,int>
#define llu unsigned long long
#define inf 1<<28
#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define all(r)(r).begin(),(r).end()
/*
bool status[mx];
void sieve(){
   long long int  i,j;
    for(i=2;i<=mx;i++)
    {
        status[i]=0;
    }
    for( i=2;i<=sqrt(mx);i++){
        if(status[i]==0)
        {
            for(j=i*i;j<=mx;j+=i){
                status[j]=1;
            }
        }
    }
}*/
ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;

    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}
#define dd double
#define sc scanf
#define pr printf
#define VI vector<int>
#define VS vector<string>
#define VC vector<char>
#define VLL vector<long long int>
#define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout);
#define p_b push_back
#define mem(x,y) memset(x,y,sizeof(x))
#define F(i,a,b) for(i=a;i<=b;i++)
#define sc1(a) scanf("%d",&a)
#define scL1(a) scanf("%lld",&a)
#define scL2(a,b) scanf("%lld%lld",&a,&b)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define fori(N)          for(int i = 0; i<(N); i++)
#define forj(N)         for(int j = 0; j<(N); j++)
#define fork(N)         for(int k = 0; k<(N); k++)
#define forl(N)         for(int l = 0; l<(N); l++)
#define ford(N)         for(int d = 0; d<(N); d++)
#define fori1(N)          for(int i = 1; i<=(N); i++)
#define forj1(N)         for(int j = 1; j<=(N); j++)
#define fork1(N)         for(int k = 1; k<=(N); k++)
#define ford1(N)         for(int d = 1; d<=(N); d++)
#define sqr(x)           (x)*(x)
#define TEST int test,te=0;cin>>test;
#define segment_tree int l=(n*2),r=(n*2)+1,mid=(l+r)/2
#define Mx 100005
#define mx 10005

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);///Beware of use it, if u use it dont use scanf or printf
    int cnt=0;
    string a;
    cin>>a;
    for(int i=0;i<a.size()/2;i++){
    	if(a[i]!=a[a.size()-i-1])cnt++;
	}
	cout<<cnt<<endl;
}


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

int main() {
    int N;  cin >> N;
    vector<int> p(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        sum += p[i];
    }

    sort(p.begin(), p.end());
    cout << sum - p.back() / 2 << endl;
}

Measured memory_bytes: 256
n500 = int(input())
n100 = int(input())
n50 = int(input())
sum = int(input())

conb = 0
for i in range(n500 + 1):
    for j in range(n100 + 1):
        for k in range(n50 + 1):
            if 500 * i + 100 * j + 50 * k == sum:
                conb += 1
print(conb)

Measured memory_bytes: 3060
/**
*    created: 27.06.2020 19:08:09
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    rep(i,26) rep(j,15) {
        if (4*i + 7*j == n) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int main(void){
int A,B,C,D;
cin>>A>>B>>C>>D;
int a,b;
if(A>B) a=B;
else a=A;
if(C>D) b=D;
else b=C;
cout<<a+b;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define ll long long int
int main(void) {
  ll n;
  ll sum = 0;
  std::cin >> n;
  std::vector<ll> v;
  for (ll i = 1; i <= n; i++) {
    ll x;
    std::cin >> x;
    v.push_back(x - i);
  }
  std::sort(v.begin(), v.end());
  for (ll i = 0; i < n; i++) {
    sum += std::abs(v[i] - v[n / 2]);
  }
  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 2420
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
res=0
for i in range(len(a)):
  tmp=a[i]-b[i]
  if tmp<0:
    tmp+=tmp%2
    tmp=tmp/2
  res+=tmp
if res>0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 4600
import java.util.*;

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

        
        for(int i = k-1; i >= 0; i--)
            System.out.println(x-i);
        for(int i = 1; i < k; i++)
            System.out.println(x+i);
        sc.close();

    }
}

Measured memory_bytes: 25044
#include <iostream>
#include <vector>
#include <map>
#include <string>
using Int = long long int;
using UInt = unsigned long long int;
using namespace std;

int main(void) {
    const static Int MAX_XI_VALUE = 50;
    Int n, a;
    cin >> n >> a;

    vector<vector<vector<Int>> > dp(n + 1, vector<vector<Int> >(n + 1, vector<Int>(n * MAX_XI_VALUE + 1)));

    Int now;
    cin >> now;
    dp[1][1][now] = 1;

    for (Int i = 2; i <= n; ++i) {
        cin >> now;
        dp[i][1][now] = 1;
        for (Int j = 1; j <= i; ++j) {
            for (Int k = 1; k < n * MAX_XI_VALUE + 1; ++k) {
                dp[i][j][k] += dp[i - 1][j][k];
                if (k >= now) {
                    dp[i][j][k] += dp[i - 1][j - 1][k - now];
                }
            }
        }
    }

/*
    cout << "RESULT" << endl;
    for (Int i = 1; i <= n; ++i) {
        for (Int j = 1; j <= n; ++j) {
            for (Int k = 1; k < n * MAX_XI_VALUE + 1; ++k) {
                cout << i << " " << j << " " << k << endl;
                cout << dp[i][j][k] << endl;
            }
        }
    }
*/

    Int result = 0;
    for (Int j = 1; j <= n; ++j) {
        result += dp[n][j][a * j];
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 55160
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1129&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

int n,r;

ll solve(){
    vector<int> s(n);
    iota(s.begin(),s.end(),1); reverse(s.begin(), s.end());
    for(int i = 0; i < r;i++){
        int a,b; cin >> a >> b; a--;
        vector<int> s1(s.begin()+a,s.begin()+a+b),s2(s.begin(),s.begin()+a),s3(s.begin()+a+b,s.end());
        s.clear();
        for(auto v:s1) s.push_back(v);
        for(auto v:s2) s.push_back(v);
        for(auto v:s3) s.push_back(v);
    }
    return *s.begin();
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> n >> r,n|r){
        cout << solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 3064
n,a,b,c = map(int,input().split())
s = [str(input()) for i in range(n)]
lis = [a,b,c]
ans = ""
for i in range(n-1):
    if lis[ord(s[i][0]) - ord("A")] == 0 and lis[ord(s[i][1]) - ord("A")] == 0:
        print("No")
        exit()
    if s[i] == s[i+1]:
        if lis[ord(s[i][0])-ord("A")] == 0:
            ans += s[i][0]
            lis[ord(s[i][0])-ord("A")] += 1
            lis[ord(s[i][1])-ord("A")] -= 1
        else:
            ans += s[i][1]
            lis[ord(s[i][0])-ord("A")] -= 1
            lis[ord(s[i][1])-ord("A")] += 1
    else:
        if s[i] == "AB":
            if s[i+1] == "AC":
                if lis[1] == 0:
                    ans += "B"
                    lis[1] += 1
                    lis[0] -= 1
                else:
                    ans += "A"
                    lis[0] += 1
                    lis[1] -= 1
            else:
                if lis[0] == 0:
                    ans += "A"
                    lis[0] += 1
                    lis[1] -= 1
                else:
                    ans += "B"
                    lis[0] -= 1
                    lis[1] += 1
        elif s[i] == "AC":
            if s[i+1] == "AB":
                if lis[2] == 0:
                    ans += "C"
                    lis[2] += 1
                    lis[0] -= 1
                else:
                    ans += "A"
                    lis[0] += 1
                    lis[2] -= 1
            else:
                if lis[0] == 0:
                    ans += "A"
                    lis[0] += 1
                    lis[2] -= 1
                else:
                    ans += "C"
                    lis[0] -= 1
                    lis[2] += 1
        else:
            if s[i+1] == "AB":
                if lis[2] == 0:
                    ans += "C"
                    lis[2] += 1
                    lis[1] -= 1
                else:
                    ans += "B"
                    lis[2] -= 1
                    lis[1] += 1
            else:
                if lis[1] == 0:
                    ans += "B"
                    lis[1] += 1
                    lis[2] -= 1
                else:
                    ans += "C"
                    lis[2] += 1
                    lis[1] -= 1
if lis[ord(s[-1][0])-ord("A")] == 0:
    if lis[ord(s[-1][1])-ord("A")] == 0:
        print("No")
        exit()
    else:
        ans += s[-1][0]
else:
    ans += s[-1][1]
print("Yes")
for i in range(n):
    print(ans[i])

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int a,b;
  cin >> a >> b;
  cout << a-b+1 << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define  fill(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
#define all(v) v.begin(),v.end()
template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = ch == '-', ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}
 
const int M=1e9 + 7;
const int MAX=1e5+7;
using namespace std;
bool comp(pair<int,int> &a,pair<int,int> &b)
{
	if(a.first!=b.first)
	   return a.first<b.first;
	else
		return a.second>b.second;
}
void printQ(deque<int> q)
{
	for(int i=0;i<q.size();i++)
	{
		cout<<q[i]<<" ";
	}
	cout<<endl;
}

int32_t main() 
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	     cin>>a[i];
    int ans=0;
    int del=0;
    int sn=1;
    bool flag=true;
    for(int i=0;i<n;i++)
    {
    	if(a[i]!=i+1)flag=false;
	}
	if(flag)
	{
		cout<<0<<endl;
		return 0;
	}
    for(int i=0;i<n;i++)
    {
    	if(a[i]!=sn)
    	{
    		ans++;
    		del++;
		}else{
			sn++;
		}
	}
	if(del==n || ans==0)
	  cout<<-1<<endl;
	else 
		cout<<ans<<endl;
	return 0;
}






















Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
using namespace std;
 
int main()
{
	int a, b;
  cin >> a >> b;
  int num = std::to_string(b).length();
  int mul = a * pow(10, num) + b;
  for(int i=0; i < mul; i++)
  {
    int n = i*i;
    if(n == mul)
    {
      cout << "Yes";
      return 0;
    }
    if(n > mul)
    {
      cout << "No";
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;

bool is_good(int n)
{
    int cnt = 0;
    while(n) {
        n /= 10;
        ++cnt;
    }

    return (cnt % 2);
}

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

    ll out = 0;

    for(int i = 1; i <= n; ++i)
        out += is_good(i);

    cout << out << endl;

    return 0;
}


Measured memory_bytes: 256
module PQ = Set.Make(struct
  type t = int * int * int
  let compare (d0,x0,y0) (d1,x1,y1) =
    if d0 <> d1 then d0-d1 else if x0 <> x1 then x0-x1 else y0-y1
end)

let () =
  Scanf.scanf "%d %d" @@ fun h w ->
  let a = Array.init h (fun _ -> Scanf.scanf " %s" (fun s -> s)) in
  let a = Array.mapi (fun i s -> Array.init w (fun j -> i, j, s.[j])) a in

  let pq0 =
    Array.fold_left (Array.fold_left
      (fun pq (i,j,c) -> if c = '#' then PQ.add (0,i,j) pq else pq)) PQ.empty a
  in

  let c = Array.init h (fun _ -> Array.make w max_int) in
  PQ.iter (fun (_,x,y) -> c.(x).(y) <- 0) pq0;

  let rec loop pq =
    if PQ.is_empty pq then () else
    let (d,x,y) = PQ.min_elt pq in
    let pq = PQ.remove (d,x,y) pq in
    if d > c.(x).(y) then loop pq else
    [(1,0); (0,1); (-1,0); (0,-1)] |> List.fold_left (fun pq (dx,dy) ->
      let x', y' = x+dx, y+dy in
      if x' < 0 || h <= x' || y' < 0 || w <= y' || d+1 >= c.(x').(y') then pq
      else begin
        c.(x').(y') <- d+1;
        PQ.add (d+1,x',y') pq
      end
    ) pq |> loop
  in
  loop pq0;

  Array.fold_left (Array.fold_left max) 0 c
  |> Printf.printf "%d\n"

Measured memory_bytes: 120824
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

map<ll,ll> primes(ll n){
    map<ll, ll> r;
    for(int i=2; i*i<=n; i++){ 
        while(n % i ==0){
            r[i]++;
            n /= i;
        }
    }

    if(n != 1) r[n] = 1;
    return r;
}

long long fac[201100], finv[201100], inv[201100];
 
void init() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<201100;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;
    }
}

int main(){FIN

    ll n,m;cin>>n>>m;
    map<ll,ll> mp = primes(m);
    ll ans = 1;
    init();

    for(auto p:mp){
        ll num = p.second;
        ans *= fac[n-1+num]%mod * (finv[num]%mod)%mod * finv[n-1]%mod;
        ans %= mod;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n,num,c[4][13]={};
	string mark;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>mark>>num;
	if(mark == "S") c[0][num-1]=1;
	if(mark == "H") c[1][num-1]=1;
	if(mark == "C") c[2][num-1]=1;
	if(mark == "D") c[3][num-1]=1;
	}
	string str[4]={"S","H","C","D"};
	for(int i=0;i<4;i++){
		for(int j=0;j<13;j++){
			if(c[i][j]==1) continue;
			cout<<str[i]<<" "<<j+1<<endl;
		}
	}
    return 0;
}


Measured memory_bytes: 3168
N, M, K = map(int, input().split())
MOD = 998244353
MAX_N = 10**6
fac = [0]*(MAX_N)
fac_inv = [0]*(MAX_N)
fac[0] = 1
for i in range(MAX_N-1):
    fac[i+1] = fac[i]*(i+1) % MOD
fac_inv[-1] = pow(fac[-1], MOD-2, MOD)
for i in range(MAX_N-2, -1, -1):
    fac_inv[i] = fac_inv[i+1]*(i+1) % MOD


def nCk(n, k):
    return fac[n] * fac_inv[k] % MOD * fac_inv[n-k] % MOD


ans = 0
for k in range(K+1):
    # temp = M*nCk(N-1, k)*pow(M-1, N-K-1, MOD) % MOD
    temp = (M*nCk(N-1, k)) % MOD*pow(M-1, N-k-1, MOD) % MOD
    ans += temp
    ans %= MOD
print(ans)


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

int main() {
  ll N = 0,ans = 0;
  cin >> N;
  vector<ll>A(N);
  rep(i,N){
    cin >> A[i];
  }
  ll cum[N+1];
  cum[0] = 0;
  map<ll, ll> mp;
  mp[0]++;
  rep(i,N){
    cum[i + 1] = cum[i] + A[i];
    mp[cum[i+1]]++;
  }
  for (auto p : mp){
    ans += (p.second * (p.second -1)) /2;
  }
  cout << ans;
}

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

int main() {
    int N, M, X;
    cin >> N >> M >> X;
    int ans = INT_MAX;
    vector<int> C(N);
    vector<vector<int>> v(N,vector<int>(M));
    rep(i, N){
      cin >> C.at(i);
      rep(j, M){
        cin >> v.at(i).at(j);
      }
    }
    bool ok = false;
    rep(tmp, (1 << N)){
      bitset<12> b(tmp);
      vector<int> u(M);
      int tmp_c = 0;
      rep(i, N){
        if(b.test(i) == 0) continue;
        tmp_c += C.at(i);
        rep(j, M){
          u.at(j) += v.at(i).at(j);
        }
      }
      bool tmp_ok = true;
      rep(i, M){
        if(u.at(i) < X) {
          tmp_ok = false;
          break;
        }
      }
      if(tmp_ok){
        ans = min(ans,tmp_c);
        ok = true;
      }
    }
    if(ok){
      cout << ans << endl;
    } else {
      cout << -1 << endl;
    }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int ans = 0;

int main(){
	int N;
	cin >> N;
	vector<int> x(N),y(N),h(N);
	for(int i=0;i<N;i++) cin >> x[i] >> y[i] >>h[i];
	int MAX = 100;
	for(int py = 0;py<=MAX;py++){
		for(int px = 0;px<=MAX;px++){
			int needH = -1;
			for(int i=0;i<N;i++){
				if(h[i]>0){
					int tmp = h[i]+abs(px-x[i])+abs(py-y[i]);
					if(needH == -1){
						needH = tmp;
					}else{
						if(needH!=tmp){
							needH = -2;
							break;
						}
					}
				}
			}
			if(needH==-2) continue;

			for(int i=0;i<N;i++){
				if(h[i]==0){
					if(needH>(abs(py-y[i])+abs(px-x[i]))){
						needH = -2;
						break;
					}
				}
			}
			if(needH == -2) continue;

			cout << px << " " << py <<" " << needH <<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<fstream>
#include<algorithm>
#include<utility>
using namespace std;
using ll = long long;


int main(){
    int n;
    cin >> n;
    map<int,int> mp;
    for(ll i=1;i<=n;i++){
        ll x;
        cin >> x;
        mp[x] = i;
    }
    for(auto iter=mp.begin();iter!=mp.end();iter++){
        cout << iter->second << " ";
    }
    return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> broken(n + 1);
  rep(i, m) {
    int a;
    cin >> a;
    broken[a] = 1;
  }
  vector<int> dp(n + 2);
  const int mod = 1000000007;
  dp[n] = 1;
  for (int i = n - 1; i >= 0; i--) {
    if (broken[i]) {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
  }
  cout << dp[0] << endl;
  return 0;
}


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

int main() {
    int a[5];
    for (int i=0; i<5; i++){
        cin >> a[i];
    }
    for (int i=0; i<5; i++){
        if (a[i]==0){
            cout << i+1 << endl;
        }
    }
    
}

Measured memory_bytes: 3632
import copy
H,W,K = map(int,input().split())
c = []
for i in range(H):
    c.append(list(input()))

ans = 0

for i in range(2**H):
    for j in range(2**W):
        c_ = copy.deepcopy(c)
        for k in range(H):
            if ((i >> k) & 1):
                for l in range(W):
                    c_[k][l] = '-'
        for k in range(W):
            if ((j >> k) & 1):
                for l in range(H):
                    c_[l][k] = '-'
        if(sum([m.count('#') for m in c_]) == K):
            ans += 1


print(ans)


Measured memory_bytes: 9352
//Catchharsh
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    #define see(x) cout<<#x<<" = "<<x<<endl
    const ll MOD = 1e9+7;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (ll x,ll n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    int main()
    {   
         IOS;
         ll n,m,i,j,k;
         cin>>n;
         m= n%100;
         if(m==0) return cout<<1,0;
         for(i=1;i<=20;i++)
         {
           if(m<=5*i)
           {
             if(n>=100*i)
              return cout<<1,0;
           }
         }
         cout<<0;

         
         cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
    }

Measured memory_bytes: 256
package main

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

func solution(n int, texts []string) []string {
	ans := make([]string, 0)
	var c int
	seen := make(map[string]int, n)

	for _, text := range texts {
		seen[text]++
		c = max(c, seen[text])
	}

	for k, v := range seen {
		if v == c {
			ans = append(ans, k)
		}
	}
	sort.Strings(ans)
	return ans
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	texts := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		texts[i] = sc.Text()
	}

	ans := solution(n, texts)
	for _, text := range ans {
		fmt.Println(text)
	}
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



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

  int k, a, b;
  cin >> k >> a >> b;
  for(int i = a; i <= b; i++) {
    if(i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;

signed main() {
    int N; cin >> N;
    cout << N*800-N/15*200 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;


int main() {
	
	int n;
	cin >> n;
	vi a(n);
	rep(i, n)cin >> a[i];
	sort(all(a));

	V<bool> ok(n, true);
	int cnt = 0;
	rep(i, n) {
		if (ok[i] == false)continue;
		
		int ii = i + 1;
		while (ii < n) {
			if (a[ii] != a[i])break;
			ok[i] = false;
			ok[ii] = false;
			ii++;
		}

		int k = 2;
		while (k * a[i] <= 1000000) {
			int l = lower_bound(all(a), a[i] * k) - a.begin();
			int r = upper_bound(all(a), a[i] * k) - a.begin();
			for (int j = l;j < r;j++) {
				ok[j] = false;
			}
			k++;
		}
		if (ok[i])cnt++;
	}

	cout << cnt << endl;

}

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

int main(){
    int h,w;

    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if((i + j) % 2 == 0){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}

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

int main(){
	string s,t;cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),greater<>());
	puts(s<t?"Yes":"No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll h; ll w;
    cin >> h >> w;
    vector <vector <ll>> dp(h+1, vector <ll>(w+1, 0));
    dp[0][1] = 1;
    for(int y=1; y<=h; y++){
        string s; cin >> s;
        for(int x=1; x<=w; x++){
            if (s[x-1] == '#'){
                continue;
            }
            dp[y][x] = (dp[y-1][x] + dp[y][x-1]) % ll(1e9+7);
        }
    }
    cout << dp[h][w] << endl;
    return 0;
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)n;i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1e9*2; const long long INFLL=1e18*2;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.second >> p.first; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------

signed main() {
    string a,b,c;
    cin>>a>>b>>c;
    putchar('A');
    putchar(b[0]);
    putchar('C');
    putchar('\n');
    return 0;
}


Measured memory_bytes: 256
import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  [a,b,c] <- map (read::String->Int) . words <$> getLine
  putStrLn $ if elem c (remainders a b) then "YES" else "NO"

remainders a b = remainders' a b [] 1
remainders' a b list x
  |elem (mod (a*x) b) list = list
  |otherwise = remainders' a b (mod (a*x) b : list) (x+1)

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
char g[1005][1005];
int d[1005][1005];
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
struct wtf {
  int dis, rr, cc;
  const bool operator<(const wtf &e) const { return dis > e.dis; }
};
int main() {
  IOS;
  int r, c;
  cin >> r >> c;
  int sr, sc, er, ec;
  cin >> sr >> sc >> er >> ec;
  for (int i = 1; i <= r; i++) {
    for (int j = 1; j <= c; j++) {
      cin >> g[i][j];
      d[i][j] = INF;
    }
  }
  d[sr][sc] = 0;
  priority_queue<wtf> q;
  q.push({0, sr, sc});
  while (!q.empty()) {
    int rr = q.top().rr, cc = q.top().cc;
    q.pop();
    for (int k = 0; k < 4; k++) {
      int nr = rr + dy[k], nc = cc + dx[k];
      if (nr < 1 || nc < 1 || nr > r || nc > c || g[nr][nc] != '.')
        continue;
      if (d[nr][nc] > d[rr][cc])
        d[nr][nc] = d[rr][cc], q.push({d[nr][nc], nr, nc});
    }
    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        int nr = rr + i, nc = cc + j;
        if (nr < 1 || nc < 1 || nr > r || nc > c || g[nr][nc] != '.')
          continue;
        if (d[nr][nc] > d[rr][cc] + 1)
          d[nr][nc] = d[rr][cc] + 1, q.push({d[nr][nc], nr, nc});
      }
    }
  }
  cout << (d[er][ec] == INF ? -1 : d[er][ec]) << endl;
}


Measured memory_bytes: 8660
#include"bits/stdc++.h"

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	map<string, vector<pair<int, int>>> mp;
	set<string> st;
	int N;
	cin >> N;
	REP(i, N) {
		string s;
		int p;
		cin >> s >> p;
		st.insert(s);
		mp[s].push_back({ -p,i });
	}
	for (auto s : st) {
		auto v = mp[s];
		sort(v.begin(), v.end());
		for (auto p : v) {
			cout << p.second+1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int nmax=1e5+1;
int dp[nmax];
int indegree[nmax];
int visit[nmax];
void dfs(int u,vector<vector<int> > &adj)
{
    for(auto v :adj[u])
    {
        dp[v]=max(dp[v],dp[u]+1);
        indegree[v]--;
        if(indegree[v]==0&&!visit[v]) 
        {
            visit[v]=1;
            dfs(v,adj);
        }
    }



   // visit[u]=1;
}
int main()
{
    int n,m;
    cin>>n>>m;
    vector<vector<int> >adj(n+1);
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
        indegree[y]++;
       // adj[y].push_back(x);
    } 
    for(int i=1;i<=n;i++)
    {
        if(indegree[i]==0&&!visit[i]) dfs(i,adj);
    }
    int ans=INT_MIN;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;

    

}

Measured memory_bytes: 11520
class Card:
    def __init__(self, kind, number):
        self.kind = kind
        self.number = number

def bubble_sort(C, N):
    for i in range(N):
        for j in range(N - 1, i, -1):
            if C[j].number < C[j -1].number:
                C[j], C[j - 1] = C[j - 1], C[j]
    return C

def selection_sort(C, N):
    for i in range(N):
        min_index = i
        for j in range(i, N):
            if C[j].number < C[min_index].number:
                min_index = j
        C[i], C[min_index] = C[min_index], C[i]
    return C

def check_stable(bubble_cards, selection_cards):
    res = 'Stable'
    for (b, s) in zip(bubble_cards, selection_cards):
        if b.kind != s.kind or b.number != s.number:
            res = 'Not stable'
    return res

n = int(input())
bubble_cards = []
for card in input().split():
    kind, number = list(card)
    bubble_cards.append(Card(kind, number))
selection_cards = bubble_cards[:]

bubble_cards = bubble_sort(bubble_cards, n)
ans = []
for c in bubble_cards:
    ans.append(''.join(c.kind + str(c.number)))
print(' '.join(ans))
print('Stable')

selection_cards = selection_sort(selection_cards, n)
ans = []
for c in selection_cards:
    ans.append(''.join(c.kind + str(c.number)))
print(' '.join(ans))
print(check_stable(bubble_cards, selection_cards))



Measured memory_bytes: 5608
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val w = sc.nextInt()
    val h = sc.nextInt()
    val n = sc.nextInt()
    val xya = (0 until n).map { Triple(sc.next().toInt(), sc.next().toInt(), sc.next().toInt()) }
    println(problem047b(w, h, n, xya))
}

fun problem047b(
    w: Int,
    h: Int,
    n: Int,
    xya: List<Triple<Int, Int, Int>>
): Int {
    var math = Array(w) { IntArray(h) { 0 } }
    for (i in 0 until n) {
        val (x, y, a) = xya[i]
        when (a) {
            1 -> {
                for (xi in 0 until x) {
                    for (yi in 0 until h) {
                        math[xi][yi] = 1
                    }
                }
            }
            2 -> {
                for (xi in x until w) {
                    for (yi in 0 until h) {
                        math[xi][yi] = 1
                    }
                }
            }
            3 -> {
                for (xi in 0 until w) {
                    for (yi in 0 until y) {
                        math[xi][yi] = 1
                    }
                }
            }
            4 -> {
                for (xi in 0 until w) {
                    for (yi in y until h) {
                        math[xi][yi] = 1
                    }
                }
            }
        }
    }
    return math.sumBy { it.count { it == 0 } }
}

Measured memory_bytes: 30840
var
 s:ansistring;
 i,x,max,len:longint;
begin
 readln(len);
 readln(s);
 for i:=1 to length(s) do
  begin
   if s[i]='I' then inc(x) else dec(x);
   if x>max then max:=x;
  end;
  writeln(max);
end.

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

typedef long long ll;
int main()
{
    ll x;
    cin>>x;
    ll initial=100;
    ll cnt=0;
    while(initial<x)
    {
        initial+=(initial/100);
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m,q,ans=0;
int now[100005];
struct node
{
	int a,b,c,d;
}que[100005];
signed main()
{
	cin>>n>>m>>q;
	for (int i=1;i<=q;i++)
	{
		cin>>que[i].a>>que[i].b>>que[i].c>>que[i].d;
	}  
	for (int i=1;i<=n;i++)
	{
		now[i]=1;
	}  
	while (now[0]==0)
	{
		int sumv=0;
		for (int i=1;i<=q;i++)
		{
			if (now[que[i].b]-now[que[i].a]==que[i].c)
			{
				sumv+=que[i].d;
			}
		}
		ans=max(ans,sumv);
		for (int i=n;i>=0;i--)
		{
			if (now[i]<m)
			{
				now[i]++;
				for (int j=i+1;j<=n;j++)
				{
				 	now[j]=now[j-1];
				}
				break;
			}
		}
	}
	cout<<ans<<endl;	
	return 0;
}

Measured memory_bytes: 3520
#include <iostream>
using namespace std;
#define MAX_N 1000000

bool isPrime[MAX_N+1];

int main(void){
  int a, d, n, cnt;
  for(int i = 0; i <= MAX_N; i++) isPrime[i] = true;
  isPrime[0] = isPrime[1] = false;
  for(int i = 2; i * i <= MAX_N; i++){
    if(!isPrime[i]) continue;
    for(int j = i * i; j <= MAX_N; j += i) isPrime[j] = false;
  }
  while(true){
    int i = 0;
    cin >> a >> d >> n;
    if(a == 0 && d == 0 && n == 0) break;
    cnt = 0;
    while(true){
      if(isPrime[a + i * d]){
        if(++cnt == n) break;
      }
      i++;
    }
    cout << a + i * d << endl;
  }
  return 0;
}

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

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

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

    vector<pair<ll,ll>> vp(m);
    for(int i = 0; i < m; i++){
        ll x, y;
        cin >> x >> y;
        vp.push_back(make_pair(y, x));
    }
    sort(vp.rbegin(), vp.rend());
    int idx = 0;
    for(int i = 0; i < m; i++){
        for(int j = 0; j < vp[i].second; j++, idx++){
            if(v[idx] < vp[i].first) v[idx] = vp[i].first;
            else break;
        }
    }
    cout << accumulate(v.begin(), v.end(), 0LL) << endl;
}

Measured memory_bytes: 4992
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np
 
N = INT()
A = np.arange(N+1)
A = list(A)
 
for i in range(N+1):
  if A[i]%3 == 0 or A[i]%5 == 0:
    A[i]=0
    
print(sum(A))

Measured memory_bytes: 74148
N = int(input())
B = list(map(int, input().split()))

A = [0]*N
#Aの端にはBの端が入る
A[0] = B[0]
A[-1] = B[-1]

for i in range(1,N-1):
    A[i] = min(B[i-1],B[i])
    
print(sum(A))

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



namespace ConsoleApplication2
{

    class Program
    {
        static void Main(string[] args)
        {


            //int  postition=0,range=0;
            string[] eatmass = Console.ReadLine().Split(' ');
            //string[] mass = Console.ReadLine().Split(' ');

            //string[] greed = Console.ReadLine().Split(' ');
            //string[] bonus = Console.ReadLine().Split(' ');

            //int[] pointlist = new int[mass.Length];
            float Eatmass = float.Parse(eatmass[0]);
            float height;
            height = Eatmass / 3.00000000000f;



            //for (int i = 0; i < Eatmass; i++)
            //{
            //    pointlist[i] = int.Parse(mass[i]);
            //}

            //int[] greedlist = new int[greed.Length];
            //for (int i = 0; i < Eatmass; i++)
            //{
            //    greedlist[i] = int.Parse(greed[i]);
            //}

            //int[] bonuslist = new int[bonus.Length];
            //for (int i = 0; i < bonus.Length; i++)
            //{
            //    bonuslist[i] = int.Parse(bonus[i]);
            //}

            float result = 0,eaten=0;

            result = height * height * height;
            //for(int i=0;i< Eatmass; i++)
            //{

            //    result += greedlist[pointlist[i]-1];
               
            //    if(eaten!=0)
            //    {
            //        if(pointlist[i]  == eaten+1)
            //        {
            //            result += bonuslist[eaten-1];
            //        }
            //    }
            //    eaten = pointlist[i];

            //}
            //int[] listinput = new int[mass.Length];

            //for (int i = 0; i < mass.Length; i++)
            //{
            //    listinput[i] = int.Parse(mass[i]);
            //}


            Console.Write(result);



            //postition = int.Parse(mass[1]);

            //int nowposition = postition - (range - 1);

            //for(int i= 0; i<=(range-1)*2;i++)
            //{

            //    Console.Write(nowposition);
            //    Console.Write(" ");
            //    nowposition++;
            //}

            //result = 0;

        }
    }
}


Measured memory_bytes: 13140
import itertools
N,M,Q = map(int,input().split())
abcd = []
for _ in range(Q):
    abcd.append(list(map(int,input().split())))

ans = 0
for A in itertools.combinations_with_replacement(range(1,M+1),N):
    cnt = 0
    for q in range(Q):
        if A[abcd[q][1] - 1] - A[abcd[q][0] - 1] == abcd[q][2]:
            cnt += abcd[q][3]
    ans = max(ans,cnt)

print(ans)

Measured memory_bytes: 9152
/*
    1) Notice the range of data;
    2) while(scanf) format need to init;
    3) Enough maxn;
    4) delete the freopen;
    5) remember to read this before submit;
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int gcd(int a,int b){if (b == 0) return a; return gcd(b , a%b);}
int lcm(int a, int b){ return a/gcd(a,b)*b;}
inline int read(){
    int f = 1, x = 0;char ch = getchar();
    while (ch > '9' || ch < '0'){if (ch == '-')f = -f;ch = getchar();}
    while (ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}
    return x * f;
}
const int maxn = 1e5 + 10;
int a[maxn];
int main(){
    int n = read();
    int maxx = 0,ans = 0;
    for(int i=1; i<=n; i++){
        a[i] = read();
        if (a[i] >= maxx){
            ans++;
            maxx = a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int i;
		
		for(int j=1; ; j++){
			if((i=in.nextInt()) == 0){
				break;
			}
			System.out.println("Case "+j+": "+i);
		}
		
		in.close();
	}
}

Measured memory_bytes: 32956
#include<bits/stdc++.h>
using namespace std;
int main(){
    int b,x=1,y=0,vy=0,z=0;
    cin>>b>>b;
    int c[b],d[b],vz=b;
    for(int i=0;i<b;i++){
        cin>>c[i]>>d[i];
        if(vy<c[i]) vy=c[i];
    }
    while(1){
        for(int i=0;i<vz;i++){
            if(vy>=d[i]){
                c[z]=c[i];
                d[z]=d[i];
                if(y<c[i]) y=c[i];
                z++;
            }
        }
        if(z) x++;
        else break;
        vy=y;
        y=0;
        vz=z;
        z=0;
    }
    cout<<x<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    if (s == "ABC") {
        cout << "ARC\n";
    }
    else {
        cout << "ABC\n";
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N;
  cin >> N;
  vi A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    A.at(i) -= i+1;
  }
  sort(ALL(A));
  int x = N/2;
  int y = (N-1)/2;
  int z = A.at((x+y)/2);
  ll ans1 = 0;
  for(int i = 0; i < N; i++){
    ans1 += abs((ll)A.at(i) - (ll)z);
  }
  cout << ans1 <<endl;

}

Measured memory_bytes: 1024