akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (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; }

void solve() {
	string s; cin >> s;
    int n = (int)s.size();
    bool ok = 1;
    rep(i, n) {
        if(s[i] != s[n - 1 - i]) ok = 0;
    }
    rep(i, (n - 1) / 2 - 1) {
        if(s[i] != s[((n - 1) / 2 - 1 - i)]) ok = 0;
    }
    //cerr << ok << endl;
    string t = s.substr((n + 3) / 2 - 1);
    //cerr << t << endl;
    int m = (int)t.size();
    rep(i, m) {
        if(t[i] != t[m - 1 - i]) ok = 0;
    }

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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))
    C = defaultdict(int)
    for a in A:
        C[a] += 1

    ans = 0
    for i in range(10**5+1):
        ans = max(ans, C[i-1] + C[i] + C[i+1])
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61660
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int k,x;
    cin >> k >> x;
    repr(i,x-k+1,x) cout << i << ' '; 
    repr(i,x,x+k) cout << i << ' ';
    cout << endl;

}


Measured memory_bytes: 3652
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()

ll mul_inv(ll a, ll b = MOD) {
	ll t1 = a, t2 = b, t3;
	ll v1 = 1, v2 = 0, v3;
	while (t2 != 1) {
		ll x = t1 / t2;
		t3 = t1 - x*t2;
		v3 = v1 - x*v2;
		t1 = t2, t2 = t3;
		v1 = v2, v2 = v3;
	}
	return (v2 + b) % b;
}

ll F[200050];
ll Finv[200050];
ll C(ll a, ll b) {
	ll rv = F[a];
	rv = (rv * Finv[b]) % MOD;
	rv = (rv * Finv[a - b]) % MOD;
	return rv;
}

int main() {
	int H, W, A, B, i;
	scanf("%d %d %d %d", &H, &W, &A, &B);

	F[0] = 1;
	for (i = 1; i <= 200000; i++) F[i] = F[i - 1] * i % MOD;
	for (i = 0; i <= 200000; i++) Finv[i] = mul_inv(F[i]);
	ll ans = 0;
	for (i = 0; i < H - A; i++) ans = (ans + C(B - 1 + i, B - 1) * C((H - 1 - i) + (W - B - 1), W - B - 1)) % MOD;
	return !printf("%lld\n", ans);
}

Measured memory_bytes: 3328
#line 1 "test/aoj/DSL_2_B.bit.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B"

#line 1 "test/aoj/../../datastructure/binary-indexed-tree.cpp"
// original: http://hos.ac/slides/20140319_bit.pdf
#include <cassert>
#include <vector>

template <class T>
struct BinaryIndexedTree {
  int n;
  std::vector<T> bit;
  BinaryIndexedTree(int n): n(n), bit(n+1) {}

  void build(const std::vector<T> &v) {
    for (int x = 1; x <= n; ++x) bit[x] = v[x-1];
    for (int x = 1; x < n; ++x) bit[x + (x & -x)] += bit[x];
  }

  void add(int a, T w) { // 0-indexed
    assert(0 <= a && a < n);
    // 1-indexed
    for (int x = a+1; x <= n; x += x & -x) bit[x] += w; 
  }

  T sum(int a) { // [0, a)
    assert(0 <= a && a <= n);
    T ret = 0;
    // 1-indexed
    for (int x = a; x > 0; x -= x & -x) ret += bit[x];
    return ret;
  }

  T sum(int l, int r) { // 0-indexed, [l, r)
    return sum(r)-sum(l);
  }
};
#line 4 "test/aoj/DSL_2_B.bit.test.cpp"

#include <iostream>
using namespace std;

int main() {
  int n, q; cin >> n >> q;
  BinaryIndexedTree<int> st(n);
  for (int i = 0; i < q; ++i) {
    int c, x, y; cin >> c >> x >> y; --x;
    if (c == 0) st.add(x, y);
    else cout << st.sum(x, y) << endl;
  }
}



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

namespace Test
{
    class ForStudy
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] y = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Minkowski(x, y, 1));
            Console.WriteLine(Minkowski(x, y, 2));
            Console.WriteLine(Minkowski(x, y, 3));
            Console.WriteLine(Minkowski(x, y));

        }

        public static double Minkowski(int[] a,int[]b,int p)
        {
            double result = 0;
            for(int i = 0; i < a.Length; i++)
            {
                result += Math.Pow(Math.Abs(a[i] - b[i]), p);
            }
            return Math.Pow(result, 1.0 / p);
        }
        public static double Minkowski(int[] a, int[] b)
        {
            double result = 0;
            for (int i = 0; i < a.Length; i++)
            {
                int d = Math.Abs(a[i] - b[i]);
                if (result<d)
                {
                    result = d;
                }
            }
            return result;
        }

    }
}


