akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

    ll L, R; cin >> L >> R;
    if ((L-1) / 2019 != R / 2019) {
        cout << 0 << endl; return 0;
    }
    L = L % 2019; R = R % 2019;
    int ans = 2018;
    FOR(i, L, R+1) {
        FOR(j, i+1, R+1) {
            ans = min(ans, (i*j)%2019);
        }
    }
    cout << ans << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	ll x;
	cin >> x;
	ll c = 0;
	ll ans = 100;

	while (ans < x) {
		c++;
		ans = ans + (ans / 100 );
	}

	cout << c << endl;
}

Measured memory_bytes: 3588
#include "bits/stdc++.h"
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long LL;
#define REP(i,N) for (int i=0; i<N; i++)

int main() {
  long long N, price[4], minPrice, ans = 0;
  double V[4] = {0.25, 0.5, 1, 2};
  for (int i = 0; i < 4; i++) {
    cin >> price[i];
  }
  cin >> N;
  minPrice = price[3];
  minPrice = min(minPrice, 8*price[0]);
  minPrice = min(minPrice, 4*price[1]);
  minPrice = min(minPrice, 2*price[2]);
  ans += N/2 * minPrice;
  if (N%2 == 1) {
    minPrice = price[2];
    minPrice = min(minPrice, 4*price[0]);
    minPrice = min(minPrice, 2*price[1]);
    ans += minPrice;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,i,b;
    scanf("%d",&n);
    int s[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&b);
        s[b-1]=i+1;
    }
    for(i=0;i<n;i++)
    {
        printf("%d ",s[i]);
    }
    return 0;
}

Measured memory_bytes: 1152
import math
k = int(input())
dp = [[1 for _ in range(k + 1)] for _ in range(k + 1)]
for i in range(1, k + 1):
    for j in range(1, k + 1):
        dp[i][j] = math.gcd(i, j)
ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            ans += dp[a][dp[b][c]]
print(ans)


Measured memory_bytes: 9480
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n, W, w[107], v[107];
long long dp[107][100007], ans = 0;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> W;
	for(int i = 0; i <= n; i++){
		for(int j = 1; j <= 100001; j++){
			dp[i][j] = 1e16;
		}
	}
	for(int i = 1; i <= n; i++){
		cin >> w[i] >> v[i];
		for(int j = 0; j <= 100000; j++){
			dp[i][j] = min(dp[i - 1][j], dp[i][j]);
			if(dp[i - 1][j] < 0) continue;
			dp[i][j + v[i]] = min(dp[i][j + v[i]], dp[i - 1][j] + w[i]);
		}
	}
	for(int j = 0; j <= 100000; j++){
		if(dp[n][j] <= W) ans = j;
	}
	cout << ans;
}


Measured memory_bytes: 80128
#include<stdio.h>
int main(void){
  int N,M,m=0;
  while(1){
    scanf("%d",&N);
    if(1<=N<=100000000) break;
  }
 M = N;
 while(N>0){
    m = m + N%10;
    N = N/10;
  } 
  
  if(M%m==0) printf("Yes");
  if(M%m!=0) printf("No");
  return 0;
}

Measured memory_bytes: 256
/*
      author  : nishi5451
      created : 12.08.2020 22:15:41
*/

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


