akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n, k;
    while(cin >> n >> k){
        if(n == 0) break;
        vector<bool> card(n+1,false);
        int temp;
        for(int i = 0;i<k;i++){
            cin >> temp;
            card[temp] = true;
        }
        vector<int> max_l;
        temp = 0;
        for(int i = 1;i<=n;i++){
            if(card[i]){
                temp++;
                if(i==n){
                    max_l.push_back(temp);
                }
            }
            else if(card[i-1]){
                max_l.push_back(temp);
                temp = 0;
            }
            else {
                max_l.push_back(0);
            }
        }
        int max_len = 0;
        if(card[0]){
            for(int i = 1;i<max_l.size();i++){
                max_len = max(max_len, max_l[i-1] + max_l[i] + 1);
            }
        }
        else{
            max_len = *max_element(max_l.begin(), max_l.end());
        }
        cout << max_len << endl;
    }
    return 0;
}

Measured memory_bytes: 3192
#pragma GCC optimize(2)
#include<iostream>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

long long a,b; 

int main()
{	
	cin>>a>>b;
	if((a==0 || b==0) || (b>0 && a<0) || (a>0 && b<0)) 
		cout<<"Zero"<<endl;
	else if(a>0 && b>0) cout<<"Positive"<<endl;
	else if(a<0 && b<0)
		if((b-a)%2==1) 
			cout<<"Positive"<<endl;
		else cout<<"Negative"<<endl;
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,W;
    cin>>n>>W;
    vector<int> v(n),w(n);
    for(int i=0;i<n;i++)cin>>v[i]>>w[i];
    int dp[10010];
    //dp[i]:ちょうど重さiで達成できる最高の価値
    fill(dp,dp+10010,-1);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=W;j>=0;j--){
            if(j-w[i]<0)continue;
            dp[j]=max(dp[j-w[i]]+v[i],dp[j]);
        }
    }
    int res=0;
    for(int i=0;i<=W;i++)res=max(res,dp[i]);
    cout<<res<<endl;
}


Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    string s,t;
    cin >> s >> t;

    for(int i = s.length()-1; i >= 0; i--){
        
        if(s.length()-i < t.length()) continue;
        for(int j = 0; j <= t.length(); j++){
            if(j == t.length()){
                for(int k = 0; k < t.length(); k++) s[i+k] = t[k];
                for(int k = 0; k < s.length(); k++) if(s[k] == '?') s[k] = 'a';
                cout << s << endl;
                return 0;
            }
            if(s[i+j] != t[j] && s[i+j] != '?') break;
        }
    }
    cout << "UNRESTORABLE" << endl;
    
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265358979323846;

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

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

class BBackfront {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n; in>>n;
		int pos[n+1], dp[n+1];
        memset(dp, -1, sizeof(dp));
        int res = 1;
        f(i, n){
            int x; in>>x;
            if(dp[x-1]!=-1) dp[x] = 1 + dp[x-1];
            else dp[x] = 1;
            res = max(res, dp[x]);
        }
        out<<n-res;

	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	BBackfront solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1024
n = int(input())
s = [input() for i in range(n)]
 
print("AC x " +  str(s.count('AC')))
print("WA x " +  str(s.count('WA')))
print("TLE x " +  str(s.count('TLE')))
print("RE x " +  str(s.count('RE')))

Measured memory_bytes: 16212
#include <iostream>
#include <vector>
#define FASTIO ios_base::sync_with_stdio (0);cin.tie (0);cout.tie (0);
#define INF 1e9 + 5

using namespace std;

int get_first_negative (vector<int>& vt) {
    int low = 0, high = vt.size () - 1;
    while (low <= high) {
        int mid = (low + high) / 2;
        if (vt[mid] < 0 && vt[max (mid - 1, 0)] >= 0) {
            return mid;
        } else if (vt[mid] >= 0) {
            low = mid + 1;
        } else if (vt[max (mid - 1, 0)] < 0) {
            high = mid - 1;
        }
    }
    return -1;
}

int get_first_zero (vector<int>& vt) {
    int low = 0, high = vt.size () - 1;
    while (low <= high) {
        int mid = (low + high) / 2;
        if (vt[mid] == 0 && vt[max (mid - 1, 0)]  == 1) {
            return mid;
        } else if (vt[mid] == 1) {
            low = mid + 1;
        } else if (vt[mid] == 0) {
            high = mid - 1;
        }
    }
    return -1;
}

int min_jumps (vector<int>& stones, int n) {
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        if (i + 1 < n) {
            dp[i + 1] = min (dp[i + 1], dp[i] + abs (stones[i] - stones[i + 1]));
        }
        if (i + 2 < n) {
            dp[i + 2] = min (dp[i + 2], dp[i] + abs (stones[i] - stones[i + 2]));
        }
    }
    return dp[n - 1];
}