Measured memory_bytes: 18308
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
#define mkp make_pair
typedef long long ll;
using namespace std;

int N;
vector<ll> S;

int main(){
  cin>>N;
  S.resize(N);
  for(int i=0;i<N;i++) cin>>S[i];

  ll ans=0;
  for(int C=1;C<=N-1;C++){
    ll score=0;
    vector<bool> used(N,false);
    for(int x=0;x*C<N-1;x++){
      if((N-1)-x*C<=C) break;
      if(used[x*C]) break;
      used[x*C]=true;

      if(used[(N-1)-x*C]) break;
      used[(N-1)-x*C]=true;

      score+=S[x*C];
      score+=S[(N-1)-x*C];
      ans=max(ans,score);
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

long long gcd(long long a, long long b);
long long lcm(long long a, long long b);

int main()
{
    long long a, b, c, d;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    long long all = b - a + 1, nb, na;
    nb = b / c + b / d - b / lcm(c, d);
    na = (a - 1) / c + (a - 1) / d - (a - 1) / lcm(c, d);

    printf("%lld\n", all - (nb - na));
    return 0;
}

long long gcd(long long a, long long b)
{
    long long temp;
    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    long long remnant;
    remnant = a % b;
    if (remnant == 0)
    {
        return b;
    }
    else
    {
        return gcd(b, remnant);
    }
}

long long lcm(long long a, long long b)
{
    return a * b / gcd(a, b);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string s,t;
    cin >> s >> t;
    int ans = 0;
    rep(i,3){
      if(s[i] == t[i]) ans++;
    }
    print(ans);
}

Measured memory_bytes: 764
/*  Author : Alpha_The_Coder
    Created on 13/09/2020      */
#include <bits/stdc++.h>
using namespace std;
#define iamalpha ios_base::sync_with_stdio(false);cin.tie(NULL);
#define loop(a,n) for(int i=a;i<n;i++)
#define nloop(a,n) for(int j=a;j<n;j++)
#define lli long long int
lli mod=1000000007;
void solve();
int main()
{
    iamalpha;
    int t=1;
    while(t--)
    {
        solve();
    }
}
void solve()
{
    int n;
    cin>>n;
    if(n==1) cout<<0;
    else cout<<1;
        
    

}


// Solely contributed by Subhojeet Sahoo aka Alpha


Measured memory_bytes: 3644
#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long LL;

const int N = 5010;
const LL mod = 1e9 + 7;

struct V { int c, size; } v[N];
struct E { int t, next; } e[N << 1];
int num;

void add(int s, int t)
{
	e[++ num] = (E) { t, v[s].c }, v[s].c = num;
	e[++ num] = (E) { s, v[t].c }, v[t].c = num;
}

LL f[N][N], g[N], h[N];

void dfs(int x, int fa)
{
	f[x][v[x].size = 1] = 1;
	for (int i = v[x].c; i; i = e[i].next)
	{
		int c = e[i].t;
		if (c == fa) continue;
		dfs(c, x);
		fill(h + 1, h + v[x].size + v[c].size + 1, 0);
		for (int i = 1; i <= v[x].size; ++ i)
			for (int j = 0; j <= v[c].size; ++ j)
				(h[i + j] += f[x][i] * f[c][j]) %= mod;
		for (int i = 1; i <= v[x].size + v[c].size; ++ i) f[x][i] = h[i];
		v[x].size += v[c].size;
	}
	for (int i = 2; i <= v[x].size; i += 2)
		(f[x][0] += mod - f[x][i] * g[i] % mod) %= mod;
}

int n, s, t;

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n - 1; ++ i)
	{
		scanf("%d %d", &s, &t);
		add(s, t);
	}
	g[0] = 1;
	for (int i = 2; i <= n; i += 2)
		g[i] = g[i - 2] * (i - 1) % mod;
	dfs(1, 0);
	printf("%lld\n", mod - f[1][0]);
}

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


int main() {
  int A,B;
  cin >> A >> B;
  if ((A * B) % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }

return 0;
}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 20:56:28 2019

@author: Yamazaki Kenichi
"""

N, X = map(int,input().split())
L = list(map(int,input().split()))

tmp = 0
for i in range(N):
    tmp += L[i]
    if tmp > X:
        break
    if i == N - 1:
        i += 1
        break

print(i+1)

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

static const int INF = 1000000007;
using ll = long long;
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    map<int, int> hh, ww;
    vector<string> aaa(h);
    for (int i = 0; i < h; ++i) {
        cin >> aaa[i];
    }
    for (int i = 0; i < h; ++i) {
        int flag = 1;
        for (int j = 0; j < w; ++j) {
            if(aaa[i][j] == '#') flag = 0;
        }
        if(flag) hh[i]++;
    }
    for (int j = 0; j < w; ++j) {
        int flag = 1;
        for (int i = 0; i < h; ++i) {
            if(aaa[i][j] == '#') flag = 0;
        }
        if(flag) ww[j]++;
    }
    for (int i = 0; i < h; ++i) {
        if(hh[i]) continue;
        for (int j = 0; j < w; ++j) {
            if(ww[j] == 0) cout << aaa[i][j];
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 998244353
#define inf 1e18 
 
using namespace std;

int power(int x, unsigned int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int modp(int a,int m,int n)
{
    n=n%(m-1);
    a=a%m;
    int res=1;
    while(n>0)
    {
        if(n&1) res=(res*a)%m;
        a=(a*a)%m;
        n>>=1;
    }
    return res;
}

int modInverse(int n, int p) 
{ 
    return modp(n, p, p-2); 
}
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int n,s,i,j;
    cin>>n>>s;
    vi v(n);
    for(i=0;i<n;i++) cin>>v[i];
    vi dp(s+1);
    dp[0]=power(2,n,mod);
    for(i=0;i<n;i++)
    {
        for(j=s;j>=v[i];j--)
        {
            dp[j]+=(dp[j-v[i]]*modInverse(2,mod))%mod;
            dp[j]%=mod;
        }
    }
    // for(i=0;i<=s;i++) cout<<dp[i]<<endl;
    cout<<dp[s];
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
string s;
int main()
{
    //IOS;
    cin>>s;
    if(s=="AAA"||s=="BBB")
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    return 0;
}
/*

*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  vector<vector<int>> c(s.size()+1,vector<int>(13,0));
  c[0][0]=1;
  int p=1;
  for(int i=0;i<s.size();i++){
    vector<int> d;
    if(s.at(i)=='?')
      for(int x=0;x<10;x++)
        d.push_back(x*p%13);
    else
      d.push_back((int)(s.at(i)-'0')*p%13);
    for(int j=0;j<13;j++)
      for(int x:d)
        c[i+1][j]=(c[i+1][j]+c[i][(j-x+13)%13])%1000000007;
    p=p*10%13;
  }
  cout<<c[s.size()][5]<<endl;
}

Measured memory_bytes: 8960
//b.c B - ROT N
#include<stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    char msg[100000];
    scanf("%s",msg);
    for(int i=0;msg[i]!='\0';++i){
        int in = (msg[i] - 'A' + n)%26;
        msg[i] = in + 'A';
    }
    printf("%s",msg);
    return 0;
}

Measured memory_bytes: 128
// coded by zeffy
#pragma GCC optimize("O3","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zeroupper") //Enable AVX
#pragma GCC target("avx","popcnt")  //Enable AVX
#include <x86intrin.h> //SSE Extensions
#include <bits/stdc++.h> 
using namespace std;
#define eb emplace_back
#define mp make_pair
#define hello cout<<"hello"<<"\n"
#define forr(i,a,b) for(int i=a;i<b;i++)
#define it(s)	for(auto itr:s)
#define dvg(s) 	for(auto itr:s)	cout<<itr<<" ";cout<<endl;
#define dbg(s)	cout<<#s<<"= "<<s<<endl;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF=(lli)1e17+5;
const ulli MOD=1e8+7;

int main()
{
	int n;cin>>n;
	vector<lli>h(n,0);
	forr(i,0,n) cin>>h[i];
	vector<lli> dp(n,INF);
	dp[0]=0;dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 4828
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string C1, C2;
    cin >> C1 >> C2;
    if(C1[0]==C2[2]&&C1[2]==C2[0]&&C1[1]==C2[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
//すぬけ見ました
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;

int main(){
  ll n,x;
  cin >> n >> x;
  vector<tuple<ll,ll,ll>>a(n),b(n),c(n);
  for(int i=0; i<n; i++){
    cin >> get<1>(a[i]) >> get<2>(a[i]) >> get<0>(a[i]);
  }
  sort(a.begin(),a.end());
  
  ll j=1;
  for(int i=1; i<n; i++){
    if(get<0>(a[i])!=j){
      j++;
      continue;
    }
    
    if(get<1>(a[i])==get<2>(a[i-1])){
      get<1>(a[i])=get<1>(a[i-1]);
      get<0>(a[i-1])=0;
    }
  }
  
  vector<ll>count(100005);
  for(int i=0; i<n; i++){
    if(get<0>(a[i])==0) continue;
    count[get<1>(a[i])]++;
    count[get<2>(a[i])+1]--;
  }
  
  vector<ll>dp(100005);
  dp[0]=count[0];
  for(int i=1; i<100005; i++){
    dp[i]=dp[i-1]+count[i];
    
  }

  ll ans=0;
  for(int i=0; i<100005; i++){
    ans=max(ans,dp[i]);
  }
  cout << ans << endl;
}
  
  
  


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

int main() {
  ll n,m,sum = 0;
  cin >> n >> m;
  for(ll i = 0;i < m;i++){
    ll a;
    cin >> a;
    sum += a;
  }
  if(sum > n) cout << -1 << endl;
  else cout << n-sum << endl;
}


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

using std::make_pair;
using std::pair;

using std::max;
using std::min;
using std::sort;

using std::cin;
using std::cout;

using std::vector;

int main() {
    int x, y;
    cin >> x >> y;

    bool f = false;
    for (int turtle = 0; turtle <= x; turtle++) {
        if (turtle * 2 + (x - turtle) * 4 == y) f = true;
    }

    cout << (f ? "Yes\n" : "No\n");
    return 0;
}

Measured memory_bytes: 3632
import java.util.ArrayList;
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 = sc.nextInt();
        List<Long> a = new ArrayList<>();
        int oddCount = 0;
        for (int i = 0; i < n; i++) {
            Long num = sc.nextLong();
            if (num % 2 == 1) {
                oddCount++;
            }
            a.add(num);
        }
        if (oddCount % 2 == 0) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }

}


Measured memory_bytes: 62376
#include <stdio.h>
#define MAX 251
int parent(int i) {return i/2;}
int left(int i) {return 2*i;}
int right(int i) {return 2*i+1;}

int main()
{
  int h,i,a[MAX+1];
  scanf("%d",&h);
  for(i=1;i<=h;i++) scanf("%d",&a[i]);
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,a[i]);
    if(parent(i)>=1) printf("parent key = %d, ",a[parent(i)]);
    if(left(i)<=h) printf("left key = %d, ",a[left(i)]);
    if(right(i)<=h) printf("right key = %d, ",a[right(i)]);
    printf("\n");
  }


  return 0;
}


Measured memory_bytes: 2044
using System;
 
public class AtCoder
{
    public static void Main()
    {
        int n;
        n = int.Parse(Console.ReadLine().Trim());
        string[] s;
        s = Console.ReadLine().Trim().Split(' ');
        int[] a = new int[n];
        int avg = 0;
        for (int i = 0; i < n; i++)
        {
            a[i] = n*int.Parse(s[i]);
            avg = avg + a[i];
        }
        avg = avg / n;
        int m,k;
           int ans;
        m = 10000000;
        for (int i = 0; i < n; i++)
        {
            k = avg - a[i];
            if (k < 0) k = -k;
            m = (int)Math.Min(m, k);
            
        }
        ans = -1;
        int j = 0;
        while (ans == -1)
        {
          	k = avg - a[j];
            if (k < 0) k = -k;
            if (k == m) ans = j;
            j++;
        }
 
 
            Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
from collections import Counter


def solve(n, ddd):
    if ddd[0] != 0:
        return 0
    cnt = Counter(ddd)
    if cnt[0] != 1:
        return 0
    max_c = max(cnt)
    for i in range(max_c + 1):
        if i not in cnt:
            return 0

    MOD = 998244353
    ans = 1
    for i in range(max_c):
        prev = cnt[i]
        curr = cnt[i + 1]
        ans = ans * pow(prev, curr, MOD) % MOD
    return ans


n = int(input())
ddd = list(map(int, input().split()))

print(solve(n, ddd))

Measured memory_bytes: 99200
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

int main()
{
    int a,b;
    cin >> a >> b;
    if(a+b>=10)
        cout << "error" << endl;
    else
        cout << a+b << endl;

    return 0;
}

Measured memory_bytes: 256
import copy

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


def selection_sort(C, N):
    for i in range(N):
        min_j = i
        for j in range(i, N):
            if C[j]['value'] < C[min_j]['value']:
                min_j = j
        C[i], C[min_j] = C[min_j], C[i]


if __name__ == "__main__":
    N = int(input())
    C = list(map(lambda c: {'suit': c[0:1],'value': int(c[-1])}, input().split()))
    C2 = copy.deepcopy(C)
    bubble_sort(C, N)
    print(' '.join(map(lambda x: x['suit']+str(x['value']), C)))
    print('Stable')  # bubblesort is definitely Stable sort

    selection_sort(C2, N)
    print(' '.join(map(lambda x: x['suit']+str(x['value']), C2)))
    for bc, sc in zip(C, C2):
        if bc['suit'] != sc['suit']:
            print('Not stable')
            exit()
    print('Stable')



Measured memory_bytes: 6344
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

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

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

LL lcm(LL a,LL b){
	return a*b/gcd(a,b);
}

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	string s;
	cin>>s;
	if(s=="ABC"){
		cout<<"ARC"<<endl;
	}else{
		cout<<"ABC"<<endl;
	}

	return 0;
}


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

int main() {
  int64_t n, k;
  cin >> n >> k;
  vector<int64_t> p(n);
  rep (i, n) cin >> p.at(i);

  vector<double> exVal(n);
  rep (i, n) exVal.at(i) = (1 + p.at(i)) / 2.0;

  double total = 0.0;
  for (int i = 0; i < k; i++) total += exVal.at(i);
  double maxTotal = total;
  for (int i = 1; i <= n - k; i++) {
    total -= (exVal.at(i - 1));
    total += (exVal.at(i + k - 1));
    maxTotal = max(maxTotal, total);
  }

  cout << fixed << setprecision(10) << maxTotal << endl;
  return 0;
}


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

signed main(){
  int N;
  string S;
  cin>>N>>S;
  int top=0,X=0;
  rep(i,N){
    if(S[i]=='I')X+=1;
    else X-=1;
    top=max(top,X);
  }
  cout<<top<<endl;
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
    int n; cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = n - 1; i > 0; i--) cout << a[i] << " ";
    cout << a[0] << endl;
}


Measured memory_bytes: 3060
import bisect
import math

N, H = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

maxA = max(A)
B.sort()
idx_b = bisect.bisect(B, maxA)

if idx_b == N:
    print(math.ceil(H / maxA))
else:
    h = H
    cnt = 0
    for idx in range(N - 1, max(-1, idx_b - 1), -1):
        h -= B[idx]
        cnt += 1
        if h <= 0:
            print(cnt)
            exit()
    print(cnt + math.ceil(h / maxA))


Measured memory_bytes: 11388
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
using namespace std;
int main(){
    ll A,B,M;
    cin>>A>>B>>M;
    vector<ll> a(A),b(B);
    ll mia,mib=1e9;
    rep(i,0,A){
        cin>>a[i];
        mia=min(mia,a[i]);
    }
    rep(i,0,B){
        cin>>b[i];
        mib=min(mib,b[i]);
    }
    
    ll ans=mia+mib;
    rep(i,0,M){
            ll x,y,c;
            cin>>x>>y>>c;
            ans=min(ans,a[x-1]+b[y-1]-c);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;

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

    long MIN = 10000000000;
    int count = 0;
    for(int i = 0;i<N;i++){
        MIN = min(MIN,abs(A[i]));
        if(A[i] < 0) {
            count = count + 1;
        }
    }

    if(count % 2 == 0){
        cout << sum << endl;
    }else{
        cout << sum - MIN * 2 << endl;
    }
}

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

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

using namespace std;

int main(){
	int n; cin>>n;
	int x[8],y[8];
	rep(i,n) cin>>x[i]>>y[i];

	int p[8];
	rep(i,n) p[i]=i;
	double ans=0;
	do{
		rep(i,n-1) ans+=hypot(x[p[i]]-x[p[i+1]],y[p[i]]-y[p[i+1]]);
	}while(next_permutation(p,p+n));
	rep(i,n) ans/=i+1;
	cout<<setprecision(9)<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, m;
	cin >> n >> m;
	
	int ans = (int)pow(2.0, (double)m) * (1900 * m + 100 * (n - m));
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int main(){
	ll x,y;
	cin>>x>>y;
	ll ans=0,tmp=x;
	while(tmp<=y){
		tmp*=2;
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define N 500009
#define inf 1e18
//int mod=1e9+7;
int mod=998244353;
#define P pair<int,int>
#define F first
#define S second
#define ll long long
#define all(v) v.begin(),v.end()

#define ordered_set tree<P, null_type,less<P>, rb_tree_tag,tree_order_statistics_node_update> 

void end(int n=-1){
	cout<<n<<"\n";exit(0);
}
int n,w;
int W[N],V[N];
int fun(){
	int tot=0;
	for(int i=0;i<n;i++){
		tot+=V[i];
	}
	int dp[n+1][tot+1];
	dp[0][0]=0;
	int ans=0;
	for(int i=1;i<=tot;i++)dp[0][i]=inf;
	for(int i=0;i<n;i++){
		for(int j=0;j<=tot;j++){
			if(j>=V[i]){
				dp[i+1][j]=min(dp[i][j],dp[i][j-V[i]]+W[i]);
			}
			else{
				dp[i+1][j]=dp[i][j];
			}
			if(dp[i+1][j]<=w){
				ans=max(ans,j);
			}
		}
	}
	return ans;
}

int32_t main(){
    AB_BHI_NI_DEGI
	cin>>n>>w;
	for(int i=0;i<n;i++){
		cin>>W[i]>>V[i];
	}
	cout<<fun()<<"\n";
    return 0;
}

Measured memory_bytes: 82528
#include <iostream>
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++) {
			if (i % 2 == 0) {
				for (int j = 0; j < W; j++) {
					if (j % 2 == 0) {
						cout << "#";
					} else {
						cout << ".";
					}
				}
			} else {
				for (int j = 0; j < W; j++) {
					if (j % 2 == 0) {
						cout << ".";
					} else {
						cout << "#";
					}
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> x(m);
  for(int i=0;i<m;i++)
    cin>>x.at(i);
  sort(x.begin(),x.end());
  vector<int> d(m-1);
  for(int i=0;i<m-1;i++)
    d.at(i)=x.at(i+1)-x.at(i);
  sort(d.begin(),d.end(),greater<int>());
  for(int i=0;i<n-1&&i<m-1;i++)
    d.at(i)=0;
  int s=0;
  for(int i=0;i<m-1;i++)
    s+=d.at(i);
  cout<<s<<endl;
}

Measured memory_bytes: 1024
n = input()
n = int(n)
input_list = list(map(int, input().split()))
#print(input_list)
dicts = {}
for i in range(n):
    if input_list[i] not in dicts.keys():
        dicts[input_list[i]] = 0
    dicts[input_list[i]] += 1

sums = 0
dicts2 = {}
for key, value in dicts.items():
    if dicts[key] >= 2:
        dicts2[key] = value * (value - 1) // 2
    else:
        dicts2[key] = 0
    sums += dicts2[key]

#print(dicts, dicts2)
for j in range(n):
    if dicts[input_list[j]] >= 2:
        value1 = dicts[input_list[j]]
        res = sums - dicts2[input_list[j]] + (value1-1) * (value1 - 2) // 2
    else:
        res = sums
    print(str(res))

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

int main()
{
  int x0, y0, x1, y1;
  cin >> x0 >> y0 >> x1 >> y1;
  
  int dx = x1 - x0;
  int dy = y1 - y0;
  
  int x2 = x1 - dy;
  int y2 = y1 + dx;
  
  int x3 = x2 - dx;
  int y3 = y2 - dy;
  
  cout << x2 << " " << y2 << " " << x3 << " " << y3;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
p=[]
r=0

if N%2==0:
  c=0
  while N%2==0:
    c+=1
    N/=2
  p.append(c)
  
for i in range(3,int(N**0.5)+1,2):
  if N%i==0:
    c=0
    while N%i==0:
      c+=1
      N/=i
    p.append(c)
  
if N!=1:
  p.append(1)
  
for i in p:
  r+=int(((8*i+1)**0.5-1)/2)
print(r)

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

int main(){
    int n, ans;
    ans = 0;
    cin >> n;
    vector<int> vec(n);
    rep(i, n) cin >> vec[i];
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            ans += vec[i] * vec[j];
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

const Int alp = 26;

Int compute_score(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out) {
    Int score = 0;
    vector<Int> last(alp, 0);

    Int count = out.size();
    for (Int d = 0; d < count; d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    return score;
}

Int evaluate(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out, Int &k) {
    Int score = 0;
    vector<Int> last(alp, 0);

    Int count = out.size();
    for (Int d = 0; d < count; d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    count = min(D, (Int)(out.size() + k));
    for (Int d = out.size(); d < count; d++) {
        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
    }

    return score;
}

vector<Int> solve(Int &D, vector<vector<Int>> &s, vector<Int> &c, Int &k) {
    vector<Int> out;

    for (Int _ = 0; _ < D; _++) {
        Int max_score = -INF;
        Int best_i = 0;

        for (Int i = 0; i < alp; i++) {
            out.push_back(i);

            Int score = evaluate(D, s, c, out, k);
            if (max_score < score) {
                max_score = score;
                best_i = i;
            }

            out.pop_back();
        }

        out.push_back(best_i);
    }

    return out;
}

Int scoring(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &t) {
    Int ans = 0;
    vector<Int> last(alp, 0);

    for (Int i = 0; i < D; i++) {
        ans += s[i][t[i]];
        last[t[i]] = i + 1;

        for (Int j = 0; j < alp; j++) {
            ans -= c[j] * (i - last[j] + 1);
        }
    }

    return ans;
}

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

    Int D;
    cin >> D;
    vector<Int> c(alp);
    vector<vector<Int>> s(D, vector<Int>(alp));
    for (Int i = 0; i < alp; i++) {
        cin >> c[i];
    }
    for (Int i = 0; i < D; i++) {
        for (Int j = 0; j < alp; j++) {
            cin >> s[i][j];
        }
    }

    vector<Int> ans(D, 0);
    Int point = 0;
    for (Int k = 0; k <= alp; k++) {
        vector<Int> t = solve(D, s, c, k);
        Int p = scoring(D, s, c, t);

        if (point < p) {
            point = p;
            ans = t;
        }
    }

    for (auto e : ans) {
        cout << e + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3740
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        Set<Integer> set = new HashSet<Integer>();
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
            set.add(a[i]);
        }
        if (set.size() == n) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
        sc.close();
    }
}

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

int dp[128][128][1024];
int n;
int P[128];

void init() {
  for(int i = 0; i < 128; ++i) {
    for(int j = 0; j < 128; ++j) {
      for(int k = 0; k < 1024; ++k) {
        dp[i][j][k] = -1;
      }
    }
  }
}

int main() {
  for(;;) {
    init();
    scanf("%d", &n);
    if( n == 0 ) break;
    for(int i = 0; i < n; ++i) {
      scanf("%d", &P[i]);
    }
    dp[0][0][0] = 0;
    for(int i = 0; i < n; ++i) {
      for(int j = 0; j < n; ++j) {
        for(int k = 0; k < 1024; ++k) {
          if( dp[i][j][k] == -1 ) continue;
          dp[i+1][j][k] = std::max(dp[i+1][j][k], dp[i][j][k]);
          // 1000
          int count_1000_2 = (P[i] + 999) / 1000;
          int rem0 = count_1000_2 * 1000 - P[i];
          int& next0 = dp[i+1][j + (rem0%1000>=500 ? 1 : 0)][k + count_1000_2];
          next0 = std::max(next0, dp[i][j][k] + (rem0%1000>=500 ? rem0 - 500 : rem0));
          //
          int count_1000 = (P[i] + 999) / 1000;
          int rem1 = dp[i][j][k] + count_1000 * 1000 - P[i];
          int& next = dp[i+1][j + (rem1>=500 ? 1 : 0)][k + count_1000];
          next = std::max(next, rem1>=500 ? rem1 - 500 : rem1);
          // //
          // int rem11 = rem1 % 1000;
          // int& next1 = dp[i+1][j + (rem11%1000>=500 ? 1 : 0)][k + count_1000];
          // next1 = std::max(next1, rem11%1000>=500 ? rem11 - 500 : rem11);
          // rem
          if( dp[i][j][k] > P[i] ) {
            int rem2 = dp[i][j][k] - P[i];
            int& next = dp[i+1][j + (rem2%1000>=500 ? 1 : 0)][k];
            next = std::max(next, (rem2%1000>=500 ? rem2 - 500 : rem2));
          }
        }
      }
    }
    for(int i = 0; i < 6; ++i) {
      for(int j = 0; j < 6; ++j) {
        for(int k = 0; k < 6; ++k) {
          //printf("(i, j, k) = (%d, %d, %d) : %d\n", i, j, k, dp[i][j][k]);
        }
      }
    }
    int res = (1 << 28);
    int max = -1;
    for(int j = n; j >= 0; --j) {
      for(int k = 0; k < 1024; ++k) {
        if( dp[n][j][k] == -1 ) continue;
        int cost = k * 1000 - 500 * j - dp[n][j][k];
        res = std::min(res, cost);
      }
      if( res != (1 << 28) ) {
        max = j;
        break;
      }
    }
    printf("%d %d\n", max, res);
  }
         
        

  return 0;
}

Measured memory_bytes: 68680
s = input()

if s =="SAT":
    print(1)
elif s== "FRI":
    print(2)
elif s== "THU":
    print(3)
elif s== "WED":
    print(4)
elif s== "TUE":
    print(5)
elif s== "MON":
    print(6)
elif s== "SUN":
    print(7)


Measured memory_bytes: 8976
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int W = in.i();
        long[][] dp = new long[N + 1][W + 1];

        for (int i = 1; i <= N; i++) {
            int w = in.i();
            int v = in.i();
            for (int j = 0; j < w; j++) {
                dp[i][j] = dp[i - 1][j];
            }
            for (int j = w; j <= W; j++) {
                dp[i][j] = Math.max(dp[i - 1][j - w] + v, dp[i - 1][j]);
            }
        }
        out.println(dp[N][W]);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 139300
#個数の入力値が0になるまで繰り返す。空の辞書を作成。
while True:
    n = int(input())
    if n == 0:break
    sya = {}
    
    #辞書の中に社員番号があったなら数値を加算し、ないなら新しく追加する。
    for _ in range(n):
        try:
            a,b,c = map(int,input().split())
            sya[a] = sya[a]+b*c
        except KeyError:
            sya[a] = b*c
    k =[]
    
    #1,000,000以上の売り上げを出した社員番号を出力し、ないならNAを出力する。
    for i in sya:
        if sya[i] >= 1000000:print(i)
        k.append(sya[i] >= 1000000)
    if not any(k) == True:print("NA")


Measured memory_bytes: 5832
// Problem: D - Moving Piece
// Contest: AtCoder - AtCoder Beginner Contest 175
// URL: https://atcoder.jp/contests/abc175/tasks/abc175_d
// Memory Limit: 1024 MB
// Time Limit: 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)



    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define FAST ios_base::sync_with_stdio(false);cin.tie(0);
    const double EPS = 1e-9;
    const double PI = acos(-1);
    const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
    //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
    //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
    const int dx[] = {0 , 1 , 0 , -1};
    const int dy[] = {1 , 0 , -1 , 0};
    //#define MOD         1000000007LL
    #define MAX         1000005
    const ll MOD = 1000000000 + 7;
    
    int main()
    {
        FAST
        int t;
        t = 1;

        while(t--)
        {
           int n , k;
           cin >> n >> k;
           vector<ll> p(n + 5),c(n + 5),mark(n + 5),sum(n + 5);
           for(int i = 1 ; i <= n ; i++)
           {
               cin >> p[i];
           }
           
           for(int i = 1 ; i <= n ; i++)cin >> c[i];
           
           for(int i = 1 ; i <= n ; i++)
           {
               int m = i;
               ll s = 0;
               vector<int> vis(n + 5);
               
               for(int j = 0 ; j <= n ; j++)
               {
                   if(vis[m])
                   {
                       mark[i] = j;
                       sum[i] = s;    
                       break;
                   }
                   vis[m] = 1;
                   m = p[m];
                   s += c[m];
               }
           }
           
           ll ans = LLONG_MIN;
           
           for(int i = 1 ; i <= n ; i++)
           {
               int m = i;
               ll s = 0;
               for(int j = 1 ; j <= mark[i] ; j++)
               {
                   if(j > k)break;
                   m = p[m];
                   s += c[m];
                   int t = (k - j) / mark[i];
                   ll s2 = s + t * sum[i];
                   ans = max(ans , s);

                   ans = max(ans , s2);
               }
           }
           
           cout << ans << endl;
        }
    }



Measured memory_bytes: 3772
#!/usr/bin/env python3
import collections

def main():
    *I, = map(int, open(0).read().split())
    N = I[0]
    A = I[1:]

    c = collections.Counter(A)
    for i in range(1, N+1):
        if i in c:
            print(c[i])
        else:
            print(0)

main()

Measured memory_bytes: 36676
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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; }

using ll = long long;
using ull = unsigned long long;
using namespace std;


int main() {
    int n; cin >> n;
    vector<vector<ll>>  data(100,vector<ll>(100,0ll));
    rep(i,n) {
        long double a; cin >> a;

        ll aa = (ll)llround(a * 1000000000);
        int c1 = 0;
        while (aa % 2 == 0) {
            aa /= 2;
            c1++;
        }
        c1 = min(c1,99);
        int c2 = 0;
        while (aa % 5 == 0) {
            aa /= 5;
            c2++;
        }
        c2 = min(c2,99);

        data[c1][c2]++;
    }
    auto save = data;
    rrep(i,100) rrep(j,99) data[i][j] += data[i][j+1];
    rrep(i,100) rrep(j,99) data[j][i] += data[j+1][i];

    ll ans = 0;
    rep(i,100) rep(j,100) {
        ans += save[i][j] * data[max(0,18-i)][max(0,18-j)];
        if (i >= 9 && j >= 9) ans -= save[i][j];
    }
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 3888
S = list(input())
k = 0 
for i in range(0, len(S)):
    if (i + 1) % 2 == 0:
        if S[i] in "LUD":
            k += 1
        else:
            print("No")
            exit()
    else:
        if S[i] in "RUD":
            k += 1
        else:
            print("No")
            exit()
if k >= 1:
    print("Yes")

Measured memory_bytes: 3060
n = int(input())
h = [int(v) for v in input().split()]

diff = []
for i in range(n-1):
    diff.append(h[i+1] - h[i])

ans = 0
cur = 0
while cur <= n-2:
    tmp = 0
    while True:
        if cur <= n-2 and diff[cur] <= 0:
            tmp += 1
            cur += 1
        else:
            ans = max(ans, tmp)
            cur += 1
            break

print(ans)

Measured memory_bytes: 14224
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)
#define l_ength size

ll sq(ll x){
	return x*x;
}

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

bool isvowel(char c){
	int i;
	string v="aeiou";
	for(i = (v.size()-1); i>=0; --i){
		if(c == v[i]){
			return true;
		}
	}
	return false;
}

int main(void){
	int l,r;
	string s;
	cin >> s;
	l = 0;
	r = s.length()-1;
	while(s[l]!='A'){
		++l;
	}
	while(s[r]!='Z'){
		--r;
	}
	cout << (r-l+1) << endl;
	return 0;
}

Measured memory_bytes: 640