int main(){
    int n;
    string s;
    cin >> n >> s;
    int now = 0;
    int mx = 0;
    rep(i,n){
        if(s[i]=='I') now++;
        else if(s[i]=='D') now--;
        mx = max(now,mx);
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define leng(n) (int)(log10(n)+1)


typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
Vi accum(Vi v){Vi ret((v).size());ret[0]=v[0];REP(i,1,(v).size()) ret[i]=ret[i-1]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
    string s;
    int k;
    cin>>s>>k;
    int n=s.size();

    vector<VVi> dp(n+1,VVi(2,Vi(n+1)));
    dp[0][0][0]=1;

    REP(i,0,n){
        REP(j,0,2){
            REP(l,0,n){
                int D = s[i]-'0';
                REP(d,0,(j?9:D)+1){
                    if(d==0){
                        dp[i+1][j || (d<D)][l] += dp[i][j][l];
                    }else{
                        dp[ i + 1 ][ j || ( d < D ) ][l+1] += dp[ i ][ j ][l];
                    }
                }
            }
        }
    }
    cout<<dp[n][0][k]+dp[n][1][k]<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int arr[100];

int main()
{
	int len, tmp, cnt = 0;
	scanf("%d", &len);

	for (int i = 0; i < len; i++)
	{
		scanf("%d", &arr[i]);
	}

	for (int i = 0; i < len; i++)
	{
		int max = len - i;
		for (int j = 1; j < max; j++)
		{
			if (arr[j - 1] > arr[j])
			{
				tmp = arr[j-1];
				arr[j-1] = arr[j];
				arr[j] = tmp;
				cnt++;
			}
		}
	}

	printf("%d", arr[0]);
	for (int i = 1; i < len; i++)
	{
		printf(" %d", arr[i]);
	}
	printf("\n");
	printf("%d\n", cnt);
}



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

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;


signed main(){
    i64 n;
    i64 k;
    cin >> n >> k;
    vector<i64> a(n), b(n);
    for(auto& x : a)
        cin >> x;
    for(auto& x : b)
        cin >> x;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<i64>());

    auto f = [&](i64 val){
        i64 cnt = 0;
        for(i64 i = 0; i < n; ++i){
            i64 v = a[i] * b[i];
            i64 diff = v - val;
            if(diff <= 0)
                continue;
            cnt += (diff + b[i] - 1) / b[i];
        }
        return cnt <= k;
    };

    i64 ok = INF, ng = -1;
    while(ok - ng > 1){
        i64 mid = (ok + ng) / 2;
        (f(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef map<int, int> MI;
typedef set<int> SI;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COUT(x) cout << (x) << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

    string s; cin >> s;
    int cnt = 0;
    rep(i, s.size() - 1) {
        if(s[i] != s[i + 1]) cnt++;
    }
    COUT(cnt);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define all(x) x.begin(),x.end()
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL);
#define N 105
int a[N][N], c[N];
int main(){
	FIO;
    int n,m,x; cin >> n >> m >> x;
    for(int i = 0 ; i < n ; i++){
        cin >> c[i];
        for(int j = 0 ; j < m ; j++) cin >> a[i][j];
    }
    int mini = INT_MAX;
    for(int i = 0 ; i < (1<<n) ; i++){
        vector<int> sum(m,0);
        int money = 0;
        for(int j = 0 ; j < n ; j++){
            if((i>>j)&1){
                money += c[j];
                for(int k = 0 ; k < m ; k++){
                    sum[k] += a[j][k];
                }
            }
        }
        bool flag = 1;
        for(int j = 0; j < m ; j++) flag &= (sum[j] >= x);
        if(flag){
            mini = min(mini,money);
        }
    }
    cout << (mini == INT_MAX ? -1 : mini) << endl;
	return 0;
}

Measured memory_bytes: 3668
//author: Harsh :)
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define maxN 100007
using namespace std;
int main() {
  fastio;
  ll n = 0;
  cin >> n;
  map<string, ll>mp;
  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    ++mp[s];
  }
  for (auto i : mp) {
    ll x = i.S;
    ans += x * (x - 1) / 2;
  }
  cout << ans;
}


Measured memory_bytes: 11264
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node{
  int key;
  Node *right,*left,*parent;
};

Node *root,*NIL;

Node * treeMinimum(Node *x){
  while(x->left!=NIL)
    x=x->left;
  return x;
}

Node * find(Node *u,int k){
  while(u!=NIL && k!=u->key){
    if(k<u->key)
      u=u->left;
    else
      u=u->right;
  }
  return u;
}

Node * treeSuccessor(Node *x){
  if(x->right!=NIL)
    return treeMinimum(x->right);
  Node *y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node *z){
  Node *y;
  Node *x;

  if(z->left == NIL || z->right==NIL)
    y=z;
  else
    y=treeSuccessor(z);

  if(y->left!=NIL){
    x=y->left;
  }
  else{
    x=y->right;
  }

  if(x!=NIL){
    x->parent = y->parent;
  }

  if(y->parent == NIL){
    root = x;
  }
  else {
    if(y==y->parent->left){
      y->parent->left=x;
    }
    else {
      y->parent->right=x;
    }
  }

  if(y!=z){
    z->key=y->key;
  }
  free(y);
}

void insert(int k){
  
  Node *y=NIL;
  Node *x=root;
  Node *z;

  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key < y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL)
    return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u==NIL)
    return;

  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  string com;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    cin>>com;
    if(com[0]=='f'){
      scanf("%d",&x);
      Node *t=find(root,x);
      if(t!=NIL)
	printf("yes\n");
      else
	printf("no\n");
    }
    else if(com=="insert"){
      scanf("%d",&x);
      insert(x);
    }
    else if(com=="print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(com=="delete"){
      scanf("%d",&x);
      treeDelete(find(root,x));
    }
  }

  return 0;
}



Measured memory_bytes: 22028
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;   cin >> s;
    int ans = 0;
    for (int i = 0; i < s.length(); i++)
        ans += s[i]-'0';
    
    if (ans % 9)
        cout << "No" << endl;
    else 
        cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3764
#include <cmath>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  int X; cin >> X;

  int ans = 1;
  for (int i = 2; i <= X; i++) {
    for (int j = 2; pow(i, j) <= X; j++) {
      ans = max(ans, (int)pow(i, j));
    }
  }

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


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int k;
  scanf("%d", &k);
  int a[k];
  int i;
  for(i=0;i<k;i++){
    scanf("%d", &a[i]);
  }
  if(a[k-1] != 2){
    puts("-1");
    return 0;
  }
  long long int max = 3, min = 2;
  for(i=k-2;i>=0;i--){
    if (max - max % a[i] < min){
      puts("-1");
      return 0;
    }else{
      max = max - max % a[i] + (long long int)(a[i] - 1);
      min = (min - 1) - (min - 1) % a[i] + (long long int)a[i];
    }
  }
  printf("%lld %lld\n", min, max);
  return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		int[] range = new int[N];
		for(int i = 0; i < N; i++) {
			int a = 0;
			if(i == N - 1) a = K - A[i] + A[0];
			else a = A[i + 1] - A[i];
			range[i] = a;
		}
		Arrays.sort(range);
		int wa = 0;
		for(int i = 0; i < N - 1; i++) {
			wa += range[i];
		}
		System.out.println(wa);
	}
}