int main () {
    FASTIO
    int n;
    cin >> n;
    vector<int> vt (n);
    for (int &elem: vt) {
        cin >> elem;
    }
    cout << min_jumps (vt, vt.size ());
    return 0;
}


Measured memory_bytes: 1024
from operator import itemgetter

N,M = map(int,input().split())

li=[list(map(int,input().split())) for i in range(M)]

li.sort(key=itemgetter(1,0))

#print(li)

ans = 0
prevcut = -1
for a, b in li:
  if a < prevcut and prevcut <= b:
    continue
  ans += 1
  prevcut = b
  
print(ans)


Measured memory_bytes: 35440
n=int(input())
res=n
for i in range(1,n):
  j=n-i
  i_=i
  j_=j
  if(i>j):break
  tmp=0
  while(i>0):
    tmp+=i%10
    i//=10
  while(j>0):
    tmp+=j%10
    j//=10
  res=min(res,tmp)
print(res)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include<algorithm>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

void dfs(vll p, ll n, ll i, ll N, ll M, vvll &lis){
    if(i == N){
        lis.emplace_back(p);
        return;
    }
    for(ll k=n; k<=M; k++){
        vll t = p;
        t.emplace_back(k);
        dfs(t, k, i+1, N, M, lis);
    }
}

int main(){
    ll N, M, Q; cin >> N >> M >> Q;
    vvll a(Q, vll(4));
    for(int i=0; i<Q; i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    }
    vvll m(0);
    vll p(0);
    dfs(p, 1, 0, N, M, m);
    ll max = 0;    
    for(auto x: m){
        ll res = 0;
        for(int i=0; i<Q; i++){
            if(x[a[i][1]-1] - x[a[i][0]-1] == a[i][2]){
                res += a[i][3];
            }
        }
        if(res > max){
            max = res;
        }
    }
    cout << max;
}

Measured memory_bytes: 13916
using System;

