akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String args[])
    {
        FastReader obj = new FastReader();
        String str = obj.next();
        if(str.charAt(2)==str.charAt(3) && str.charAt(4)==str.charAt(5))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

#define equal equalll
#define less lesss
typedef long long ll;
const int N = -1;
const long long INF = 1e9 + 19;



void read() {
    string s;
    cin >> s;
    int i = 0;
    for (; i < (int)s.size(); i++)
        if (s[i] == 'C')
            break;
    if (i < (int)s.size()) {
        for (; i < (int)s.size(); i++)
            if (s[i] == 'F')
                break;
        if (i < (int)s.size()) {
            puts("Yes");
            return;
        }

    }
    puts("No");
}

void solve() {

}

void stress() {

}


int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    if (1) {
        int k = 1;
        for (int tt = 0; tt < k; tt++) {
            read();
            solve();
        }
    }
    else {
        stress();
    }

    return 0;
}







Measured memory_bytes: 384
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	int sum=0;
	for(int i=a;i<=b;i++){
		if(i/10000==i%10){
			if(i/1000-i/10000*10==(i%100-i%10)/10){
				sum++;
			}
		}
	}
	printf("%d",sum);
	return 0; 
}


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

int n,a,b,c,x,ans;
int y[101];
int main(){
	while(1){
		cin >>n >>a >>b >>c >>x;
		if(!(n||a||b||c||x))break;
		for(int i=0;i<n;i++){
			cin >>y[i];
		}
		ans=0;
		int i=0,j=0;
		for(i=0;i<=10000;i++){
			if(x==y[j]){
				j++;
			}
			if(j==n)break;
			if(i==10000){
				i=-1;
				goto END;
			}
			x=(a*x+b)%c;
		}
		END:
		cout << i<<endl;
	}
	return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>

int main(void) {
  std::string s;
  std::cin >> s;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) if (s.at(i) == '1') cnt++;
  std::cout << cnt << std::endl;
  return 0;
}


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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

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


int main(){
  string s;
  cin >> s;
  int n = s.length();
  REP(i, n){
    if(s[i] == s[i + 1]) {
      cout << i + 1 << ' ' << i + 2 << "\n";
      return 0;
    }
    
    if(s[i] == s[i + 2]){
      cout << i + 1 << ' ' << i + 3 << "\n";
      return 0;
    }
  }
  cout << -1 << ' ' << - 1 << "\n";
  return 0;
}


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

using namespace std;

int main() {

	long n;
	cin >> n;
	vector<vector<long>> xy(n, vector<long>(2));
	for (long i = 0; i < n; i++) {
		cin >> xy[i][0] >> xy[i][1];
	}

	double dist = 0;
	long counter = 0;
	double res = 0;
	for (long i = 0; i < n; i++) {
		for (long j = 0; j < n; j++) {
			dist = pow((pow(xy[i][0] - xy[j][0], 2) + pow(xy[i][1] - xy[j][1], 2)), 0.5);
			res += dist;
			counter++;
		}
	}
	cout << setprecision(15) << res/n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,ans=1;
  cin >> n;
  ll p[n];
  for(int i=0;i<n;i++) cin >> p[i];
  ll m =  p[0];
  for(int i=1;i < n;i++){
    if(m >= p[i]) ans++;
    m = min(p[i],m);
  }
  cout << ans << endl;
}

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