Measured memory_bytes: 83584
import java.util.Scanner;
import java.util.Arrays;

class Main {
    public static void main (String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            int[] l = new int[3];
            l[0] = in.nextInt();
            l[1] = in.nextInt();
            l[2] = in.nextInt();
            Arrays.sort(l);
            if (l[0] * l[0] + l[1] * l[1] == l[2] * l[2]) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }
    }
}

Measured memory_bytes: 33352
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


class BIT
{
public:
    vector<int> bit;
    int M;

    BIT(int M):
        bit(vector<int>(M+1, 0)), M(M) {}

    int sum(int i) {
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, int x) {
        if (i > M) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }
};

int main()
{
    ll n;
    cin >> n;
    vector<int> a;
    int max_a = 0;
    rep(i, n){ int tmp; cin >> tmp; a.push_back(tmp);
        max_a = max(max_a, a[i]);
    }


    int l = 0;
    int r = 1e9 + 1;
    int geta = n+1;
    while(abs(l-r) > 1){
        int mid = (l+r)/2;
        vector<int> ap(n);
        rep(i, n) ap[i] = (a[i] >= mid) ? 1 : -1;
        vector<int> sap(n+1, 0);
        rep(i, n) sap[i+1] = sap[i] + ap[i];

        //sapの転倒数をもとめる
        BIT bit(2*n + 10);
        ll tans = 0;
        rep(i, n+1) {
            bit.add(sap[i] + geta, 1);
            tans += (i+1) - bit.sum(sap[i] + geta);
        }

        //-1, 1からなる数列の任意の範囲の和が0以上になる数xを求める
        if (tans <= n*(n+1)/2/2){
            //
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << l << endl;
}



Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main() {
  int A,B;
  cin>>A>>B;
  int cnt=0;
  for(int i=A;i<=B;i++){
    string t=to_string(i);
    string d=t;
    reverse(d.begin(),d.end());
    if(t==d){cnt++;}
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3676
/**
 * @author torith
 * @date 2018-10-09
 */

#include <bits/stdc++.h>

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K;
    int A[100000];
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    int ans;
    if ((N - K) % (K - 1) == 0) {
        ans = 1 + (N - K) / (K - 1);
    }else{
        ans = 2 + (N - K) / (K - 1);
    }
    cout << ans << "\n";
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s; cin >> s;
	int count = 0;
	int largest = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'R') {
			count++;
		}
		else {
			if (count > largest) largest = count;
			count = 0;
		}
	}
	if (count > largest) largest = count;
	cout << largest;
	return 0;
}



Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(void){
    int max,min;
    int N,a[100];
    int gr=0,br=0,gre=0,lb=0,bl=0,ye=0,o=0,re=0,all=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
        if(a[i]>=1 && a[i]<=399)gr=1;
        if(a[i]>=400 && a[i]<=799)br=1;
        if(a[i]>=800 && a[i]<=1199)gre=1;
        if(a[i]>=1200 && a[i]<=1599)lb=1;
        if(a[i]>=1600 && a[i]<=1999)bl=1;
        if(a[i]>=2000 && a[i]<=2399)ye=1;
        if(a[i]>=2400 && a[i]<=2799)o=1;
        if(a[i]>=2800 && a[i]<=3199)re=1;
        if(a[i]>=3200)all=all+1;
    }
     max=gr+br+gre+lb+bl+ye+o+re+all;
    if(all>0 && gr+br+gre+lb+bl+ye+o+re==0){
        min=1;
    }
    else min=gr+br+gre+lb+bl+ye+o+re;
    cout<<min<<" "<<max<<endl;
    
    
    return 0;
   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

int n, m;
vector<int>G[114514];
int co[114514];
bool dfs(int x) {
	for (int i : G[x]) {
		if (co[x] == co[i])return false;
		else if (co[i])continue;
		co[i] = co[x] * -1;
		if (!dfs(i))return false;
	}
	return true;
}
signed main() {
	cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	co[0] = 1;
	if (dfs(0)) {
		int cnt = 0;
		rep(i, n) {
			cnt += co[i] > 0;
		}
		cout << cnt * (n - cnt)  - m << endl;
	}
	else {
		cout << n * (n - 1) / 2 - m << endl;
	}
}

Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll r, d, x; cin >> r >> d >> x;
  rep(i, 10) {
    cout << r*x-d << "\n";
    x = r*x-d;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long

int main() {
	int N; std::cin >> N;
	std::string s; std::cin >> s;
    intt ans = 0;
    for (int i = 1; i < N - 1; i++) {
        intt count = 0;
        std::vector<int> R(26), L(26);
        for (int j = 0; j < i; j++)L[s[j] - 'a'] = 1;
        for (int k = i; k < N; k++)R[s[k] - 'a'] = 1;
        for (int l = 0; l < 26; ++l) {
            if (R[l] == 1 && L[l] == 1)count++;
        }
        ans = std::max(ans, count);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 3588
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize);
    let n = n % 1000;
    let r = if n > 0 { 1000 - n } else { 0 };
    println!("{}", r);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2132
from array import array
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = array("u", list(input()))

for i in range(k, n):
    if t[i] == t[i-k]:
        t[i] = "*"

ans = (t.count("r") * p +
       t.count("s") * r +
       t.count("p") * s)

print(ans)

Measured memory_bytes: 4408
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/
#include <bits/stdc++.h>
#define newline ("\n")
#define deb(x) cerr << (#x) << " = " << (x) << '\n'
#define FOR(x, n) for (int x = 0; x < n; x++)
#define PI (3.141592653589)

#define MOD 1000000007
using namespace std;

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

    // Highly sophisticated code starts here
    // preprocessing
    string s;
    cin >> s;
    string ans = "keyence";
    if(s.size() < ans.size())
    {
        cout << "NO";
        return 0;
    }
    if(s == ans)
    {
        cout << "YES";
        return 0;
    }
    if(ans == s.substr(0,7))
    {
        cout <<"YES";
        return 0;
    }
    if(ans == s.substr(s.size()-7))
    {
        cout << "YES";
        return 0;
    }
    for(int i = 1;i<=6;i++)
    {
        if(s.substr(0,i) + s.substr(s.size()-7+i) == ans)
        {
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
    return 0;
}


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

int main(){
  for(int i = 0; i <= 3; i++){
    if(i == 3){
      cout << endl;
      break;
    }
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
      s.at(i) = toupper(s.at(i));
    }
    cout << s.at(0);
  }
}


Measured memory_bytes: 256
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;
using namespace literals;

class UnionFind {
public:
  std::vector<int> rank;
  std::vector<int> parent;
  using Iter = std::vector<int>::iterator;
  void init(int n) {
    parent.resize(n, 0); rank.resize(n, 0);
    for (int i = 0; i < n; ++i)parent[i] = i;
  }
  int root(int n) {
    if (parent[n] == n)return n;
    else {
      parent[n] = root(parent[n]);
      return parent[n];
    }
  }
  void merge(int a, int b) {
    a = root(a);
    b = root(b);
    if (a == b)return;
    if (rank[a] < rank[b])parent[a] = b;
    else {
      parent[b] = a;
      if (rank[a] == rank[b])++rank[a];
    }
  }
  bool is_same(int a, int b) {
    return root(a) == root(b);
  }
};

int64_t gcd(int64_t a, int64_t b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  int64_t A, B;
  cin >> A >> B;
  int64_t c = gcd(A, B);
  deque<int64_t> q;
  for (int64_t i = 1; i * i <= c; ++i) {
    if (c % i)continue;
    q.push_back(i);
    if (i == c / i)continue;
    q.push_front(c / i);
  }
  sort(begin(q), end(q));
  int n = q.size();
  UnionFind uf;
  uf.init(n);
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (gcd(q[i], q[j]) == 1)continue;
      uf.merge(i, j);
      break;
    }
  }
  set<int> s;
  for (auto& v : uf.parent)s.insert(v);
  cout << s.size() << endl;
}


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

namespace AtCoder
{

    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var cin = GetIntArray();
            var ans = cin[0] - cin[1] + 1;

            Console.Write(ans);
        }



        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13396
//BISMILLAHIR RAHMANIR RAHIM
//SOTO MEAW
//SOTO SONDESH
#include<bits/stdc++.h>

#define ls ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define __ <<" "<<
#define case(z) "Case " << z++ << ": "
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define quit return 0

using namespace std;

void showmyDS(set<int> ds)
{
    set<int> ::iterator it;
    for (it=ds.begin();it!=ds.end();it++)
    {
        cout << *it << endl ;
    }
    cout << endl;
}
int main()
{
    ls
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //int t,l=1;cin>>t;while(t>0){
        int n,i,a=0,b=0;
        for(i=1;i<=3;i++)
        {
            cin >> n ;
            if(n==5)
                a++;
            else if(n==7)
                b++;
        }
        if(a==2 && b==1)
            cout << "YES" ;
        else
            cout << "NO" ;
    //t--;}

    quit;
}


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

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

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

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


bool isOK(int index,int k,vector<int>& memo1,vector<int>& memo2){
    rep(i,min(index+1,(int)memo1.size())){
        if(memo2.size()<=index-i)continue;
        if(memo1[i]+memo2[index-i]<=k)return true;
    }
    return false;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;

    int n,m,k;
    cin>>n>>m>>k;
    vector<int> memo1,memo2;
    memo1.resize(n+1,0);
    memo2.resize(m+1,0);
    rep(i,n){
        int in;
        cin>>in;
        memo1[i+1]=in+memo1[i];
    }
    rep(i,m){
        int in;
        cin>>in;
        memo2[i+1]=in+memo2[i];
    }
    int ng=m+n+1,ok=0;
    while(abs(ng-ok)>1){
        int mid=(ok+ng)/2;
        if(isOK(mid,k,memo1,memo2)){
            ok=mid;
        }
        else ng=mid;
    }
    cout<<ok<<endl;
}


Measured memory_bytes: 6360
n = STDIN.readline.chomp.to_i
a = STDIN.readline.chomp.split(' ').map(&:to_i).sort{|a, b| b <=> a }
puts (a.values_at(*(0...n).step(2)) - [nil]).inject(&:+) - (a.values_at(*(1...n).step(2)) - [nil]).inject(&:+)


Measured memory_bytes: 1788
// This code wrote by chtholly_micromaker(MicroMaker)
#pragma GCC optimize("Ofast,O3,inline")
#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
#define reg register
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset(x,y,sizeof x)
#define sz(x) (int)(x).size()
#define ln puts("")
#define lsp putchar(32)
#define pb push_back
#define MP make_pair
#define dbg(x) cerr<<">"<<__func__<<"\tLine: "<<__LINE__<<' '<<#x<<": "<<x<<endl
using namespace std;
template <class t> inline void read(t &s){s=0;
reg int f=1;reg char c=getchar();while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))s=(s<<3)+(s<<1)+(c^48),c=getchar();s*=f;return;}
template<class t,class ...A> inline void read(t &x,A &...a){read(x);read(a...);}
template <class t> inline void write(t x){if(x<0)putchar('-'),x=-x;
int buf[21],top=0;while(x)buf[++top]=x%10,x/=10;if(!top)buf[++top]=0;
while(top)putchar(buf[top--]^'0');return;}
inline void setIn(string s){freopen(s.c_str(),"r",stdin);return;}
inline void setOut(string s){freopen(s.c_str(),"w",stdout);return;}
inline void setIO(string s=""){setIn(s+".in");setOut(s+".out");return;}
template <class t>inline bool checkmin(t&x,t y){if(x>y){x=y;return 1;}return 0;}
template <class t>inline bool checkmax(t&x,t y){if(x<y){x=y;return 0;}return 0;}
inline int lowbit(int x){return x&(-x);}
signed main(void)
{
	int k;read(k);
	while(k--)
		cout<<"ACL";
	return 0;
}