class A {
    public static void Main() {
        var line = Console.ReadLine().Split();
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var c = int.Parse(line[2]);
        var d = int.Parse(line[3]);
        Console.WriteLine(Math.Max(a * b, c * d));
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
#define llg long long 
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg n,m,mid,ans,x;
int main()
{
	cin>>x;
	x*=2;
	llg l=1,r=1000000000;
	while (l<=r)
	{
		mid=(l+r)>>1;
		llg val=mid*mid+mid;
		if (val>=x) {r=mid-1,ans=mid;} else l=mid+1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)

const int M=1000000007;
const int MM=998244353;


 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e5+5;

ll par[N];

ll find(ll x){
  if(par[x]==x)return x;
  return par[x]=find(par[x]);
}

void unio(ll a,ll b){
  a=find(a),b=find(b);
  par[a]=b;
}


int main()
{ 

IOS;


ll n;cin>>n;

ll ans=1e18;

for(ll i=1;i*i<=n;i++){
  if(n%i==0){
    ans=min(ans,i-1+(n/i)-1);
  }
}

cout<<ans;


return 0;
 
}


Measured memory_bytes: 3636
def main():
    N, M = [int(n) for n in input().split()]
    memo = [0]*N
    for i in range(M):
        l, r = [int(n)-1 for n in input().split()]
        memo[l] += 1
        if  r+1 < N:
            memo[r+1] -= 1
    for i in range(N-1):
        memo[i+1] += memo[i]
    res = 0
    for i in range(N):
        if memo[i] == M:
            res += 1
    print(res)
main()

Measured memory_bytes: 6900
n = int(input())
a = list(map(int,input().split()))
color = [0,0,0,0,0,0,0,0,0]
for i in range(n):
    for j in range(1,9):
        if a[i]<400*j and 400*(j-1) <= a[i] and color[j-1] == 0:
            color[j-1] += 1
    if a[i] >= 3200:
        color[8] += 1
print(max(1,sum(color[0:8])),sum(color))

Measured memory_bytes: 38384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
int main()
{
	int n; ll k; cin>>n>>k;
  ll g=0, mx=0;
  for(int i=0; i<n; i++){
    ll a; cin>>a;
    g=gcd(g, a);
    mx=max(mx, a);
  }
  if(k<=mx && k%g==0){
    cout<<"POSSIBLE"<<endl;
  }else{
    cout<<"IMPOSSIBLE"<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

//constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。

for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}

*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

int dy[] = { 0, 1, 0, -1 };
int dx[] = { 1, 0, -1, 0 };


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/


/*実行開始からの経過時間を表すよ。

while (clock() < 1900000) {  }

*/


/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/


/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/


int main() {
	int n, m; cin >> n >> m;
	int x[114514];
	for (int i = 0; i < m; i++) {
		cin >> x[i];
	}

	sort(x, x + m);

	priority_queue<int> q;

	int ans = 0;
	for (int i = 1; i < m; i++) {
		ans += abs(x[i] - x[i - 1]);
		q.push(abs(x[i] - x[i - 1]));
	}
	while (!q.empty() && --n) {
		int d = q.top(); q.pop();
		ans -= d;
	}

	cout << ans << endl;

}



Measured memory_bytes: 1276
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 62;

ll a[100001] = {};
int main() {
	ll n; cin >> n;
	ll cnt = 0;
	ll state = 0;
	rep(i, 0, n) cin >> a[i];

	ll x = a[0];
	ll y;
	rep(i, 1, n) {
		y = a[i];
		if (x == y)continue;

		if (state) {
			if (state == 1 && x > y || state == -1 && x < y) {
				state = 0;
				cnt++;
			}
		}
		else {
			state = (x < y) ? 1 : -1;
		}

		x = y;
	}
	cout << cnt + 1 << endl;
	return 0;
}

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

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MAX_int = (1 << 31) - 1;
const double eps = 1e-6;
const double pi = atan2(0, -1);

vector<vector<int> > g;

int dfs(int u)
{
    if (sz(g[u]) == 0)
        return 0;
    vector<int> s;
    for (int v : g[u])
    {
        int x = dfs(v);
        s.push_back(x);
    }
    sort(s.begin(), s.end());
    rep(i, 1, sz(s))
        s[i] = max(s[i], s[i - 1] + 1);
    return s[sz(s) - 1] + 1;
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("battleship.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //int TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    g.resize(n);
    rep(i, 1, n)
    {
        int x;
        cin >> x;
        x--;
        g[x].push_back(i);
    }
    cout << dfs(0);
    return 0;
}


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

int main()
{
    int a,i,j,flag=0;
    scanf("%d",&a);
        for(i=0;i<=a;i=i+4)
        for(j=0;j<=a;j=j+7){
            if(i+j==a && a!=0){
                flag=1;
            }
        }
        if(flag==1){
            printf("Yes\n");
        }
        if(flag==0){
            printf("No\n");
        }
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;

namespace SortingThreeNumbers
{
    class Program
    {
        static void Main(string[] args)
        {
            var a_b_c = Console.ReadLine().Split(new Char[] { ' ' }).Select(x => decimal.Parse(x)).ToList();
            a_b_c.Sort();
            Console.WriteLine("{0}", string.Join(" ", a_b_c));
        }
    }
}



Measured memory_bytes: 18540
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 300000
#define INF 1000000000000000000LL
using namespace std;
typedef long long LL;
int N;
LL T[MAXN+5],sum[MAXN+5];
LL L[MAXN+5],R[MAXN+5];
int que[MAXN+5];
LL f[MAXN+5],h[MAXN+5],g[MAXN+5],ans[MAXN+5];
LL GetY(int j)
{
	return 1LL*f[j]+(1LL*j*j-1LL*j)/2LL+sum[j];
}
void Rev(LL seq[])
{
	for(int i=1;i<=N/2;i++)
		swap(seq[i],seq[N-i+1]);
}
void DP()
{
	int s=0,t=0;
	que[t++]=0;
	fill(f+1,f+1+N,-INF);
	for(int i=1;i<=N;i++)
	{
		while(s<t-1)
		{
			int j1=que[t-2],j2=que[t-1];
			LL y1=GetY(j1),y2=GetY(j2);
			if((y1-y2)>1LL*i*(1LL*j1-1LL*j2))
				t--;
			else
				break;
		}
		int j=que[t-1];
		f[i]=f[j]+((1LL*i-1LL*j)*(1LL*i-1LL*j+1LL))/2LL-(1LL*sum[i]-1LL*sum[j]);
		f[i]=max(f[i],f[i-1]);
		while(s<t-1)
		{
			int j1=que[t-2],j2=que[t-1];
			LL y1=GetY(que[t-2]),y2=GetY(que[t-1]),y3=GetY(i);
			if((1LL*y1-1LL*y2)*(1LL*j2-1LL*i)<(1LL*y2-1LL*y3)*(1LL*j1-1LL*j2))
				que[--t]=0;
			else
				break;
		}
		que[t++]=i;
	}
}
void MergeSort(int l,int r)
{
	if(l==r)
	{
		if(l!=0)
			g[l]=max(g[l],L[l-1]+R[l+1]+1LL-(sum[l]-sum[l-1]));
		else
			g[l]=0;
		return;
	}
	int mid=(l+r)/2;
	MergeSort(l,mid);
	int s=0,t=0;
	for(int i=l;i<=mid;i++)
	{
		f[i]=L[i];
		while(s<t-1)
		{
			int j1=que[t-2],j2=que[t-1];
			LL y1=GetY(que[t-2]),y2=GetY(que[t-1]),y3=GetY(i);
			if((1LL*y1-1LL*y2)*(1LL*j2-1LL*i)<(1LL*y2-1LL*y3)*(1LL*j1-1LL*j2))
				que[--t]=0;
			else
				break;
		}
		que[t++]=i;
	}
	for(int i=mid+1;i<=r;i++)
	{
		while(s<t-1)
		{
			int j1=que[t-2],j2=que[t-1];
			LL y1=GetY(j1),y2=GetY(j2);
			if((y1-y2)>1LL*i*(1LL*j1-1LL*j2))
				t--;
			else
				break;
		}
		int j=que[t-1];
		h[i]=f[j]+((1LL*i-1LL*j)*(1LL*i-1LL*j+1LL))/2LL-(1LL*sum[i]-1LL*sum[j])+R[i+1];
	}
	for(int i=r-1;i>=mid+1;i--)
		h[i]=max(h[i],h[i+1]);
	for(int i=mid+1;i<=r;i++)
		g[i]=max(g[i],h[i]);
	MergeSort(mid+1,r);
}
int main()
{
	fill(ans+1,ans+1+MAXN,-INF);
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
		scanf("%lld",&T[i]);
	for(int i=1;i<=N;i++)
		sum[i]=sum[i-1]+T[i];
	//处理初始DP
	//处理前缀DP数组 
	DP();
	for(int i=1;i<=N;i++)
		L[i]=f[i];
	//处理后缀DP数组 
	Rev(T);
	for(int i=1;i<=N;i++)
		sum[i]=sum[i-1]+T[i];
	DP();
	for(int i=1;i<=N;i++)
		R[i]=f[N-i+1];
	Rev(T);
	for(int i=1;i<=N;i++)
		sum[i]=sum[i-1]+T[i];
	//处理完成 
	//开始CDQ分治(计算必须选择某个元素的最大值)
	//先从左往右算贡献
	fill(f+1,f+1+N,-INF);
	fill(h+1,h+1+N,-INF);
	fill(g+1,g+1+N,-INF);
	MergeSort(0,N);
	for(int i=1;i<=N;i++)
		ans[i]=max(ans[i],g[i]);
	//再从右往左算贡献 
	Rev(T);
	for(int i=1;i<=N;i++)
		sum[i]=sum[i-1]+T[i];
	for(int i=1;i<=N;i++)
		swap(L[i],R[N-i+1]);
	fill(f+1,f+1+N,-INF);
	fill(h+1,h+1+N,-INF);
	fill(g+1,g+1+N,-INF);
	MergeSort(0,N);
	for(int i=1;i<=N;i++)
		ans[i]=max(ans[i],g[N-i+1]);
	Rev(T);
	for(int i=1;i<=N;i++)
		sum[i]=sum[i-1]+T[i];
	for(int i=1;i<=N;i++)
		swap(L[i],R[N-i+1]);
	//预处理完成 
	//开始回答询问
	int M,P;
	LL X;
	scanf("%d",&M);
	for(int i=1;i<=M;i++)
	{
		scanf("%d %lld",&P,&X);
		LL ansn=max(L[P-1]+R[P+1],ans[P]-X+T[P]);
		printf("%lld\n",ansn);
	}
	return 0;
}
/*
4
3 5 1 6
5
2 1
4 2
3 1
1 1

*/

Measured memory_bytes: 22400
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
int main()
{

  ll n;
  cin >> n;
  string s = to_string(n);
  ll sum = 0;

  // cout << s[0] << s[1] << endl;

  for (ll i = 0; i < s.length(); i++)
  {
    sum += (int)s[i] - 48;
  }

  // cout << sum << endl;
  if (n % sum == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <stack>
#include <queue>
#include <cstring>
#include <list>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
static const double EPS = 1e-5;
static const int INFTY = (1<<21);
static const ll LLINFTY = (1LL<<53);
#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
int g[10][10];
string s[10];
string dpv[10][1<<10];
bool dp[10][1<<10];
int n;
string mini(const string& a,const string& b)
{
  if(a.size()==b.size())return min(a,b);
  return a.size()<b.size()?a:b;
}
string solve(int v,int u)
{
  if(u==(1<<n)-1)return "";
  if(v>=0 && dp[v][u]){
    return dpv[v][u];
  }
  string ret;
  bool f=false;
  if(v>=0)dp[v][u]=true;
  rep(i,n){
    if(u>>i&1)continue;
    string ad;
    if(v<0){
      ad=s[i];
    } else {
      ad=s[i].substr(g[i][v]);
    }
    if(f)ret=mini(ret,ad+solve(i,u|1<<i));
    else{
      ret=ad+solve(i,u|1<<i);
      f=true;
    }
  }
  return v>=0?dpv[v][u]=ret:ret;
}
int main(void)
{
  for(;;){
    scanf("%d",&n); if(!n)break;
    rep(i,n)cin>>s[i];
    int u=0;
    rep(i,n)rep(j,n){
      if(u&1<<j || u&1<<i || i==j)continue;
      if(s[i].find(s[j])!=-1){
        u|=1<<j;
      }
    }
    rep(i,n)rep(j,n){
      if(i==j)continue;
      if(u&1<<i || u&1<<j)continue;
      int c=1,cc=-1;
      for(int ii=s[i].size()-1;ii>=0;ii--){
        if(s[j].size()<c)break;
        int jj;
        for(jj=0;jj<c;jj++){
          if(s[i][ii+jj]!=s[j][jj])break;
        }
        if(jj==c){
          cc=c;
        }
        c++;
      }
      g[j][i]=cc<0?0:cc;
    }
    memset(dp,0,sizeof(dp));
    puts(solve(-1,u).data());
  }
}

Measured memory_bytes: 0
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(s: String);

    let ss = vec!["Sunny", "Cloudy", "Rainy"];
    for i in 0..3 {
        if ss[i] == s {
            println!("{}", ss[(i + 1) % 3]);
        }
    }
}


Measured memory_bytes: 2008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 
ll N, W;
vector<vector<P>> obj(4);
vector<vector<P>> v(4);
 
int main(void){
	
	scanf("%lld %lld", &N, &W);
	ll base = 0;
	for(int i = 0; i < N; ++i){
	    ll w, v; scanf("%lld %lld", &w, &v);
	    if(i == 0) base = w;
	    obj[w - base].push_back(make_pair(v, w));
	}
	for(int i = 0; i < 4; ++i) sort(obj[i].begin(), obj[i].end(), greater<P>());
	
	for(int i = 0; i < 4; ++i){
	    ll wsum = 0, vsum = 0;
	    for(int j = 0; j < obj[i].size(); ++j){
	        wsum += obj[i][j].second, vsum += obj[i][j].first;
	        v[i].push_back(make_pair(vsum, wsum));
	    }
	}
	
	ll ans = 0;
    for(int i = 0; i <= v[0].size(); ++i){
        for(int j = 0; j <= v[1].size(); ++j){
            for(int k = 0; k <= v[2].size(); ++k){
                for(int l = 0; l <= v[3].size(); ++l){
                    ll weight = 0, value = 0;
                    if(i > 0) weight += v[0][i - 1].second, value += v[0][i - 1].first;
                    if(j > 0) weight += v[1][j - 1].second, value += v[1][j - 1].first;
                    if(k > 0) weight += v[2][k - 1].second, value += v[2][k - 1].first;
                    if(l > 0) weight += v[3][l - 1].second, value += v[3][l - 1].first;
                    if(weight <= W) ans = max(ans, value);
                }
            }
        }
    }
	printf("%lld\n", ans);
	
    return 0;
}

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

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

const int N = 100005;
const ll INF = INT_MAX - 1;

ll n, h[N], dp[N], k;

ll get(int in){
  if(in == n) return 0;
  if(dp[in] != -1) return dp[in];
  ll ans = INF;
  for(int i = 1; i <= k and in + i <= n; i++){
    ans = min(abs(h[in] - h[in + i]) + get(in + i), ans);
  }
  return dp[in] = ans;
}

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

  cin >> n >> k;
  for(int i = 1; i <= n; i++) cin >> h[i];
  memset(dp, -1, sizeof dp);
  cout << get(1) << endl;
}


Measured memory_bytes: 6528
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
typedef long long LL;
typedef long double LD;

using namespace std;

int main()
{
	double a,b,h,m,w1,w2,t1,t2,t3,l3;
	cin >> a >> b >> h >> m;
	w1 = 2*M_PI/720.0;
	w2 = 2*M_PI/60.0;
	t1 = w1*(h*60+m);
	t2 = w2*m;
	t3 = abs(t1-t2);
	l3 = sqrt(a*a+b*b-(2*a*b*cos(t3)));
	cout.precision(20);
	cout << l3 << endl;
	
	return 0;
} 

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

using namespace std;

using int64 = long long;

int main() {
  int N, H, W;
  cin >> N >> H >> W;
  int ret = 0;
  while(N--) {
    int a, b;
    cin >> a >> b;
    ret += a >= H && b >= W;
  }
  cout << ret << endl;
}





Measured memory_bytes: 256
s = input()
ans = 0
if int(s[0:2]) <= 99 and int(s[0:2]) >= 00 and int(s[2:4]) > 00 and int(s[2:4]) <= 12:
  ans += 1
if int(s[0:2]) <= 12 and int(s[0:2]) > 00 and int(s[2:4]) >= 00 and int(s[2:4]) <= 99:
  ans += 2
if ans == 1:
  print("YYMM")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("AMBIGUOUS")
else:
  print("NA")

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>
int INF = (1 << 29);

int main() {
    int N, M;
    cin>> N >> M;
    vvi G(N);
    REP(i, 0, M){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].emplace_back(b);
    }
    int shortest = N + 1;
    vi ans;
    REP(i, 0, N){
        vi dist(N, -1), prev(N, -1);
        queue<int> que;
        que.push(i);
        dist[i] = 0;
        while(!que.empty()){
           auto cur = que.front(); que.pop();
           for(int x: G[cur]){
               if(dist[x] == -1){
                   dist[x] = dist[cur] + 1;
                   prev[x] = cur;
                   que.push(x);

               }
            }
        }
        REP(j, 0, N){
            if(j == i || dist[j] == -1) continue;
            for(auto nj: G[j]){
                if(nj == i){
                    vi tmp({i+1});
                    int cur = j;
                    while(cur != i) tmp.push_back(cur+1), cur = prev[cur];
                    if(shortest > tmp.size()){
                        shortest = tmp.size();
                        ans = tmp;
                    }
                }
            }
        }
    }
    if(shortest == N+1) cout << -1 << endl;
    else{
        cout << ans.size() << endl;
        for(auto v: ans) cout << v << endl;
    }    
}   

Measured memory_bytes: 384
from collections import deque

A = deque(list(input())+["e"])
B = deque(list(input())+["e"])
C = deque(list(input())+["e"])

turn = "a"

while turn != "e":

    if turn == "a":
        turn = A.popleft()
        if turn == "e":
            print("A")
            break
    elif turn == "b":
        turn = B.popleft()
        if turn == "e":
            print("B")
            break
    else:
        turn = C.popleft()
        if turn == "e":
            print("C")
            break

Measured memory_bytes: 3316
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String w = sc.next();
		String t;
		int cnt = 0;
		while(true){
			t = sc.next();
			if(t.equals("END_OF_TEXT")) break;
			if(t.equalsIgnoreCase(w)) cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 18036
#include <bits/stdc++.h>
using namespace std;
typedef long long               ll;
const int mod = 1e9+7;
#ifndef M_PI
const double M_PI = acos(-1.0);
#endif

int main(){
  int n, q;
  cin>>n>>q;
  vector<int> a(n);
  for(int i=0; i<n; ++i){
    scanf("%d", &a[i]);
  }
  vector<ll> par_sum(n+1), jump_sum(n+1);
  for(int i=0; i<n; ++i){
    par_sum[i+1] = par_sum[i]+a[i];
  }
  for(int i=1; i<=n; ++i){
    jump_sum[i] = a[i-1];
    if(i>1)
      jump_sum[i] += jump_sum[i-2];
  }
  for(int i=0; i<q; ++i){
    int x;
    scanf("%d", &x);
    int l=1, r=(n+1)/2+1;
    while(l+1 < r){
      int m = (l+r)/2;
      if(a[n-m] <= x){
        r = m;
      }else {
        if(a[n-m] - x >= x-a[n-2*m+1]){
          l = m;
        } else {
          r = m;
        }
      }
    }
    ll res = par_sum[n]-par_sum[n-l];
    if(n-2*l > 0)
      res += jump_sum[n-2*l];
    printf("%lld ", res);
  }
	return 0;
}

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

int main() {
    char C;
    cin >> C;
    
    if (C == 'a' || C == 'i' || C == 'u' || C == 'e' || C == 'o'){
        cout << "vowel" << endl;
    }
    else {
        cout << "consonant" << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
typedef long long ll;
typedef long double ld;


#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
ll S[1000] = { 0 };
ll N,M,Q;


int main() {
	map<string, ll>A;
	cin >> Q;
	rep(i, Q) {
		ll a;
		cin >> a ;
		if (a==0) {
			string key;
			ll x;
			cin >> key >> x;
			A[key] = x;
		}
		else if(a==1){
			string key;
			cin >> key;
			ll ans = A[key];
			cout << ans << endl;
			if (!ans) A.erase(key);
		}
		else if(a==2){
			string key;
			cin >> key;
			A.erase(key);
		}
		else {
			string key1,key2;
			cin >> key1>>key2;
			for (map<string, ll>::iterator j = A.lower_bound(key1); j != A.upper_bound(key2);++j) {
				cout <<j->first<<" "<< j->second << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 27824
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>

#define ll long long

using namespace std;

void solve() {
    int n, res = 0, t;
    cin >> n;
    // vector<int> v(n);
    map<int, int> m;
    for(int i = 0; i < n; i++) {
        cin >> t;
        m[t]++;
    }
    // sort(v.begin(), v.end());
    for(auto i = m.begin(); i != m.end(); i++) {
        auto j = i;
        j++;
        for(; j != m.end(); j++) {
            auto k = j;
            k++;
            for(; k != m.end(); k++) {
                if(i->first + j->first > k->first) {
                    res += i->second * j->second * k->second;
                }
            }
        }
    }
    cout << res << endl;
}

int main() {
    
    // int T;
    // cin >> T;
    // while(T--) {
        // solve();
    // }
    solve();
    
    return 0;
};


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;

int main() {
	int n, k; cin >> n >> k;
	puts((n + 1) / 2 >= k ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:256000000")
#include<utility>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head
#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

// belik's shit
ll const mod = 1e9 + 7;
namespace {
	ll mult(ll& a, ll& b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) {
			val += mod;
		}
		if (val >= mod) {
			val -= mod;
		}
		return val;
	}
	ll poww(ll a, ll b)
	{
		ll val = 1;
		a %= mod;
		while (b > 0){
			if (b % 2) val = mult(a, val);
			a = mult(a, a);
			b >>= 1;
		}
		return val % mod;
	}
	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;
ll dp[55][55][55 * 55 * 2];
signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, kk; cin >> n >> kk;
	dp[0][0][0] = 1;
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j <= min(i, n - i); j++) {
			for (ll k = 0; k <= kk; k++) {
				// столько же торчалок
				(dp[i + 1][j][k + 2 * j] += dp[i][j][k]) %= mod;
				(dp[i + 1][j][k + 2 * j] += 2 * dp[i][j][k] * j) % mod;
				// больше
				if (j + 1 <= min(i + 1, n - (i + 1))) {
					(dp[i + 1][j + 1][k + 2 * (j + 1)] += dp[i][j][k]) %= mod;
				}
				//меньше
				if (j > 0) {
					(dp[i + 1][j - 1][k + 2 * (j - 1)] += dp[i][j][k] * j * j) %= mod;
				}
				ll tt = 0;
			}
		}
	}
	cout << dp[n][0][kk]%mod << endl;
	return 0;
}
/*

*/

Measured memory_bytes: 127232
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
const int inf = 1000000000; // 10^9 Ten to the power of nine.
/**** Type Define ****/
 
   int main(){
       int N;
       cin>>N;
       cout<<N+(N*N)+(N*N*N);
   }

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ret = 1;
  for (int i = 1; i < N; i++) {
    if (S[i] != S[i - 1]) {
      ret++;
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL read() {
	LL x = 0, fh = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') fh = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		x = (x << 1) + (x << 3) + c - '0';
		c = getchar();
	}
	return x * fh;
}
const int N = 2e5 + 10;
int n, sum, maxx, i;
string s[N];
int main() {
	n = read();
	for (i = 1; i <= n; i++) cin >> s[i];
	sort(s + 1, s + 1 + n);
	for (i = 1, sum = 1; i <= n; i++)
		if (s[i] != s[i + 1]) {
			maxx = max(maxx, sum);
			sum = 1;
		}
		else sum++;
	for (i = 1, sum = 1; i <= n; i++)
		if (s[i] != s[i + 1]) {
			if (sum == maxx) cout << s[i] << '\n';
			sum = 1;
		}
		else sum++;
	return 0;
}

Measured memory_bytes: 9864
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin >> x;
    int ans = x / 500;
    x %= 500;
    ans *= 1000;
    x /= 5;
    ans += x * 5;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int n, p[12], max, sum = 0;
	cin >> n;
	rep(i, n){
		cin >> p[i];
		sum += p[i];
		if(i == 0){
			max = p[i];
		}else{
			if(max < p[i]){
				max = p[i];
			}
		}
	}
	sum -= max;
	cout << sum + max/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
int main(){
	long long n;
	cin >> n;
	long long  a[100000];
	int mainasu = 0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(a[i]<0){
			mainasu++;
		}
	}
	long long  ans=0;
	long long mins = abs(a[0]);
	for(int i=0;i<n;i++){
		ans = ans + abs(a[i]);
		mins = min(mins,abs(a[i]));
	}
	if(mainasu%2==1){
		ans = ans-mins*2;
	}
	cout << ans << endl;
}


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

int main() {
  char alpha;
  cin >> alpha;
  
  if ('A' <= alpha && alpha <= 'Z') {
    cout << 'A' << endl;
  }
  if ('a' <= alpha && alpha <= 'z') {
    cout << 'a' << endl;
  }
}

Measured memory_bytes: 3592
#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; cin>>n;
    vector<int> h(n);
    rep(i,n) cin>>h[i];
    int ans=0;
    int cnt=0;
    rep(i,n-1){
        if(h[i]>=h[i+1]) cnt++;
        else cnt=0;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
bool ispal(int n)
{
	int j=1;

	while(n/j!=0)
		j*=10;
	j/=10;

	while(n!=0)
	{
		if(n/j != n%10)
			return false;
		n=n%j;
		n=n/10;
		j/=100;
	}
	return true;
}

int main()
{
	int a,b,cnt=0;
	cin >> a >> b;

	for( int i=a ; i<=b ; i++ )
		if(ispal(i))
			cnt++;

	cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        
        int n = in.nextInt();
        int l = in.nextInt();
        int mn = Integer.MAX_VALUE;
        int ind = 0;
        for(int i=0;i<n;i++){
            if(mn > (int)Math.abs(l+i)){
                mn = (int)Math.abs(l+i);
                ind = i;
            }
        }
        int sum=0;
        for(int i=0;i<n;i++){
            if(i!=ind) sum += (l+i);
        }
        out.println(sum);
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

int a,b,c,d;

int main(){
  cin >> a >> b >> c >> d;

  if(a <= c){
    if(b <= c) cout << 0 << endl;
    else if(b <= d) cout << b-c << endl;
    else if(b > d) cout << d-c << endl;
  }

  else if(a > c){
    if(d <= a) cout << 0 << endl;
    else if(b <= d) cout << b-a << endl;
    else if(b > d) cout << d-a << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
lis = Is()
ans = 0
for i in range(1,n-1):
    if (lis[i-1] < lis[i] < lis[i+1]) or (lis[i-1] > lis[i] > lis[i+1]):
        ans += 1
print(ans)

Measured memory_bytes: 4712
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	int num[] = { 0,1,2,1,3,1,2,1,1,2,1,2,1 };
	cin >> N >> M;
	if (num[N] == num[M])cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdlib>
#include <math.h>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long (i) = 0; (i) < (long) (n); (i)++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,a,b) for(long i=(a);i<(b);i++)
#define rrep1(i,a,b) for(long i=(a);i<=(b);i++)
#define rrrep(i,a,b) for(long i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define X first
#define Y second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int> >
#define vpl vector<pair<long, long> >

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;

int printYes() {
    cout << "Yes" << endl;
    return 0;
}

int printNo() {
    cout << "No" << endl;
    return 0;
}

int ans;

int printAns() {
    cout << ans << endl;
    return 0;
}


int pow(int x) {
	if (x == 0) {
		return 1;
	}
	else {
		return pow(x - 1) * 2;
	}
}

int main(int argc, char const *argv[])
{
    int a[4];
    rep(i,4) {
        a[i] = 0;
    }
    rep(i, 6) {
        int b;
        cin >> b;
        a[b - 1]++;
    }
    if (a[0]!=0 && a[0]!=3 && a[1]!=0 && a[1]!=3 && a[2]!=0 && a[2]!=3 && a[3]!=0 && a[3]!=3) {
        cout << "YES";
    } else 
    {
        cout << "NO";
    }
    
    
    return 0;
}


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

// struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visited[MAX]; // 訪問状況

int gcd(int a, int b) { // aとbの最大公約数（ユークリッドの互除法）
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    // input
    int n, x;
    cin >> n >> x;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }
    // solve
    int prev = abs(x-a[0]);
    rep(i, n) { // |x-a[i]|のgcdを求める
        if (i == 0) continue;
        prev = gcd(prev, abs(x-a[i]));
    }
    int ans = prev;
    // output
    cout << ans << "\n";
}

Measured memory_bytes: 3740
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set> 
#include <bitset>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main () {
    
    int n, a, b;
    cin >> n;

    if(n==1) {
        cout << "Hello World" << endl;
    } else {
        cin >> a >> b;
        cout << a+b << endl;
    } 

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N,M;

	scanf("%d %d",&N,&M);

	int mult = 1;

	for(int i = 0; i < M; i++){

		mult *= 2;
	}

	int BASE = 1900*M + 100*(N-M);

	printf("%d\n",mult*BASE);

	return 0;
}


Measured memory_bytes: 256