akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    map<int, int> v;
    rep(i, N) cin >> a.at(i);

    rep(i, N)
    {
        if (v.count(a.at(i)))
        {
            v.erase(a.at(i));
        }
        else
        {
            v[a.at(i)] = 1;
        }
    }
    cout << v.size() << endl;
}

Measured memory_bytes: 5248
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int R;

int main()
{
  scanf( "%d", &R );

  if( R < 1200 )
    puts("ABC");
  else if ( R < 2800 )
    puts("ARC");
  else
    puts("AGC");
  
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

class p
{
    
    static void Main(string[] args)
    {
        string O = Console.ReadLine();
        string E = Console.ReadLine();
        StringBuilder ans = new StringBuilder();

        for(int i=0; ;i++)
        {
            if (O.Length == i) break;
            ans.Append(O[i]);
            if (E.Length == i) break;
            ans.Append(E[i]);
        }

        Console.WriteLine(ans);
    }   
}

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

#define w(t) int t; cin>>t; while(t--)
#define ll long long int
#define rep(n) for (long long int i=0; i<n; i++)

int main ()
{
    ll n,cnt=0;
    cin >>n;
    ll ara[n];
    for (ll i=0; i<n; i++){
        cin >> ara[i];
    } 
    ll mx=ara[0];
    for (ll i=1; i< n; i++){
        if (mx<ara[i])mx=ara[i];
        if (ara[i]<mx)cnt+=(mx-ara[i]);
    }
    cout <<cnt <<"\n";
    return 0;
}


Measured memory_bytes: 5120
#include<iostream>
#include<list>
#include<stdio.h>
using namespace std;
int n;
struct Node {
	//int id;
	list<pair<int,int> > next;
};
Node tree[100005];
int visit[100005];
int maxRoad;
int maxId;
void dfs(int curNodeId,int road) {

	list<pair<int, int> >::iterator it = tree[curNodeId].next.begin();
	list<pair<int, int> >::iterator end = tree[curNodeId].next.end();
	int id;
	for (it; it != end; it++) {
		id = (*it).first;
		if (visit[id] == 0) {
			visit[id] = 1;
			dfs(id,road + (*it).second);
			visit[id] = 0;
		}
	}

	if (tree[curNodeId].next.size() <= 1) {//叶子节点
		if (road > maxRoad) {
			maxRoad = road;
			maxId = curNodeId;
		}
	}
}
int main() {
	scanf("%d", &n);
	int u, v, w;
	for (int i = 0; i < n - 1; i++) {
		scanf("%d %d %d", &u, &v, &w);
		tree[u].next.push_back(make_pair(v, w));
		tree[v].next.push_back(make_pair(u, w));
	}

	visit[0] = 1;
	dfs(0,0);
	maxRoad = 0;
	for (int i = 0; i < n; i++) {
		visit[i] = 0;
	}
	visit[maxId] = 1;
	dfs(maxId, 0);

	cout << maxRoad << endl;
}


Measured memory_bytes: 17572
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;

using Graph = vector<vector<int>>;

int main()
{
    string s;
    cin >> s;
    int MOD = 1000000007;

    vector<vector<int>> dp(100005, vector<int>(2, 0));
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++)
    {
        // a+b==0
        if (s[i] == '0')
        {
            (dp[i + 1][0] += dp[i][0]) %= MOD;
            (dp[i + 1][1] += dp[i][1]) %= MOD;
        }
        else
        {
            (dp[i + 1][1] += (dp[i][0] + dp[i][1])) %= MOD;
        }

        // a+b==1
        if (s[i] == '0')
        {
            (dp[i + 1][1] += dp[i][1] * 2 % MOD) %= MOD;
        }
        else
        {
            (dp[i + 1][0] += dp[i][0] * 2 % MOD) %= MOD;
            (dp[i + 1][1] += dp[i][1] * 2 % MOD) %= MOD;
        }
    }
    cout << (dp[s.size()][0] + dp[s.size()][1]) % MOD << endl;
}


Measured memory_bytes: 5760
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
	public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int H=0;
		int W=0;
		String[] arr;
		while((str=br.readLine())!=null){
			arr=str.split(" ");
			H=Integer.parseInt(arr[0]);
			W=Integer.parseInt(arr[1]);
			if((H==0)&&(W==0)){
				break;
			}
			for(int i=0;i<H;i++){
				for(int j=0;j<W;j++){
					System.out.print("#");
				}
				System.out.print("\n");
			}
			System.out.print("\n");
		}
		br.close();
	}
}