int main() {
  string s;
  cin >> s;
  int N = s.size();
  for (int i = 0; i < N; i++) {
    if (s[i] == '?') s[i] = 'D';
  }
  cout << s << endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;
typedef long long int lli;
typedef pair<int, int> ii;

int main() {
    char s[26] = {}, t[26] = {};
    char S[200009], T[200009];
    cin >> S >> T;
    for (int i = 0; S[i] != '\0'; i++) {
        if (s[S[i] - 'a'] != 0 && s[S[i] - 'a'] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
        if (t[T[i] - 'a'] != 0 && t[T[i] - 'a'] != S[i]) {
            cout << "No" << endl;
            return 0;
        }
        s[S[i] - 'a'] = T[i];
        t[T[i] - 'a'] = S[i];
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
N,Y=map(int,input().split())
found=False
for a in range(N+1):
  for b in range(N+1-a):
    c=N-(a+b)
    if 10000*a+5000*b+1000*c==Y:
      print(a,b,c)
      found=True
      break
  if found:
    break
else:
  print(-1,-1,-1)

Measured memory_bytes: 3060
d, g = map(int, input().split())
problem = [list(map(int, input().split())) for i in range(d)]

mincost = float('inf')

for i in range(2**d):
    count = 0
    score = 0
    flag = [0 for _ in range(d)]
    for j in range(d):
        if i >> j & 1 == 1:
            flag[j] = 1
            count += problem[j][0]
            score += problem[j][0] * 100 * (j+1) + problem[j][1]
    for k in range(d-1, -1, -1):
        if score >= g:
            mincost = min(mincost, count)
            break
        if flag[k] == 0:
            num = 0
            while num <= problem[k][0] - 1:
                num += 1
                count += 1
                score += 100 * (k+1)
                if score >= g:
                    mincost = min(mincost, count)
                    break
            break

print(mincost)


Measured memory_bytes: 3064
N,K=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
F=sorted(list(map(int,input().split())))
import numpy as np
a=np.array(a)
F=np.array(F)

t_max=a[0]*F[-1] #絶対True
t_min=-1 #絶対False
while t_max>t_min+1:
    t_mid=(t_max+t_min)//2
    K_temp=np.sum(np.maximum(a-t_mid//F,0))
    if K_temp<=K:
        t_max=t_mid
    else:
        t_min=t_mid
print(t_max)

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

long double A, B, H, M;
long double angle;

int main(){
  cin >> A >> B >> H >> M;
  angle = (30 * H) + (30 * M / 60) - (6 * M);
  // if (angle > 180) angle -= 180;
  long double radian;
  radian = (angle / 180) * M_PI;
  long double ans;
  ans = sqrtl((A*A + B*B) - (2*A*B*cosl(radian)));
  cout << fixed << setprecision(20);
  cout << ans << endl;
}


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

long long h, n, dp[10002];
pair<long long, long long>a[1002];

void init(){
	memset(dp,-1,sizeof dp);
	dp[0]=0;
}

int main(){
	init();
	cin >> h >> n;
	for (int i=0;i<n;i++) cin >> a[i].first >> a[i].second;
	for (int i=0;i<h;i++){
		if (dp[i]==-1) continue;
		for (int j=0;j<n;j++){
			if (i+a[j].first<h) {
				if (dp[i+a[j].first]==-1) dp[i+a[j].first]=dp[i]+a[j].second;
				else dp[i+a[j].first]=min(dp[i+a[j].first],dp[i]+a[j].second);
			}
			else {
				if (dp[h]==-1) dp[h]=dp[i]+a[j].second;
				else dp[h]=min(dp[h],dp[i]+a[j].second);
			}
		}
	}
	cout << dp[h] << "\n";
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		long x = fs.nextLong();
		long k = fs.nextLong();
		long d = fs.nextLong();
		x = Math.abs(x);
		long m = Math.min(x%d, Math.abs(x%d-d));
		long step = x%d<Math.abs(x%d-d)?x/d:x/d+1;
		if(step>k)
		{
			System.out.println(x-k*d);
		}
		else if(step==k)
		{
			System.out.println(m);
		}
		else
		{
			if((k-step)%2==0)
			{
				System.out.println(m);
			}
			else
			{
				System.out.println(Math.max(x%d, Math.abs(x%d-d)));
			}
		}
	}

	
	
	
	static class FastScanner
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
}


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

int main () {

    int n;
    cin >> n;

    vector<int> a(3), b(3);

    // a is for input;
    // b is for the running answer (when the last activity was 1/2/3);

    cin >> b[0] >> b[1] >> b[2];

    for (int i = 1; i < n; i++) {
        cin >> a[0] >> a[1] >> a[2];
        vector<int> c(3);
        c[0] = max(b[1], b[2]) + a[0];
        c[1] = max(b[0], b[2]) + a[1];
        c[2] = max(b[0], b[1]) + a[2];

        b = c;
    }
    cout << max(b[0], max(b[1], b[2])) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = sc.nextInt()
    val b = sc.nextInt()
    println((1..n).filter { x ->
        val sum = x.toString().sumBy { it - '0' }
        sum in a..b
    }.sum())
}

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

int main(){
	int n,i,j,ans = 0;
	cin >> n;
	int d[n];
	for(i = 0; i < n; i++){
		cin >> d[i];
	}
	for(i = 0; i < n - 1; i++){
		for(j = i + 1; j < n; j++){
			ans = ans + d[i]*d[j];
		}
	}

	cout << ans;
	return 0;
}


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

int main(){
    int n;
    int h[100010];
    int dp[100010] = {};
    cin >> n;
    for(int i = 0;i < n;i++) cin >> h[i];

    int ans = 0;
    for(int i = n-2;i >= 0;i--){
        if(h[i] >= h[i+1]){
            dp[i] += dp[i+1] + 1;
        }else{
            dp[i] = 0;
        }
        ans = max(ans, dp[i]);
    }

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



Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
static const int N = 1000005;

int n;
ll K;
int dp[N],dpo[N];
ll pollock[N],oollock[N];
ll pmax,omax;
int cmax;
int a;

int pol()
{
	scanf("%d",&n);
	if(n==0)return -1;
	if(cmax>=n){
		a = dpo[n];
		return dp[n];
	}
	while(pollock[pmax]<=n){
		pmax++;
		pollock[pmax] = pmax*(pmax+1)*(pmax+2)/6;
		if(pollock[pmax]%2==1){
			omax++;
			oollock[omax]=pollock[pmax];
		}
	}
	int k=1,j=1,s=1,f=1;
	for(int i=cmax+1;i<=n;i++){
		while(pollock[j]<=i)j++;
		int minv = 9;
		for(int c=1;c<j;c++){
			minv = min(minv,dp[i-pollock[c]]+1);
		}
		dp[i] = minv;

		while(oollock[k]<=i&&k<=omax){
			k++;
		}
		minv = 99;
		int c;
		for(c=1;c<k;c++){
			minv = min(minv,dpo[i-oollock[c]]+1);
		}
		dpo[i] = minv;
		//printf("(%d:%d)",i,k);
	}
	cmax=n;
	a = dpo[n];
	return dp[n];
}
int main(){
	pmax=0;
	cmax=omax=0;
	dp[0]=0;
	dpo[0]=0;
	pollock[0]=oollock[0]=0;
	while(1){
		int p = pol();
		if(p==-1)return 0;
		printf("%d %d\n",p,a);
	}
}



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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a;
    string s;
    cin >> a >> s;
    cout << (a >= 3200 ? s : "red") << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = [i+1+a[i] for i in range(n)]
c = [(j+1)-a[j] for j in range(n)]
d = Counter(c)
ans = 0
for i in range(n):
    ans += d[b[i]]
print(ans)





Measured memory_bytes: 134196
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  int n;
  cin>>n;
  vector<in> a(n);
  rep(i,n)
    cin>>a.at(i);
  sort(all(a));
  reverse(all(a));
  in ans=0;
  //ans+=a.at(0);
  for(int i=2;i<=n;i++){
    int m=(i+1)/2;
    ans+=a.at(m-1);
  }
  cout<<ans<<endl;
}

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

int main(){
	int i;
	int temp[10];

	for(i=0;i<10;i++){
		cin >> temp[i];
	}

	sort(temp, temp+10, greater<int>());

	for(i=0;i<3;i++){
		cout << temp[i] << endl;
	}
	

	return 0;
}


Measured memory_bytes: 3104
#include<algorithm>//everybody dies in their nightmares
#include<iostream>
#include<cstring>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;

const int N = 6e5 + 5;
int t;
const double p = 3.1415926;
int main()
{
	int r;
	while(cin>>r)
	printf("%.8lf\n", 2 * p*r);
	return 0;
}

Measured memory_bytes: 3764
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/21/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int N; cin>>N;
  vector<int> A(N);
  {
    string s; cin>>s;
    for (int i = 0; i < N; i++) {
      A[i] = s[i]-'1';
    }
  }

  int lo = 0;
  while (lo < N and A[lo] != 1)
    lo++;
  int coeff = 1;
  if (lo == N) {
    for (auto& a : A) a /= 2;
    coeff = 2;
  }

  bool eo = 0;
  for (int i = 0; i < N; i++) {
    eo ^= A[i]%2==1 and ((N-1)&i) == i;
  }

  auto ans = coeff * eo;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5788
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#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 sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	string ans = "";
	rep(i, ty - sy)	ans += 'U';
	rep(i, tx - sx)	ans += 'R';
	rep(i, ty - sy)	ans += 'D';
	rep(i, tx - sx)	ans += 'L';
	ans += 'L';
	rep(i, ty - sy + 1)	ans += 'U';
	rep(i, tx - sx + 1)	ans += 'R';
	ans += 'D';
	ans += 'R';
	rep(i, ty - sy + 1)	ans += 'D';
	rep(i, tx - sx + 1)	ans += 'L';
	ans += 'U';
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int d = stdIn.nextInt();
			int sum = 0;
			for(int i = d; i < 600; i += d)
			{
				sum += d * i * i;
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 12000
//https://github.com/mostafa-saad/MyCompetitiveProgramming/blob/master/UVA/UVA_10740.txt
#include<queue>
#include<map>
#include <string>
#include<bits/stdc++.h>
#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);
//#define x real()
//#define y imag()
using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
//typedef complex<double> point;
//template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); }
//typedef bitset<30> mask;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//#define var(x) ((x)<<1)
//#define nvar(x) ((x)^1)

int n;
ll dis[100010];
vector<pair<int,int>>a[100010];

void dfs(int u,int p )
{
    for(auto v:a[u])
    {
        if(v.F==p)continue;
        dis[v.F]=dis[u]+v.S;
        dfs(v.F,u);
    }

}
 main()
{

//cout<<Pow((ll)1000000,(ll)110);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
//    char input[15];
//    scanf("%s", &input);  array of char
//  gets(c+1);  array of char
//printf("%s, ",name[k[i]].c_str());  printf of string
input;
cin>>n;
int u,v,w;
forr(i,1,n-1)
{
    cin>>u>>v>>w;
    a[u].push_back({v,w});
    a[v].push_back({u,w});
}
dfs(1,-1);

forr(i,1,n)cout<<dis[i]%2<<endl;
return 0;
}


Measured memory_bytes: 8704
<?php
list($s) = strs();
$n = strlen($s);
for ($i = 0; $i < $n; ++$i) {
    for ($l = 0; $l <= $n - $i; ++$l) {
        $ss = substr($s, 0, $i) . substr($s, $i + $l);
        if ($ss === 'keyence') exit('YES');
    }
}
echo 'NO';
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


Measured memory_bytes: 16200
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int n, m;
vi d;
string t;

int calc(string& f){
    int j = -1;
    rrep(i, m){
        if(j + 1 < n and t[i] == f[j + 1] and d[i] == 0){
            j++;
        }
        else if(j >= 0 and t[i] == f[j] and d[i] == 1){
            j--;
        }
    }
    return j + 1;
}

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

    cin >> n >> m;
    string f; cin >> f;
    d = vi(m), t = string(m, ' ');
    rep(i, m){
        char c; cin >> t[i] >> c;
        d[i] = (c == 'L' ? 0:1);
    }

    int res = n - calc(f);

    for(auto& e : d) e ^= 1;
    reverse(_all(f));
    res -= calc(f);
    chmax(res, 0);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1616
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

const mod = 1000000007

func mpow(a, b int) int {
	if b == 0 {
		return 1
	} else if b%2 == 0 {
		tmp := mpow(a, b/2)
		return tmp * tmp % mod
	}
	return mpow(a, b-1) * a % mod
}

var fracMemo = []int{1, 1}

func mfrac(n int) int {
	if len(fracMemo) > n {
		return fracMemo[n]
	}
	if len(fracMemo) == 0 {
		fracMemo = append(fracMemo, 1)
	}
	for len(fracMemo) <= n {
		size := len(fracMemo)
		fracMemo = append(fracMemo, fracMemo[size-1]*size%mod)
	}
	return fracMemo[n]
}

var ifracMemo = []int{1, 1}

func mifrac(n int) int {
	if len(ifracMemo) > n {
		return ifracMemo[n]
	}
	if len(ifracMemo) == 0 {
		fracMemo = append(ifracMemo, 1)
	}
	for len(ifracMemo) <= n {
		size := len(ifracMemo)
		ifracMemo = append(ifracMemo, ifracMemo[size-1]*mpow(size, mod-2)%mod)
	}
	return ifracMemo[n]
}

func nCr(n, r int) int {
	if n == r {
		return 1
	}
	if n < r || r < 0 {
		return 0
	}
	ret := 1
	ret *= mfrac(n)
	ret %= mod
	ret *= mifrac(r)
	ret %= mod
	ret *= mifrac(n - r)
	ret %= mod
	return (ret)
}

func main() {
	sc.Split(bufio.ScanWords)
	N, K := getInt(), getInt()

	ans := 0
	for i := K; i <= N+1; i++ {
		x := i * (i - 1) / 2
		y := N*i - x
		// out(i, x, y, y-x+1)
		ans += y - x + 1
		ans %= mod
	}

	out(ans)
}


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

void solve(){

	int n ;
	cin>>n ;

	vector<int> dp(n+1,0) ;

	dp[0]=1 ;
	dp[1]=dp[2]=0 ;

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

		for(int j=3;j<=n;j++){

			if(i-j>=0)
				dp[i]+=(dp[i-j]) ; 
				dp[i]%=mod ;
		}

	}


	cout<<dp[n] ;
	
	/*
	rep(i,n+1){
		cout<<dp[i]<<" " ;
	}
	*/
}

int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

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

}

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

int main(){
    string S,T,identical;
    int i,j;
    cin>>S>>T;
    int length = S.size();
    char rotated_S[S.size()];
    for (i=0;i<length;i++){
        for (j=0;j<length;j++){
            if (i+j<length){
                rotated_S[i+j]=S[j];
            }
            else{
                rotated_S[i+j-length]=S[j];
            }
        }
        rotated_S[length]='\0';
        if(rotated_S==T){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;;
}

Measured memory_bytes: 3600
// God put a smile upon your face <3

#include <bits/stdc++.h>`

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 958585860497

#define base 2001487

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

//    slld(testcase);

//    for(ll cs = 1; cs <= testcase; cs++)
    {
		ll h1, m1, h2, m2;

		cin >> h1 >> m1 >> h2 >> m2 >> k;

		ll timee = (h2 - h1) * 60 + (m2 - m1);

		timee = (timee + 1440) % 1440;

		printf("%lld\n", max(0LL, timee - k));
    }


}




Measured memory_bytes: 3752
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program {
    internal static void Main(string[] args) {
        var S = ReadLine();
        var w = int.Parse(ReadLine());
        var lst = new List<string>();
        var st = 0;
        var cnt = 0;
        if (S.Length % w == 0) {
            cnt = S.Length / w;
        } else {
            cnt = S.Length / w + 1;
        }
        for (int i = 0; i < cnt; i++) {
            lst.Add(S.Substring(st, 1));
            st += w;
        }
        WriteLine(String.Join("", lst));
    }
}


Measured memory_bytes: 13268
N=int(input())
A=list(map(int,input().split()))

flag=True
for i in A:
    if i%2!=0:
        continue
    else:
        if i%3==0 or i%5==0:
            continue
        else:
            flag=False

if flag:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 2940
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    int ans = 0;
    rep(i, log10(N) + 1) {
        long long a = pow(10, i + 1);
        long long b = a / 10;
        ans += (N % a) / b;
    }
    cout << (N % ans == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

  int L = S / 100;
  int R = S % 100;

  bool L_is_MM = (1 <= L && L <= 12);
  bool R_is_MM = (1 <= R && R <= 12);

  if (L_is_MM && R_is_MM) {
    cout << "AMBIGUOUS" << endl;
  } else if (L_is_MM && !R_is_MM) {
    cout << "MMYY" << endl;
  } else if (!L_is_MM && R_is_MM) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
}

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

#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define forup(i,l,r) for (register int i = l ; i <= r ; i += lowbit(i))
#define fordown(i,id) for (register int i = id ; i ; i -= lowbit(i))
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define lowbit(x) (x&(-x))

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pr;

const ll MAX = 2e18;
const ld inf = 2e18;
const int N = 3e6 + 10;
const int maxn = 200020;
const ll mod = 1e9 + 7;

int a[maxn],n,b[maxn],tot;
struct node{
	int x,y,l,r;
	bool operator < (node c)const{
		return a[x] > a[c.x];
	}
};
priority_queue <node> heap;



namespace Seg{
#define ls(x) (x << 1)
#define rs(x) ((x << 1) | 1)
	const int M = 2e5 + 20;
	int id[2][M << 2];
	
	inline void update(int x){
		rep(t,0,1){
			if ( a[id[t][ls(x)]] > a[id[t][rs(x)]] ) id[t][x] = id[t][rs(x)];
			else id[t][x] = id[t][ls(x)];
		}
	}
	void build(int x,int l,int r){
		if ( l == r ){
			id[l & 1][x] = l;
			return;
		}
		int mid = (l + r) >> 1;
		build(ls(x),l,mid) , build(rs(x),mid + 1,r);
		update(x);
	}
	int query(int x,int l,int r,int L,int R,int t){
		if ( L > R ) return 0;
		if ( L <= l && R >= r ) return id[t][x];
		int mid = (l + r) >> 1; int lres = 0,rres = 0;
		if ( L <= mid ) lres = query(ls(x),l,mid,L,R,t);
		if ( R > mid ) rres = query(rs(x),mid + 1,r,L,R,t);
		if ( a[lres] < a[rres] ) return lres;
		return rres;
	}
}
using namespace Seg;

void init(){
	a[0] = n + 1;
	build(1,1,n);
	int t = 1;
	int x = query(1,1,n,1,n,t);
	int y = query(1,1,n,x + 1,n,t ^ 1);
	heap.push((node){x,y,1,n});
}
void insert(int l,int r){
	if ( l > r ) return;
	int t = l & 1;
	int x = query(1,1,n,l,r,t);
	int y = query(1,1,n,x + 1,r,t ^ 1);
	heap.push((node){x,y,l,r});
}
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	init();
	while ( heap.size() ){
		node cur = heap.top() ; heap.pop();
		int l = cur.l,r = cur.r,x = cur.x,y = cur.y;
	//	cout<<l<<" "<<r<<" "<<x<<" "<<y<<endl;
	//	system("pause");
		b[++tot] = a[x] , b[++tot] = a[y];
		insert(l,x - 1);
		insert(x + 1,y - 1);
		insert(y + 1,r);
	}
	rep(i,1,tot) printf("%d ",b[i]);
	puts("");
}


Measured memory_bytes: 9972
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define INF 1073741824
#define ll long long
#define PI (2*acos(0.0))
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> 
void dbg_out(Head H, Tail... T) { 
    cerr << ' ' << H;
     dbg_out(T...); 
}
#define dbg(...) cerr << '(' << #__VA_ARGS__ << ')'<<':', dbg_out(__VA_ARGS__)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define vi vector<int>
#define vll vector<ll>
#define on(val,pos) val|(1<<pos)
#define off(val,pos) val&(~(1<<pos))
#define check(val,pos) (val&(1<<pos))
#define all(n) n.begin(),n.end()
//first four adjacent,second four corner
//int row[8]={0,-1,0,1,1,-1,-1,1};
//int col[8]={-1,0,1,0,-1,-1,1,1};
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vi pa,cnt;
int find(int a){
    if(a==pa[a])return a;
    return pa[a]=find(pa[a]);
}
int main(){
    int i,j,k,n,m,val,t=0,test;
    //freopen("000input.txt","r",stdin);
    cin>>n>>m;
    pa.resize(n+1);
    cnt.resize(n+1,1);
    for(int &u:pa)u=t++;
    int maxi=1;
    for(i=0;i<m;i++){
        cin>>j>>k;
        if(find(j)!=find(k)){
            int a=find(j),b=find(k);
            pa[a]=pa[b];
            cnt[b]+=cnt[a];
            maxi=max(maxi,cnt[b]);

        }
    }
    cout<<maxi<<endl;
    //free();   //if pointer array
    return 0;
}


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

int main() {
  int a;
  	cin >> a;
  int b;
  	b = a / 1000;
  int c;
  	c = (a - b * 1000) / 100;
  int d;
  	d = (a - (b * 1000 + c * 100)) / 10;
  int e;
    e = (a - (b * 1000 + c * 100 + d *10));
      if(c == d){
        if(b == c || d == e){
           cout << "Yes" << endl;}
          else{
            cout << "No" << endl;
          }
      }
  	  else{
         cout << "No" << endl;
      }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x[101],y[101],h[101],n;
int dis(int x1,int y1,int x2,int y2){
    return abs(x1-x2)+abs(y1-y2);
}
int check(int xi,int yi){
    int hi;
    for(int i=0;i<n;i++)
        if(h[i]!=0){
            hi=h[i]+dis(xi,yi,x[i],y[i]);
            break;
        }
    for(int i=0;i<n;i++)
        if(max(hi-dis(xi,yi,x[i],y[i]),0)!=h[i])
            return -1;
    return hi;
}
main(){
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>x[i]>>y[i]>>h[i];
    for(int i=0;i<=100;i++)
        for(int j=0;j<=100;j++){
            int now=check(i,j);
            if(now!=-1){
                cout<<i<<" "<<j<<" "<<now<<endl;
                return 0;
            }
        }
    return 0;
}

Measured memory_bytes: 256
from itertools import product
 
N, M, X = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
ans = float("inf")
for i in product(range(2),repeat=N):
    ans1=0
    l=[0 for i in range(M)]
    for j in range(N):
        if i[j]==1:
            ans1+=A[j][0]
            for k in range(M):
                l[k]+=A[j][k+1]
    if min(l)>=X:
        ans=min(ans,ans1)
if ans==float("inf"):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9208
n,*x=map(int,open(0).read().split())
y=[x[0]-i for i in x]
m=n*max(x)
dp=[[0]*(m*2+1) for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
	for s in range(-m,m):
		dp[i][s]=dp[i-1][s]+dp[i-1][s-y[i]]
print(dp[n][0]-1)

Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N(0);
  cin >> N; 

  int A[N];
  for(int i = 0; i < N; i++)
  {
   	cin >> A[i]; 
  }
  
  int cnt(0);
  bool allEven(true);
  while(allEven)
  {
    for(int i = 0; i < N; i++)
    {
      if( 0 != A[i] % 2 )
      {
        allEven = false;
        cout << cnt << endl; 
        return 0;
      }
      else
      {
        A[i] /= 2;
      }
    }
    cnt++;
  }
}
 

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;
void solve(long long N, std::string S){
    ll cntE=0, cntW=0;
    rep(i, N){
        if(i==0) continue;
        if(S.at(i) == 'E') 
            cntE ++;
        else
            cntW ++;
    }
    ll numchange = cntE, ans = cntE;
    for(ll i=1; i< N; i++){
        if(S.at(i-1)== 'W')
            numchange ++;
        if(S.at(i) == 'E')
            numchange --;
        ans = min(ans, numchange);
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = LLONG_MAX / 3;
const double eps = (1e-9);

class UnionFind {
public:
  // 親の番号を格納する。親だった場合は-(その集合のサイズ)
  vector<int> parent;

  // 作るときは parent の値を全て -1 にする
  // こうすると全てバラバラになる
  UnionFind(const int& n = 0) : parent(n, -1) {}

  // x がどのグループに属しているか調べる
  int find(const int& x) {
    if (parent[x] < 0) return x;
    return parent[x] = find(parent[x]);
  }

  // x と y をくっつける  O(log n)
  bool unite(int x, int y) {
    // x と y を直接くっつけるのではなく，root(x) に root(y) をくっつける
    x = find(x);
    y = find(y);
    if (x == y) return false;  // すでにくっついているからくっつけない

    // 大きい方(x) に小さい方(y)をくっつけたい 大小が逆だったらひっくり返す
    if (size(x) < size(y)) swap(x, y);

    parent[x] += parent[y];  // x のサイズを更新する
    parent[y] = x;  // y の親を x に変更する
    return true;
  }

  // 自分のいるグループの頂点数を調べる
  int size(const int& x) { return -parent[find(x)]; }

  // x と y が同じグループに属しているか否か
  bool same(const int& x, const int& y) { return find(x) == find(y); }
};

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

  ll n, m, k;
  cin >> n >> m >> k;
  UnionFind uf(n);

  vector<ll> n_friends(n, 0);

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
    n_friends[a]++;
    n_friends[b]++;
  }

  vector<ll> ans(n, 0);
  rep(i, n) {
    ans[i] = uf.size(i) - n_friends[i] - 1;
  }

  rep(i, k) {
    int c, d;
    cin >> c >> d;
    c--; d--;
    if (uf.same(c, d)) {
      ans[c]--;
      ans[d]--;
    }
  }

  for (auto& v : ans) {
    cout << v << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 2816
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    a,b = map(str,input().split())

    num = int(a+b)
    sqrt_num = num ** 0.5
    if sqrt_num - int(sqrt_num) == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

using namespace __gnu_pbds;
using namespace std;

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
using ll = long long;

const int INF = (int) 1e9 + 9;
int h[100010];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    rep(i, 0, n) cin >> h[i];
    int cnt = 0;
    int cur = 0;
    rep(i, 1, n) {
        if (h[i] <= h[i-1]) ++cur;
        else cur = 0;
        cnt = max(cnt, cur);
    }
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 640
import math
A, B = map(int, input().split(' '))
flg = False
for i in range(0, 1001):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        print(i)
        flg = True
        break
if flg==False:
  print(-1)

Measured memory_bytes: 3060
from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
j = Counter(a)
le = sorted(j.items(), key=lambda i : i[1])
times = len(j) - k
si = 0
for i in range(times):
    item, value = le[i]
    si += value
print(si)

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

struct Problem {

    UL G[300][300];

    static const ULL M = 998244353;

    void Solve() {
        UL H, W; scanf("%d%d", &H, &W);
        rep(y, H) rep(x, W) {
            char c; scanf(" %c", &c);
            G[x][y] = c - '0';
        }
        UL Ker = 0;
        UL K = 0;
        rep(y, H) {
            UL Y = 0;
            while (true) {
                if (K == W) break;
                for (Y = y; Y < H; Y++) if (G[K][Y]) break;
                if (Y < H) break;
                K++;
            }
            if (K == W) { Ker = H - y; break; }
            rep(x, W) swap(G[x][y], G[x][Y]);
            for (UL yy = y + 1; yy < H; yy++) {
                if (G[K][yy]) {
                    for (UL x = K; x < W; x++)
                        G[x][yy] = G[x][yy] ^ G[x][y];
                }
            }
        }
        ULL ans = 1; rep(i, H + W - 1) ans = ans * 2 % M;
        ULL sub = 1; rep(i, Ker + W - 1) sub = sub * 2 % M;
        ans = (ans + M - sub) % M;
        cout << ans << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    //cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}


Measured memory_bytes: 640
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	ns := make([]int, n)
	for i := range ns {
		fmt.Scan(&ns[i])
	}
	sort.Ints(ns)
	fmt.Println(ns[n-1] - ns[0])
}


Measured memory_bytes: 512
def swaping(list2,q,b,e,t):

	k = e - b

	for i in range(k):
		list2[b+i],list2[t+i] = list2[t+i],list2[b+i]


if __name__ == '__main__':

	num = int(input())
	list2 = input().split()
	q = int(input())
	
	for i in range(q):
		b,e,t = map(int,input().split())

		swaping(list2,q,b,e,t)

	print(" ".join(list2))



Measured memory_bytes: 5640
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int N;
  scanf("%d",&N);
  vector<int> X1(200010,0),X2(2100010,0);
  for (int i = 0; i < N; i++) scanf("%d",&X1[i]);
  X2 = X1;
  sort(X2.begin(), X2.begin() + N);
  for (int i = 0; i < N; i++) {
    if(X1[i] <= X2[N/2-1]) printf("%d\n",X2[N/2]);
    else printf("%d\n",X2[N/2-1]);
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define DOW(i,b,a) for (int i = (b); i >= (a); i--)
#define pb(a) push_back(a)
#define ALL(a) (a).begin(),(a).end()
#define fi first
#define se second

template<typename T>
void print_array(T* arr, int num) {
   FOR(i, 0, num) cout << arr[i] << ' ';
   cout << endl;
}

template<typename T> 
void print_vector(vector<T> vec) {
   FOR(i,0,vec.size()) cout << vec[i] << ' ';
   cout << endl;
}

const int MOD = 1e9 + 7;
int n,x, len, arr[100010];
ll dp[100010]; 

ll modpow(int x, int y) {
	ll ans = 1, val = x;
	while (y) {
		if (y & 1) ans = (ans * val) % MOD;
		val = (val * val) % MOD;
		y >>= 1;
	}
	return ans % MOD;
}

ll bin(int n, int r) {
	if (n == r || r == 0) return 1;
	if (r > n) return 0;
	return (dp[n] * ((modpow(dp[r],MOD- 2) * modpow(dp[n - r], MOD - 2)) % MOD)) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
   // freopen("test.txt", "r", stdin);
    cin >> n;
    FOR(i,1,n+2) {
    	cin >> x;
    	if (arr[x]) len = i - arr[x];
    	arr[x] = i;
    }
    dp[1] = 1ll;
    FOR(i,2,n + 2) dp[i] = (dp[i - 1] * (ll) i) % MOD;
    FOR(i,1,n+2) {
    	ll cur = bin(n + 1, i);
    	ll mi = bin(n - len,i - 1);	
    	cout << (cur - mi + MOD) % MOD << endl;
    }		
}


Measured memory_bytes: 2432