/*
 * Check List:
 * 1. Input / Output File (USACO and OI and UVa)
 * 2. long long 
 * 3. Special Test such as n=1
 * 4. Array Size
 * 5. Memory Limit (OI) int is 4 and longlong is 8
 * 6. Mod (a*b%p*c%p not a*b*c%p  ,  (a-b+p)%p not a-b )
 * 7. Name ( int k; for(int k...))
 * 8. more tests , (T=2 .. more)
 * 9. blank \n after a case
*/






Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int V[N];
  int somma = 0;
  for(int i = 0;i<N;i++)
  {
    cin>>V[i];
    somma+=V[i];
  }
  if(somma%10 != 0) cout<<somma;
  else
  {
    sort(V,V+N);
    int conta = 0;
    for(int i = 0;i<N;i++)
    {
      if(V[i] %10 != 0) {somma-=V[i];conta++;break;}
    }
    if(conta == 0) cout<<0;
    else cout<<somma;
  }




}


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

int main()
{
    int n,k,x,y,ans = 0;
    cin >> n >> k >> x >> y;
    for(int i = 0; i < n; i++){
        if(i < k) ans += x;
        else ans += y;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){

	int n;
	cin>>n;
	for(int i = 0; i < n; i++){
		char field[10][10];
		for(int j = 0; j < 10; j++)
			for(int k = 0; k < 10; k++)
				cin>>field[j][k];


		// ツ催渉可づ可暗ェツ氾板湘」ツづ個づ青づつュツづィツつゥツつヲツつオツ陛サツづーツ個按津ィ
		for(int s = 0; s < (1 << 10); s++){
			char ret[10][10];
			char sit[10][10];
			for(int j = 0; j < 10; j++){
				for(int k = 0; k < 10; k++){
					sit[j][k]=field[j][k];
				}
			}
			for(int j = 0; j < 10; j++){
				if((s>>j)&1){
					ret[0][j]='1';
					sit[0][j]=((sit[0][j]-'0')^1)+'0';
					if(j-1>=0){
						sit[0][j-1]=((sit[0][j-1]-'0')^1)+'0';
					}
					if(j+1<10){
						sit[0][j+1]=((sit[0][j+1]-'0')^1)+'0';
					}
					sit[1][j]=((sit[1][j]-'0')^1)+'0';
				}
				else{
					ret[0][j]='0';
				}
			}
			// ツ湘」ツづ恵itツづーツ個ゥツづ、ツづ青づつュツづィツ陛板つキツつゥツづつ、ツつゥツづーツ考ツつヲツづゥ
			for(int j = 1; j < 10; j++){
				for(int k = 0; k < 10; k++){
					// ツづ青づつュツづィツつゥツつヲツつキ
					if(sit[j-1][k]=='1'){
						ret[j][k]='1';
						sit[j][k]=((sit[j][k]-'0')^1)+'0';
						if(j-1>=0){
							sit[j-1][k]=((sit[j-1][k]-'0')^1)+'0';
						}
						if(j+1<10){
							sit[j+1][k]=((sit[j+1][k]-'0')^1)+'0';
						}
						if(k-1>=0){
							sit[j][k-1]=((sit[j][k-1]-'0')^1)+'0';
						}
						if(k+1<10){
							sit[j][k+1]=((sit[j][k+1]-'0')^1)+'0';
						}
					}
					else{
						ret[j][k]='0';
					}
				}
			}
			bool ff=false;
			for(int j = 0; j < 10; j++){
				for(int k = 0; k < 10; k++){
					if(sit[j][k]=='1'){
						ff=true;
						break;
					}
				}
				if(ff)
					break;
			}
			if(!ff){
				for(int j = 0; j < 10; j++){
					for(int k = 0; k < 10; k++){
						cout<<ret[j][k];
						if(k==9)
							cout<<endl;
						else
							cout<<" ";
					}
				}
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
use itertools::Itertools;
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
use std::iter;
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();
    let k: usize = sc.read();
    let a = sc.read_vec::<usize>(n);
    let b = sc.read_vec::<usize>(m);

    let cum_a = iter::once(0)
        .chain(a.into_iter())
        .cumsum()
        .collect::<Vec<usize>>();
    let cum_b = iter::once(0)
        .chain(b.into_iter())
        .cumsum()
        .collect::<Vec<usize>>();

    let ans = cum_a
        .into_iter()
        .filter(|&x| x <= k)
        .enumerate()
        .map(|(i, x)| cum_b.upper_bound(&(k - x)) - 1 + i)
        .max()
        .unwrap();
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 5580
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        
        List<List<Integer>> graph = new ArrayList<>();
        
        for(int i = 0; i <= n; i++){
            graph.add(new ArrayList<>());
        }
        for(int i = 1; i <= n-1; i++){
            graph.get(i).add(i+1);
            graph.get(i+1).add(i);
        }
        graph.get(x).add(y);
        graph.get(y).add(x);
        
        int[] ans = new int[n];
        for(int i = 1; i <= n; i++){
            int[] dist = new int[n+1];
            Arrays.fill(dist, -1);
            dist[i] = 0;
            
            ArrayDeque<Integer> queue = new ArrayDeque<>();
            queue.add(i);
            
            while(!queue.isEmpty()){
                int u = queue.poll();
                graph.get(u).forEach((v) -> {
                    if(dist[v] == -1){
                        dist[v] = dist[u] +1;
                        ans[dist[v]]++;
                        queue.add(v);
                    }
                });
            }
        }
        
        StringBuilder sb = new StringBuilder();
        for(int i = 1; i < n; i++){
            sb.append(ans[i]/2).append(System.lineSeparator());
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 65228
#include <cstdio>

using namespace std;

int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<=0&&b>=0)
        printf("Zero\n");
    else if(a>0)
        printf("Positive\n");
    else if(b<0)
    {
        int difference=b-a;
        if(difference%2==1)
            printf("Positive\n");
        else
            printf("Negative\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+7;
const int N=1e6+5;
char a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",a);
    int s=strlen(a);
    for(int i=0;i<s;i++){
        a[i]=(a[i]+n-'A')%26+'A';
    }
    printf("%s\n",a);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] a = cin.ArrayInt(N);
        int[] ar = new int[3];
        for (int i = 0; i < N; i++)
        {
            if (a[i] % 4 == 0) ar[2]++;
            else if (a[i] % 2 == 0) ar[1]++;
            else ar[0]++;
        }

        int pre = 2;
        for (int i = 0; i < N; i++)
        {
            bool flag = false;
            for (int j = 2 - pre; j <= 2; j++)
            {
                if(ar[j] >= 1)
                {
                    ar[j]--;
                    pre = j;
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                Console.WriteLine("No");
                return;
            }
        }
        Console.WriteLine("Yes");
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' '};

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 18400
#include <stdio.h>
#include <iostream>
#include <vector>
#include<algorithm>

using namespace std;


long long MM = 1e9 + 7;
typedef vector< vector<long long> > mat;

mat mm(const mat& A, const mat&B, int N){

  mat rl( N, vector<long long>(N, 0) );

  for (auto i=0; i< N; i++)
  for (auto j=0; j< N; j++)
  for (auto k=0; k< N; k++)
  rl[i][j] = (rl[i][j] + A[i][k] * B[k][j]) % MM;

  return rl;
}

int main() {

  long long N, K;
  cin >> N >> K;

  vector <vector <long long> > A (N+1,  vector<long long>(N+1)  );

  for(auto i =0; i<N; i++) 
  for(auto j =0; j<N; j++) cin >> A[i][j];

  mat F = A;
  vector <vector <long long> > ans (N+1,  vector<long long>(N+1, 0)  );

  for(auto i =0; i<N; i++)  ans[i][i] = 1;

  while  (K != 0) {
    if (K & 1) ans = mm(ans, F, N);
    F = mm(F, F, N);
    K = K >> 1;
  }

  long long int myans = 0;
  for(auto i =0; i<N; i++) 
  for(auto j =0; j<N; j++) myans = (myans + ans[i][j]) % MM;

  cout << myans << endl;


  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll a[4];
    rep(i, 4)cin >> a[i];
    ll ans = -inf;
    rep(i, 2){
        rep(j, 2){
            chmax(ans, a[i]*a[2+j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
n, m = map(int, input().split())

ab = []
cd = []

A = 0
B = 1
C = 0
D = 1

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

for _ab in ab:
    dis = []
    for _cd in cd:
        dis.append(abs(_ab[A] - _cd[C]) + abs(_ab[B] - _cd[D]))
    print(dis.index(min(dis)) + 1)

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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

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

const long long INF = 1LL<<60;
const int mod = 1000000007;

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

int N;
vector<double> p;
vector<vector<double>> dp(3010, vector<double>(10000));


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

    cin >> N;
    p.resize(N);

    REP(i, N) cin >> p.at(i);

    dp[0][0] = 1.0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            dp[i + 1][j + 1] += dp[i][j]*p[i];
            dp[i + 1][j] += dp[i][j]*(1.0 - p[i]);
        }
    }

    double ans = 0;
    for (int i = 0; i < (N+1)/2; i++) {
        ans += dp[N][i];
    }

    cout << setprecision(10) << (double)1.0 - ans << endl;
    
    return 0;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define pr(a, b) pair<a, b>
#define si set<int>
#define sl set<long long>
#define pq prioirty_queue
#define all(v) v.begin(),v.end()
#define left  (2*idx)+1
#define right (2*idx)+2
#define frt(i,a,b) for(ll i=a; i<b; i++)
#define rew(i,a,b) for(ll i=a; i>=b; i--)
#define fre(i,a,b) for(ll i=a; i<=b; i++)

#define mod %
#define N 100007
#define MOD (ll)(1e9 + 7)
#define test if(true)


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

	int cnt = 0;
	frt(i, 0, n)
	{
		int x;
		cin >> x;
		if(x != (i + 1))
		{
			cnt+=1;
		}
	}

	if(cnt<=2)
	{
		cout << "YES\n";
	}
	else
	{
		cout << "NO\n";
	}
    return 0;
}


Measured memory_bytes: 256