Measured memory_bytes: 29860
#include <bits/stdc++.h>
using namespace std;
// nichijou
#define REP(i,a,b) for (int i(a); i < (b); ++i)
#define RP(i,n) REP(i,0,n)
#define PER(i,a,b) for(int i((a)-1); i >= (b); --i)
#define PR(i,n) PER(i,n,0)
#define REP1(i,a,b) REP(i,a,(b)+1)
#define RP1(i,n) REP1(i,1,n)
#define PER1(i,a,b) PER(i,(a)+1,b)
#define PR1(i,n) PER1(i,n,1)
#define DO(n) RP(__i,n)
template<class T,class U>
bool cmax(T & a, const U & b) {return a < b ? a = b, 1 : 0;}
template<class T,class U>
bool cmin(T & a, const U & b) {return b < a ? a = b, 1 : 0;}

// data type
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define F first
#define S second

// STL container
typedef vector<int> vi;
typedef vector<ll> vll;
#define SZ(a) ((int)(a).size())
#define ALL(a) begin(a), end(a)
#define CLR(a) (a).clear()
#define BK(a) ((a).back())
#define FT(a) ((a).front())
#define DB(a) (a).pop_back()
#define DF(a) (a).pop_front()
#define PB push_back
#define EB emplace_back

/* I gave you my heart and then you turned around. */
void _BG(const char * s) {cerr<<s<<endl;};
template<class T, class ... TT>
void _BG(const char * s,T a, TT...b)
{
	for (int c = 0; *s && (c || *s != ','); ++s) {
		cerr<<*s;
		for (char x : "([{") c += *s == x;
		for (char x : ")]}") c -= *s == x;
	}
	cerr<<" = "<<a;
	if (sizeof...(b)) {
		cerr<<", ";
        ++s;
    }
    _BG(s,b...);
}
#define BG(...) do { \
	cerr << __PRETTY_FUNCTION__ << ':' << __LINE__ << ": "; \
	_BG(#__VA_ARGS__,__VA_ARGS__); \
} while(0)

/* Reading input is now 20% cooler! */
bool RD() {return 1;}
bool RD(char & a) {return scanf(" %c", &a) == 1;}
bool RD(char * a) {return scanf("%s", a) == 1;}
bool RD(double & a) {return scanf("%lf", &a) == 1;}
bool RD(int & a) {return scanf("%d", &a) == 1;}
bool RD(ll & a) {return scanf("%lld", &a) == 1;}

template<class T, class ... TT>
bool RD(T & a, TT & ... b) {return RD(a) && RD(b...);}

/* Do princesses dream of magic sheep? */
#define DR(T,...) T __VA_ARGS__; RD(__VA_ARGS__)
#define RI(...) DR(int,__VA_ARGS__)

/* For it's time for you to fulfill your output. */
void PT(const char & a) {putchar(a);}
void PT(char const * const & a) {fputs(a, stdout);}
void PT(const double & a) {printf("%.16f", a);}
void PT(const int & a) {printf("%d", a);}
void PT(const ll & a) {printf("%lld", a);}

/* The line will last forever! */
template<char s = ' ', char e = '\n'>
void PL() {if (e) PT(e);}
template<char s = ' ', char e = '\n', class T, class ... TT>
void PL(const T & a, const TT & ... b)
{PT(a); if (sizeof...(b) && s) PT(s); PL<s,e>(b...);}

/* Good Luck && Have Fun ! */
const int N = 106;
int a[2][N];
int main()
{
	RI(n);
	RP(i,2)
		RP1(j,n)
			RD(a[i][j]);
	REP1(i,2,n) a[0][i] += a[0][i-1];
	PER1(i,n-1,1) a[1][i] += a[1][i+1];
	int ans = 0;
	RP1(i,n) cmax(ans, a[0][i] + a[1][i]);
	PL(ans);
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
#define pi 3.1415926535897
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
ll a,b;
int main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	cin>>a>>b;
	if(a<b/2)cout<<a<<endl;
	else{
		a=a%b;
		if(a==0||a<b/2)cout<<a<<endl;
		else cout<<b-a<<endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n, a[200000];
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  
  if(n % 2 == 0){
    int k = n / 2;
    while(k > 0) printf("%d ", a[2*(k--) - 1]);
    for(int i = 0; i < n/2; i++) printf("%d ", a[2 * i]);
  }
  else{
    int l = (n - 1)/2;
    while(l >= 0) printf("%d ", a[2 * (l--)]);
    for(int i = 0; i < (n - 1)/2; i++) printf("%d ", a[2 * i + 1]);
  }
  return 0;
}

Measured memory_bytes: 2816
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <cassert>
#include <functional>

using namespace std;
typedef long long ll;


#define SIZE 50001
#define INF 1000000000
#define LLINF 1000000000000000000LL

void calc(int m,int n,ll *ans){
  ans[0] = m;
  const int e4 = (int)1e4;

  for(int i=0;i<n-1;i++){

    for(int j=0;j<20;j++){
      ans[j] *= m;
    }

    for(int j=0;j<19;j++){
      ans[j+1] += ans[j]/e4;
      ans[j] = ans[j]%e4;
    }
  }

  return;
}

string unit[] = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};


int main(){
  int m,n;
  ll ans[20];

  while(1){
    scanf("%d%d",&m,&n);
    if(m==0) break;

    for(int i=0;i<20;i++) ans[i] = 0;

    calc(m,n,ans);
    
    for(int i=17;i>=0;i--){
      if(ans[i]>0){
	cout << ans[i] << unit[i];
      }
    }

    cout << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 1220
/*
ID: amagica1
TASK: ariprog
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define NINF -INF
#define mp make_pair
#define boost() cin.tie(0); cin.sync_with_stdio(0)
#define For(i, a, b) for(int i=a; i<b; i++)
#define FOR(i, a, b) for(int i=a; i<=b; i++)
#define Rev(i, a, b) for(int i=a; i>b; i--)
#define REV(i, a, b) for(int i=a; i>=b; i--)
typedef long long ll;
typedef long double ld;
typedef int64_t l;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int MAXN = 1000005;
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);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
bool a[3];
int main() {
    //-----------FILE------------//
    // freopen("ariprog.in", "r", stdin);
    // freopen("ariprog.out", "w", stdout);
    //----------------------------//
    int x, y; cin >> x >> y; a[x-1] = a[y-1] = 1;
    for(int i=0; i<3; i++) if(!a[i]) printf("%d\n", i+1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b)
{
    if (a < b)
        return gcd(b, a);
    unsigned r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int k;
cin >> k;
ll total = 0;
reps(a,k+1,1){
    reps(b,k+1,1){
        reps(c,k+1,1){
            total += gcd(a, gcd(b, c));
        }
}
}
cout << total << endl;
//system("pause");
return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
template<class T> void writerLn(T x) { writer(x, '\n'); }

vector<P>E[100000];
int d[100000],b[100000],cnt[200001],u[200000],v[200000],r[200000];
int main(){
	int n,m,q;reader(n);reader(m);reader(q);
	rep(i,m){
		reader(u[i]);reader(v[i]);u[i]--;v[i]--;r[i]=q;
	}
	rep(i,q){
		int a;reader(a);r[a-1]=i;
	}
	rep(i,m){
		E[u[i]].push_back(P(v[i],r[i]));E[v[i]].push_back(P(u[i],r[i]));
	}
	d[0]=1;b[0]=q;
	queue<int>que;que.push(0);
	while(!que.empty()){
		int p=que.front();que.pop();
		for(P v:E[p]){
			if(d[v.first]==0){
				d[v.first]=d[p]+1;que.push(v.first);
			}
			if(d[v.first]==d[p]+1)
				b[v.first]=max(b[v.first],min(b[p],v.second));
		}
	}
	rep(i,n)cnt[b[i]]++;
	int ans=0;
	rep(i,q){
		ans+=cnt[i];
		writer(ans,'\n');
	}
}

Measured memory_bytes: 15436
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <tuple>
#include <string>

using namespace std;

class Solver {
};

signed main() {
	string n;
	cin >> n;

	int min_dig = 9;
	int max_dig = 1;
	for (int i = 0; i < n.size(); i++) {
		min_dig = min(min_dig, (n[i] - '0'));
		max_dig = max(max_dig, (n[i] - '0'));
	}
	int res = max_dig - min_dig;
	if (n.size() == 2) {
		cout << res << endl;
		return 0;
	}

	int min_val = stoi(n.substr(0, 2));
	int max_val = min_val;
	int now = 2;
	for (; now < n.size(); now++) {
		int val = n[now] - '0';
		if (max_val - val < res || now + 1 == n.size()) {
			min_val = min(min_val, val);
		}
		else{
			val = stoi(n.substr(now, 2));
			min_val = min(min_val, val);
			max_val = max(max_val, val);
			now++;
		}
	}
	res = min(res, max_val - min_val);

	for (int i = 3; i < n.size(); i++) {
		if (n.size() % i > 0)continue;

		string common = n.substr(0, i - 2);
		now = i;
		min_val = stoi(n.substr(i - 2, 2));
		max_val = min_val;
		bool valid = true;
		for (; now < n.size(); now += i) {
			if (common != n.substr(now, i - 2)) {
				valid = false;
				break;
			}
			int val = stoi(n.substr(now + i - 2, 2));
			min_val = min(min_val, val);
			max_val = max(max_val, val);
		}
		if (valid) {
			res = min(res, max_val - min_val);
		}
	}

	cout << res << endl;
}


Measured memory_bytes: 3348
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    ll n;
    cin >> n;
    ll d;
    cin >> d;
    d = d*d;
    ll ans = 0;
    rep(i,n) {
        ll x,y;
        cin >> x >> y;
        ll kyori = pow(x,2)+pow(y,2);
        if(d>=kyori)    ans ++;
    }

    cout<<ans<<endl;

 return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
#include<unordered_map>
using namespace std ;

#define MAXN 300007

int n ;
long long a[ MAXN ] ;
pair < long long , int > b[ MAXN ] ;

long long ans[ MAXN ] ;

void move ( int &st , long long &cnt ) {
    while ( st > 1 && b[ st - 1 ].first == b[ st ].first ) { -- st ; ++ cnt ; }
    
}

void input ( ) {
    scanf ( "%d" , &n ) ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        scanf ( "%lld" , &a[ i ] ) ;
        b[ i ] = { a[ i ] , i } ;
    }
    sort ( b + 1 , b + n + 1 ) ;
}

void solve ( ) {
    long long cnt = 1 ;
    int id = n ;
    int mnpos = b[ id ].second ;
    while ( id > 0 ) {
        move ( id , cnt ) ;
        long long diff = b[ id ].first - b[ id - 1 ].first ;
        mnpos = min ( mnpos , b[ id ].second ) ;
        ans[ mnpos ] += diff * cnt ;
        -- id ;
        ++ cnt ;
    }
    for ( int i = 1 ; i <= n ; ++ i ) {
        printf ( "%lld\n" , ans[ i ] ) ;
    }
}


int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
const int N=310;
const long long INF=1e15;
long long mp[N][N],ans;
int n,x;
struct edge{
	int x,y,z;	
	edge(int x,int y,int z):x(x),y(y),z(z){}
	bool operator < (const edge &a) const {
		return z<a.z;
	}
};
vector<edge> g;
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; i++)
	for (int j=i+1; j<=n; j++)
	mp[i][j]=mp[j][i]=INF;
	for (int i=1; i<=n; i++)
	for (int j=1; j<=n; j++){
		scanf("%d",&x);
		if (i<j) g.push_back(edge(i,j,x)); 
	}
	sort(g.begin(),g.end());
	for (unsigned int l=0; l<g.size(); l++){
		edge t=g[l];
		if (mp[t.x][t.y]<t.z){
			puts("-1");
			return 0;
		}
		else if (mp[t.x][t.y]>t.z){
			for (int i=1; i<=n; i++)
			for (int j=1; j<=n; j++){
				mp[i][j]=min(mp[i][j],mp[i][t.x]+t.z+mp[t.y][j]);
				mp[i][j]=min(mp[i][j],mp[i][t.y]+t.z+mp[t.x][j]);
			}
			ans+=mp[t.x][t.y];
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1916
import numpy as np

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

A = list(map(int, input().split()))

A_1 = np.array(A[1:])
A_11 = np.append(A_1, A[0] + K)

A_2 = np.array(A)
print(K - max(A_11 - A_2))

Measured memory_bytes: 43296
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int w, h, x, y;

signed main() {
	cin >> w >> h >> x >> y;
	printf("%.1f", h*w / 2.0);
	cout << " ";
	if (y * 2 == h && x * 2 == w)cout << 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
import itertools
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

ans = []
X = 0
for v in itertools.permutations(list(range(n))):
  cnt = 0
  X += 1
  for i in range(n-1):
    x1,y1 = xy[v[0]][0], xy[v[0]][1]
    x2,y2 = xy[v[1]][0], xy[v[1]][1]
    cnt += ((x1-x2)**2 + (y1-y2)**2)**0.5
  ans.append(cnt)
print(sum(ans)/X)

Measured memory_bytes: 4504
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int n;
    char buf[30];

    
    fgets(buf , sizeof(buf), stdin);

    
    n=atoi(buf);

    printf("%d\n",n+(n*n)+(n*n*n));
    return 0;
}

Measured memory_bytes: 1708
#include <iostream>
#include <math.h>

using namespace std;


int main() {
    double d, n, ans;
    cin >> d >> n;
    ans = pow(100, d) * n;
    if(n == 100) ans = pow(100, d) * (n + 1);
    cout << int(ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

const ll MOD = 1e9+7;

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

  int N;
  cin >> N;

  ll ans = 1;
  for(int i = 1; i <= N; i++){
    ans = (ans * i) % MOD;
  }

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


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

using namespace std;
using ll = long long;
const int mod = 2019;
const int inv = 202;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<int> fa(2019);
  string s; cin >> s;
  int n = (int) s.length();
  int num = 0, tens = 1;
  fa[0] = 1;
  int res = 0;
  for(int i = n - 1; i >= 0; --i) {
    num = (num + tens * (s[i] - '0')) % mod;
    tens = (tens * 10) % mod;
    res += fa[num]++;
    //cout << fa[num] << ' ';
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 3756
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 1100000000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,ll> P;

vector<P> V[110];
ll d[110];
int pre[110],C[110][110];

//s…始点
void dijkstra(int s,vector<P> G[]){
  // greater<P>を指定することでfirstが小さい順に取り出せる
  priority_queue<P,vector<P>,greater<P> > que;
  for(int i=0;i<110;i++) d[i]=INF;
  d[s]=0;
  que.push(P(0,s));

  while(!que.empty()){
    P p=que.top(); que.pop();
    ll v=p.second;
    if(d[v]<p.first) continue;
    for(int i=0;i<(int)G[v].size();i++){
      P e=G[v][i];
      if(d[e.first]>d[v]+e.second){
        pre[e.first]=v;
        d[e.first]=d[v]+e.second;
        que.push(P(d[e.first],e.first));
      }
    }
  }
}

int main(){
    int N,M,a,b,c;
    cin>>N>>M;
    for(int i=0;i<M;i++){
        cin>>a>>b>>c;
        a--; b--;
        V[a].push_back(P(b,c));
        V[b].push_back(P(a,c));
    }

    for(int i=0;i<N;i++){
        dijkstra(i,V);
        for(int j=0;j<N;j++){
            if(i==j) continue;
            C[pre[j]][j]++;
            C[j][pre[j]]++;
        }
    }
    int ans=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<(int)V[i].size();j++){
            if(C[i][V[i][j].first]==0) ans++;
        }
    }
    cout<<ans/2<<endl;
}


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

using namespace std;


#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";

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




template <class T> inline T biton(T n, T pos)
{
    return n | ((T)1 << pos);
}
template <class T> inline T bitoff(T n, T pos)
{
    return n & ~((T)1 << pos);
}
template <class T> inline T ison(T n, T pos)
{
    return (bool)(n & ((T)1 << pos));
}
template <class T> inline T gcd(T a, T b)
{
    while (b)
    {
        a = a % b;
        swap(a, b);
    }
    return a;
}
template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
};


#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif

int inf=1e9+5;

void solve()
{
    int n,k;
    cin>>n>>k;

    vector<int> items(n);
    for(int i=0; i<n; i++)
    {
        cin>>items[i];
    }
    vector<int> dp(n,inf);
    dp[0]=0;

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

        for(int j=1; j<=k; j++)
        {
            if(i-j>=0)
            {
                dp[i]=min(dp[i],dp[i-j]+abs(items[i]-items[i-j]));
            }
        }
    }

    cout<<dp[n-1]<<nl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    cout.tie(nullptr);
    cin.tie(nullptr);

    int t = 1;

    while (t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 1024
iAC = 0
iWA = 0
iTLE = 0
iRE = 0

N = int(input())
for i in range(N):
    S = input()
    if S == "AC":
        iAC += 1
    elif S == "WA":
        iWA += 1
    elif S == "TLE":
        iTLE += 1
    elif S == "RE":
        iRE += 1

print("AC x {}".format(iAC))
print("WA x {}".format(iWA))
print("TLE x {}".format(iTLE))
print("RE x {}".format(iRE))

Measured memory_bytes: 74624
N = int(input())
A = [0] + list(map(int, input().split()))

for i in range(N//2, 0, -1):
    # tmp = 0
    # j = i
    # while j < N+1:
    #     tmp += A[j]
    #     j += j
    # A[i] = tmp % 2
    A[i] = sum(A[i::i]) % 2
ans = [i for i, j in enumerate(A) if j == 1]

print(len(ans))
print(*ans)

Measured memory_bytes: 12724
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    long y = 100;
    int count =0;
    while(y<x){
      y=y+(y/100);
      count++;
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 35700
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;

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

  string s; cin >> s;
  sort(all(s));
  char ans = -1;
  for(char c = 'a'; c <= 'z'; ++c) {
    bool flag = false;
    rep(i, s.length()) {
      if(s[i] == c) flag = true;
    }
    if(!flag) {
      ans = c;
      break;
    }
  }
  if(ans == -1) cout << "None" << '\n';
  else cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 512
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
e=Counter(v[::2])
e[0]=0
o=Counter(v[1::2])
o[0]=0
e1,e2=e.most_common(2)
o1,o2=o.most_common(2)
if e1[0]!=o1[0]:
    print(n-(e1[1]+o1[1]))
else:
    print(n-max(e1[1]+o2[1],e2[1]+o1[1]))

Measured memory_bytes: 18656
/*input
11
mippiisssisssiipsspiim
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

string s,t;
map<pair<string,string>,int> mp;
int main()
{
	//IOS;
	int n;
	cin>>n>>s;
	REP(i,n) t.pb(s[2*n-i-1]);
	REP(i,n) s.pop_back();

	REP(i,(1<<n)){
		string a,b;
		REP(j,n){
			if(i&(1<<j)) a.pb(s[j]);
			else b.pb(s[j]);
		}
		mp[MP(a,b)]++;
	}
	ll ans=0;
	REP(i,(1<<n)){
		string a,b;
		REP(j,n){
			if(i&(1<<j)) a.pb(t[j]);
			else b.pb(t[j]);
		}
		ans+=mp[MP(a,b)];
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 91904
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <stack>
#include <sstream>

using namespace std;

int main(void)
{
    string s;
    int hisigata[100][100]={0};
    int l=0;
    while(cin>>s){
        for(int i=0; i<s.length(); i++){
            if(s[i]==',')s[i]=' ';
        }
        
        istringstream istr(s);
        int num;
        int c=1;
        while(istr>>num){
            hisigata[l][c]=num;
            c++;
        }
        l++;
    }
    /*cout<<l<<endl;
    for(int i=0; i<l; i++){
        for(int j=0; j<10; j++){
            cout<<hisigata[i][j]<<" ";
        }cout<<endl;
    }*/
    int c=2;
    for(int i=0; i<l; i++){
        for(int j=1; j<=c; j++){
            if(i<l/2){
                hisigata[i+1][j]+=max(hisigata[i][j],hisigata[i][j-1]);
            }else{
                hisigata[i+1][j]+=max(hisigata[i][j],hisigata[i][j+1]);
            }
        }
        if(i<l/2){
            c++;
        }else{
            c--;
        }
    }
    cout<<hisigata[l-1][1]<<endl;
    /*for(int i=0; i<l; i++){
        for(int j=0; j<10; j++){
            cout<<hisigata[i][j]<<" ";
        }cout<<endl;
    }*/
    
}

Measured memory_bytes: 1268
import collections
from functools import lru_cache
from scipy.misc import comb


results = {}


@lru_cache(maxsize=None)
def get_combination(n):
    if n < 2:
        return 0
    else:
        return comb(n, 2, exact=True)


n = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
S = 0
for k, v in c.items():
    S += get_combination(v)
for a in A:
    if results.get(a):
        print(results[a])
    else:
        results[a] = S - get_combination(c[a]) + get_combination(c[a] - 1)
        print(results[a])


Measured memory_bytes: 43004
#include<iostream>

using namespace std;

int main(){
    int N;
    int num1[5]={2,4,5,7,9};
    int num2[4]={0,1,6,8};
    cin >> N;
    for(int i=0;i<5;i++){
        if(N%10==num1[i]){
            cout << "hon";
            exit(0);
        }
    }
    for(int i=0;i<4;i++){
        if(N%10==num2[i]){
            cout << "pon";
            exit(0);
        }
    }
    cout << "bon";
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int N;
    cin >> N;
    if(N == 1) {
        printf("Hello World\n");
        return 0;
    }
    int A, B;
    cin >> A >> B;
    printf("%lld\n", A + B);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 200005

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

int X[SIZE];
ll rt[SIZE];
int L,n;

ll get_left(int s,int t)
{
	s=max(s,0);
	t=min(t,n-1);
	if(s>t) return 0;
	return  rt[t]-(s==0?0:rt[s-1]);
}
ll get_right(int s,int t)
{
	s=max(s,0);
	t=min(t,n-1);
	if(s>t) return 0;
	ll sum=get_left(s,t);
	return (ll) L*(ll) (t-s+1)-sum;
}
int main()
{
	scanf("%d %d",&L,&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&X[i]);
		rt[i]=X[i];
		if(i>0) rt[i]+=rt[i-1];
	}
	ll ret=0;
	for(int i=0;i<n;i++)
	{
		int f=min(i,n-i-1);
		ret=max(ret,get_left(i-f-1,i-1)*2LL+get_right(i,i+f)*2LL-(L-X[i]));
		//printf("%d %lld\n",f,get_left(i-f,i-1)*2LL+get_right(i,i+f-1)*2LL-(L-X[i]));
		ret=max(ret,get_left(i-f,i)*2LL+get_right(i+1,i+f+1)*2LL-X[i]);
		//ret=max(ret,(ll) max(X[i],L-X[i]));
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 100010
int n,k,p[N],a[N],b[N];
vector<int> v[N];

int D(int x,int y){
  int r=x%y;
  if(r<0)return r+y;
  return r;
}

void DFS(int e,int from){
  int maxi=-mod,mini=mod;
  set<int> st;
  lol(i,v[e].size()){
    if(v[e][i]==from)continue;
    DFS(v[e][i],e);
    int to=v[e][i];
    maxi=max(maxi,a[to]);
    mini=min(mini,b[to]);
    if(a[to]!=-mod)st.insert(D(a[v[e][i]],2));
  }
  maxi--,mini++;
  maxi=max(maxi,-mod),mini=min(mini,mod);
  if(st.size()>1)maxi=mod,mini=-mod;
  if(p[e]!=mod){
    if(!(maxi<=p[e]&&p[e]<=mini))maxi=mod,mini=-mod;
    else maxi=p[e],mini=p[e];
  }
  a[e]=maxi,b[e]=mini;
}

int ans[N];
void BFS(int e,int from,int cost){
  ans[e]=cost;
  lol(i,v[e].size()){
    if(v[e][i]==from)continue;
    int newcost,to=v[e][i];
    if(a[to]<=cost+1&&cost+1<=b[to])newcost=cost+1;
    if(a[to]<=cost-1&&cost-1<=b[to])newcost=cost-1;
    BFS(to,e,newcost);
  }
}

int main(){
  cin>>n;
  lol(i,n)a[i]=-mod,b[i]=mod,p[i]=mod;
  lol(i,n-1){
    int x,y;cin>>x>>y;x--,y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  cin>>k;
  lol(i,k){
    int x,y;cin>>x>>y;x--;
    p[x]=y;
  }
  DFS(0,-1);
  bool ok=true;
  lol(i,n)if(a[i]>b[i])ok=false;
  if(ok){
    cout<<"Yes"<<endl;
    BFS(0,-1,a[0]);
    lol(i,n)cout<<ans[i]<<endl;
  }
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 22016
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for i in range(N):
    tot = 0
    for j in range(M):
        tot += A[i][j]*B[j]
    if tot+C>0:
        cnt += 1
print(cnt)

Measured memory_bytes: 62348
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] B = new int[N-1];
        for(int i = 0; i < N-1; i++) B[i] = sc.nextInt();

        long res = B[0] + B[N-2];
        for(int i = 0; i+1 < N-1; i++) {
            res += Math.min(B[i], B[i+1]);
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 36040
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
//MAX

bool func(ll p) {

	if (p == 1)return false;
	else if (p == 2)return true;
	else {

		bool flag = true;
		for (int i = 2; i <= sqrt(p); i++) {

			if (p%i == 0) {

				flag = false;
				break;

			}

		}
		return flag;

	}

}

int main() {

	int Q, L[100005], R[100005], ans = 0;
	
	int num[100005];
	num[0] = 0;
	for (int i = 1; i < 100005; i++) {

		num[i] = num[i - 1];
		if (func(i) && func((i + 1) / 2))num[i]++;

	}

	cin >> Q;
	for (int i = 0; i < Q; i++) {

		cin >> L[i] >> R[i];

	}

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

		cout << num[R[i]] - num[L[i] - 1] << endl;

	}

	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main implements Runnable {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        String s = sc.next();
        String n = "";
        for (int i = 0; i < 3; i++) {
            n += s.charAt(i) == '9' ? '1' : '9';
        }
        System.out.println(n);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
 
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
// const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// gp_hash_table<int, int> table;
 
#define ll  long long
#define vii vector< ll >
#define pb push_back
#define pii pair<ll,ll>
#define ppi pair<pii,ll>
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define ins insert
#define ld long double
#define lp(l,r) for(i=l;i<=r;++i)
 
#define lpj(l,r) for(j=l;j<=r;++j)
#define lpr(l,r) for(i=r;i>=l;--i)
#define lprj(l,r) for(j=r;j>=l;--j)
 
#define swap(a,b){ auto _t=a;a=b,b=_t;}
#define flush() cout.flush()
#define popcount __builtin_popcount
#define die() return 0;
#define sz() size() 


 
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define MD          1000000007
#define M 			200011
#define LN             14
#define fftmod      998244353
#define EPS         (double)1e-10
 
long long  md=MD;
ll inf=1e18;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
 
inline ll exp(ll a,ll b){if(a==0&&b==0)return 1ll;if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=(r%md)*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 
using cd=complex<double>;
const double PI=acos(-1);
 
inline ll rand(ll l,ll r){
    return l+rng()%(r-l+1);
}




int main(){
 
     
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
 
   // ifstream fin("input.txt");ofstream fout("outut.txt");
    ll t,i,j,m,n,s,z,k,p;string s1,s2;ll q;ll x,y;
    cin>>s1;
    for(i=0;i<26;++i){
    	priority_queue<pii,vector<pii>,greater<pii> > v;
    	ll k=0;
    	for(j=0;j<s1.size();++j){
    		if(s1[j]!='a'+i)continue;
    		k++;
    		ll c=2*k-j;
    		if(v.size()){
    			pii p=v.top();
    			if(c-p.F>0){
    				// trace(c,p.F,p.S,i);
    				cout<<p.S+1<<" "<<j+1<<"\n";
    				die();
    			}
    		}
    		v.push({c-1,j});

    	}
    }cout<<"-1 -1\n";die();



}



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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> temp(N);
    for (auto& i : temp) cin >> i;
    vector<int> A(M), B(M), C(M);
    for (int i = 0; i < M; i++)
        cin >> A[i] >> B[i] >> C[i];

    int dp[N+1][M];
    for (int i = 0; i < N + 1; i++)
        for (int j = 0; j < M; j++) dp[i][j] = -100000;

    for (int i = 0; i < M; i++) {
        if (temp[0] < A[i] || B[i] < temp[0]) continue;
        dp[0][i] = 0;
    }

    for (int i = 1; i < N; i++) {
        for (int j = 0; j < M; j++) {
            if (temp[i] < A[j] || B[j] < temp[i]) continue;
            for (int k = 0; k < M; k++) {
                dp[i][j] = max(dp[i][j], dp[i-1][k] + abs(C[j] - C[k]));
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < M; i++)
        ans = max(dp[N-1][i], ans);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3244
#include <stdio.h>

int main(void){
  int A;
  int N;
  int amari;
  scanf("%d", &A);
  scanf("%d", &N);

  amari = A % 500;
  if(amari<=N){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}


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

bool nabeatsu(int n){
    if(n % 3 == 0) return true;
    int temp = n;
    while(temp > 0){
        if(temp % 10 == 3) return true;
        temp /= 10;
    }
    return false;
}
int main(){
    int n; cin >> n;
    for(int i = 1; i <= n; i++){
        if(nabeatsu(i)){
            cout << ' ' << i;
        }
    }
    cout << endl;
}



Measured memory_bytes: 3100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String[] params;
      Dice dice2 = new Dice(br.readLine().split(" "));
      int upper,front;
      int q = Integer.parseInt( br.readLine() );
      for ( ; q > 0; q--) {

        params = br.readLine().split(" ");

        upper = Integer.parseInt(params[0]);
        front = Integer.parseInt(params[1]);

        while(true){
          if( dice2.getFrontSide() == front){
            for (int i=0; i<3; i++)
              if(dice2.getUpperSide() == upper) break;
              dice2.rotate("W");
          }
          else {
            for(int i=0; i < 3; i++)
              if(dice2.getUpperSide() != front) dice2.rotate("N");
            for(int i=0; i < 3; i++)
              if(dice2.getUpperSide() != front) dice2.rotate("W");
            dice2.rotate("S");
          }
          if( (dice2.getUpperSide()==upper) && (dice2.getFrontSide()==front)) break;
        }
        System.out.println(dice2.getRightSide());
      }
    }
  }
}

class Dice {
  private int[] side;

  public Dice( int[] ia ) {
    side = Arrays.copyOf(ia, ia.length);
  }
  public Dice( String[] s ) {
    side = new int[s.length];
    for ( int i=0; i < 6; i++)
      side[i] = Integer.parseInt(s[i]);
  }

  public int getUpperSide() {
    return side[0];
  }
  public int getFrontSide() {
    return side[1];
  }
  public int getRightSide() {
    return side[2];
  }

  public int doRotate(String s) {
    for ( int i=0; i < s.length(); i++ ) {
      rotate(s.substring(i, i+1));
    }
    return side[0];
  }

  public void rotate(String o) {
    switch(o) {
      case "N" :
        rotateN();
        break;
      case "S" :
        rotateS();
        break;
      case "W" :
        rotateW();
        break;
      case "E":
        rotateE();
        break;
      default :
    }
  }

  private void rotateN() {
    int tmp = side[0];
    side[0] = side[1]; side[1] = side[5]; side[5] = side[4];
    side[4] = tmp;
  }
  private void rotateS() {
    int tmp = side[0];
    side[0] = side[4]; side[4] = side[5]; side[5] = side[1];
    side[1] = tmp;
  }
  private void rotateW() {
    int tmp = side[0];
    side[0] = side[2]; side[2] = side[5]; side[5] = side[3];
    side[3] = tmp;
  }
  private void rotateE() {
    int tmp = side[0];
    side[0] = side[3]; side[3] = side[5]; side[5] = side[2];
    side[2] = tmp;
  }
}


Measured memory_bytes: 24440
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<Z A,Z...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  P a[n];
  rep(i,n) cin >> a[i].F >> a[i].S;
  vector<ll> x,y;
  rep(i,n) {
    x.pb(a[i].F);
    y.pb(a[i].S);
  }
  sort(all(x));
  sort(all(y));
  double l,r;
  if(n%2) {
    l=x[(n-1)/2],r=y[(n-1)/2];
    pr((ll)(r-l+1));
  } else {
    l=(double)(x[n/2]+x[n/2-1])/2,r=(double)(y[n/2]+y[n/2-1])/2;
    pr((ll)((r-l+1)*2-1));
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 9748
import numpy as np
N, T = list(map(int, input().split()))
t = np.array(list(map(int, input().split())))
tT = np.sort(t)[::-1] + T

total = tT[0]
for i in range(1, N):
  total -= max(tT[i-1] - tT[i]-T, 0)
  
print(total)
  


Measured memory_bytes: 34224
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	long long int a,b;
	scanf("%lld %lld",&a,&b);
	if (abs(a - b) <= 1) {
		printf("Brown\n");
	}
	else
		printf("Alice\n");
	return 0;
}

Measured memory_bytes: 128