akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		int k=sc.nextInt();
		String s=sc.next();
		int ans=0;
		int x=0;
		for(int i=0;i<k;i++) {
			if(s.charAt(i)=='I') {
				x++;
				
			}
			else {
				x--;
			}
			ans=Math.max(x,ans);
		}
        System.out.println(ans);
		
	}
	
	
	
	
//----------------------------------------------------------
	static int l_min(int[] a) {
		Arrays.sort(a);
		return a[0];
	}
	static int l_max(int[] a) {
		int l=a.length;
		Arrays.sort(a);
		return a[l-1];
	}
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			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: 22100
#include <iostream>
#include <vector>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;

ll mod_pow(ll a,ll b){
    a%=mod;
    if(b==0)return 1;
    if(b==1)return a;
    ll res=mod_pow(a,b/2)%mod;
    res*=res; res%=mod;
    if(b%2)res*=a;
    return res%mod;
}

struct perm{
private:
    int sz;
    vector<ll> p,invp;
public:
    perm(int n){
        sz=n+1;
        p.resize(sz),invp.resize(sz);
        p[0]=1;
        for(int i=1;i<=sz-1;i++){
            p[i]=p[i-1]*i%mod;
        }
        invp[sz-1]=mod_pow(p[sz-1],mod-2);
        for(int i=sz-2;i>=0;i--){
            invp[i]=invp[i+1]*(i+1)%mod;
        }
    }
    ll comb(ll x,ll y){
        if(x<y||y<0)return 0;
        return (p[x]*invp[x-y]%mod)*invp[y]%mod;
    }
};
perm p(1<<22);

ll dp[2020][2020];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    if(k==1){
        cout << 1 << endl;
        return 0;
    }
    dp[0][1]=1;
    for(int i=2;i<=n;i++){
        dp[0][i]=dp[0][i-1]*p.comb((i-1)*(k-1)+k-2,k-2)%mod;
    }
    for(int i=1;i<=n;i++){
        dp[i][i]=dp[i-1][i]; //最上段左端を取るしかない
        for(int j=i+1;j<=n;j++){
            dp[i][j]=(dp[i-1][j]+dp[i][j-1]*p.comb(j*(k-1)+i-1,k-2))%mod;
        } // k-2+(j-1)*(k-1)+i=j*(k-1)+i-1
    }
    ll res=dp[n][n];
    for(ll i=1;i<=n;i++){
        (res*=i)%=mod;
    }
    cout << res << endl;
}

Measured memory_bytes: 96768
a=str(input())
n=len(a)
def hamming_dis(b,c,n):
    count=0
    for i in range(n):
        if b[i]!=c[i]:
            count+=1
    return count
c=[0]*n
d=[1]*n
e=''
f=''
for i in range(0,n,2):
    c[i]=1
    d[i]=0
for i in range(0,n):
    e=e+str(c[i])
    f=f+str(d[i])
s=hamming_dis(a,e,n)
t=hamming_dis(a,f,n)
print(min(s,t))

Measured memory_bytes: 4980
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t--!=0){
			int n=sc.nextInt();
			int block[]=new int[n];
			int umax=0,dmax=0;
			
			for(int i=0; i<n; i++){
				block[i]=sc.nextInt();
			}

			for(int i=1; i<n; i++){
				if(block[i-1] < block[i]){
					if(umax < (block[i]-block[i-1])){
						umax=block[i]-block[i-1];
					}
				}
				else {
					if(dmax < block[i-1]-block[i]){
						dmax=block[i-1]-block[i];
					}
				}
			}
			System.out.println(umax+" "+dmax);
		}
	}
}

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

ll n, m, q;
ll a[50], b[50], c[50], d[50];
ll ans = 0, arr[11];

void dfs(ll N) {
    if(N == n + 1) {
        ll sum = 0;
        for(ll i = 0; i < q; i++) {
            if(arr[b[i]] - arr[a[i]] == c[i]) sum += d[i];
        }
        ans = max(ans, sum);
        return;
    }
    for(ll i = arr[N - 1]; i <= m; i++) {
        arr[N] = i;
        dfs(N + 1);
    }
}

void solve() {
    cin >> n >> m >> q;
    for(ll i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
    arr[0] = 1;
    dfs(1);
    cout << ans;
}    

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}

void Main()
{
  i64 N;
  cin >> N;

  vi A(N);
  map<i64,i64> m;
  rep(i,N){
    cin >> A[i];
    m[A[i]] = m[A[i]] + 1;
  }

  i64 ans = 0;
  for(auto i=m.begin(); i != m.end(); ++i){
    ans += (i->second) * (i->second - 1) / 2;
  }

  rep(i,N){
    cout << ans - (m[A[i]]-1) << "\n";
  }

}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


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

vector<pair<int,int>> vx;
vector<pair<int,int>> vy;
vector<tuple<ll,int,int>> eg;
int p[100002];

int find(int a){
	if(p[a] == a) return a;
	 return p[a] = find(p[a]);
}

int un(int a,int b){
	a = find(a);
	b = find(b);
	if(a == b) return 0;
	p[a] = b;
	return 1;
}


int main(){

	int n;
	cin>>n;

	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		vx.push_back({x,i});
		vy.push_back({y,i});
	}

	sort(vx.begin(),vx.end());
	sort(vy.begin(),vy.end());

	for(int i=0;i<n;i++) p[i] = i;

	for(int i=0;i<(int)vx.size()-1;i++){
		ll d = abs(vx[i].first - vx[i+1].first);
		eg.push_back(make_tuple(d,vx[i].second,vx[i+1].second));
	}

	for(int i=0;i<n;i++){
		ll d = abs(vy[i].first - vy[i+1].first);
		eg.push_back(make_tuple(d,vy[i].second,vy[i+1].second));
	}

	sort(eg.begin(),eg.end());

	ll res = 0;
	for(int i=0;i<(int)eg.size();i++){
		ll d;
		int a,b;
		tie(d,a,b) = eg[i];
		if(un(a,b)) res+=d;

	}
	cout<<res;



}

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

class Program
{
    static void Main(string[] args)
    {
        var primes = new List<int>();
        for (int i = 2; i < 1000; ++i)
        {
            if (primes.All(prime => i % prime != 0)) { primes.Add(i); }
        }
        int N = int.Parse(Console.ReadLine());
        var factors = new Dictionary<int, int>();
        for (int i = 2; i <= N; ++i)
        {
            int n = i;
            for (int j = 0; j < primes.Count && n >= primes[j]; ++j)
            {
                int prime = primes[j];
                while (n > 0 && n % prime == 0)
                {
                    if (!factors.ContainsKey(prime)) { factors[prime] = 0; }
                    ++factors[prime];
                    n /= prime;
                }
            }
        }
        long count = 1;
        foreach (var pair in factors)
        {
            count *= pair.Value + 1;
            count %= 1000000007;
        }
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 3416
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
//get the biggest element.
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;
  });
}
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;

int main() {
  cin.tie(0);ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  rep (i, n) cin >> a[i];
  for (int i = 1; i < n; i++) {
    a[i] = gcd(a[i], a[i - 1]);
  }
  cout << a[n - 1] << endl;
  return 0;
}


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

using namespace std;
const int N = 1000 * 1000 + 1;
long long ans = (long long)1e18;
void gen(int i, int r);
void swap(int &a, int &b);
long long d[201][201];
const int inf = 1e9 + 1;
int t[200];

int main(){
   // ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int m, r;
    cin>>m>>r;
    for(int i = 1;i <= r;i ++)cin>>t[i];
    for(int j = 0;j < 201;j ++){
        for(int i = 0;i < 201;i ++){
            if(i!=j)d[i][j] = inf;else d[i][j] = 0;
        }
    }
    for(int i = 0;i < m;i ++){
        int x, y, c;
        cin>>x>>y>>c;
        if(x != y){
            d[x][y] = c;
            d[y][x] = c;
        }
    }
    for (int k=1; k<=n; ++k)
        for (int i=1; i<=n; ++i)
            for (int j=1; j<=n; ++j)
                d[i][j] = min (d[i][j], d[i][k] + d[k][j]);
    //R = r;
    gen(1, r);
    cout<<ans;
    return 0;
}

void gen(int i, int r) {
    if(i == r){
        long long s = 0;
        for(int k = 1;k < r;k ++){
            s += d[t[k]][t[k + 1]];
        }
        ans = min(ans, s);
        return;
    }
    for(int k = i;k <= r;k ++){
        swap(t[k], t[i]);
        gen(i + 1, r);
        swap(t[k], t[i]);
    }
    return;
}

void swap(int &a, int &b){
    int c = a;
    a = b;
    b = c;
    return;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#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++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin>>n>>k;
  int min=1e9+7;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  rep(i,n)chmin(min,a[i]);
  cout<<(n-2)/(k-1)+1<<endl;
  return 0;

}


Measured memory_bytes: 640
n = gets.to_i
ps = []
n.times do
  x,y = gets.chomp.split.map(&:to_i)
  ps << [x,y]
end

result = 0.0;
(0...n).to_a.permutation.each do |per|
  per.each_cons(2) do |a,b|
    aa = ps[a]
    bb = ps[b]
    result += Math::sqrt((aa[0] - bb[0])**2 + (aa[1] - bb[1])**2)
  end
end

result /= ((1..n).inject(&:*))

puts result


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

using namespace std;

int main(){

    vector<int> a(5);
    int k;

    cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3) >> a.at(4) >> k;

    for(int i = 0; i < 5; i++){
	for(int j = i + 1; j < 5; j++){
	    if(a.at(j) - a.at(i) > k){
		cout << ":(" << endl;
		return 0;
	    }
	}
    }
    cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int ans=1,m=0,c=0;
	for(int i=1;i<=n;i++){
		c=__builtin_ctz(i);
		if(c>m){
			ans=i;
			m=c;
		}
	}
	printf("%d",ans);
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;

#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)

#define STRESS 0
using lint = long long;

void solve(istream& cin, ostream& cout) {
    int n;
    cin >> n;
    vector<int> a(n);
    lint s = 0;
    rep(i, 0, n) {
        cin >> a[i];
        s += a[i];
    }
    lint ans = 1e18;
    lint q = 0;
    rep(i, 0, n - 1) {
        q += a[i];
        s -= a[i];
        ans = min(ans, abs(s - q));
    }
    cout << ans;
}

int main() {
#if !defined(JLOCAL) || !STRESS
#ifdef JLOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve(cin, cout);
#else
    srand();
    for (int ti = 0; ti < 100; ti++) {
        stress::gen();
        stress::stupid();
        ifstream in("input.txt");
        ofstream out("output.txt");
        solve(in, out);
        out.flush();
        stress::check();
    }
    cout << "ok" << endl;
#endif
    return 0;
}


Measured memory_bytes: 1024
from collections import Counter

N = int(input())
S = input()

count_E = Counter(S)['E']
count_W = Counter(S)['W']

right = 0
left = count_E
tmp = N
for i in range(N):
    if S[i] == 'E':
        left -= 1
    if right + left < tmp:
        tmp = right + left
    if S[i] == 'W':
        right += 1
print(tmp)

Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, cnt = 1, buf, a, base = 1;
  bool det;
  cin >> n >> buf;
  for(int i=1;i<n;i++){
    cin >> a;
    if(buf == a) {
      base++;
      continue;
    }
    if(i == base){
      det = buf < a;
    }else if((buf < a) != det){
      cnt++;
      det = (buf < a);
      base = i+1;
    }
    buf = a;
  }
  cout << cnt << endl;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

const int mod = 998244353;
struct mint {
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    lint N, K;
    cin >> N >> K;
    vector<lint> L(K), R(K);
    rep(i, K) { cin >> L[i] >> R[i]; }

    vector<mint> cnt(N + 3, 0);
    cnt[1] = 1;

    for (int i = 1; i < N + 1; i++) {

        for (int k = 0; k < K; k++) {
            int left = i + L[k], right = min(N + 1, i + R[k]);
            if (N < left) { continue; }
            cnt[left] += cnt[i];
            cnt[right + 1] -= cnt[i];
        }

        cnt[i + 2] += cnt[i + 1];
    }

    cout << cnt[N].x << endl;

    return 0;
}

Measured memory_bytes: 4816
n,m=map(int,input().split())
h=list(map(int,input().split()))
data=[[] for _ in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  data[a-1].append(b-1)
  data[b-1].append(a-1)
ans=0
for i in range(n):
  for j in data[i]:
    if h[i]<=h[j]:
      break
  else:
    ans+=1
print(ans)

Measured memory_bytes: 93000
use proconio::input;

fn main() {
    input!(n: i32);
    match n % 10 {
        2 | 4 | 5 | 7 | 9 => println!("hon"),
        0 | 1 | 6 | 8 => println!("pon"),
        _ => println!("bon")
    }
}

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

int main(){
    int a,b;
    string op;
    cin>>a>>op>>b;
    while(op!="?"){
        if(op=="+")cout<<a+b<<endl;
        else if(op=="-")cout<<a-b<<endl;
        else if(op=="*")cout<<a*b<<endl;
        else cout<<a/b<<endl;
        cin>>a>>op>>b;
    }
}


Measured memory_bytes: 3140
import java.util.Scanner;
class Main{
    final static int  MAX_N = 1500;
    static int[][] memorry = new int[MAX_N][MAX_N];
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int n;

	n = scan.nextInt();
	for(int i=0; i<n; i++){
	    char[] str1 = scan.next().toCharArray();
	    char[] str2 = scan.next().toCharArray();
	    solve(str1, str2);
	}
    }

    static void solve(char[] str1, char[] str2){
	for(int i=0; i<MAX_N; i++){
	    for(int j=0; j<MAX_N; j++){
		memorry[i][j]=0;
	    }
	}
	for(int i=0; i<str1.length; i++){
	    for(int j=0; j<str2.length; j++){
		if(str1[i]==str2[j])memorry[i+1][j+1]=memorry[i][j]+1;
		else memorry[i+1][j+1]=Math.max(memorry[i][j+1], memorry[i+1][j]);
	    }
	}
	System.out.println(memorry[str1.length][str2.length]);
    }
}

Measured memory_bytes: 21000
import java.util.*;
class Main {
  public static void main (String[] args) throws Exception {
    
    Scanner sc = new Scanner(System.in);
    
    String s=sc.next();
    int ans =0;
    
    for(int i=0; i<s.length(); i++){
      char c =s.charAt(i);
      if (c=='2')ans++;
      }
    
    System.out.println(ans);

  }
}

Measured memory_bytes: 21204
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,pre;
	string s,ans;
	cin>>n;
	while(n--){
		cin>>s;
		ans=s[0];
		for(int i=1;i<s.size();i++){
			if(!isalpha(s[i])){
				if(s[i]=='-')
					pre=1;
				else
					pre=0;
				i++;
			}
			else{int j;
				for(j=0;j<ans.size();j++)
					if(ans[j]==s[i])
						break;
				if(j==ans.size()){
					if(pre==0)
						ans=s[i]+ans;
					else
						ans=ans+s[i];
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var s = Console.ReadLine();
        bool ok = true;

        for (int i = 0; i < s.Length; i++)
        {
            if (i % 2 == 0)
            {
                if (s[i] == 'L')
                {
                    ok = false;
                    break;
                }
            }
            else
            {
                if (s[i] == 'R')
                {
                    ok = false;
                    break;
                }
            }
        }


        Console.WriteLine(ok ? "Yes" : "No");
    }
}

Measured memory_bytes: 13140
import sys


def input():
    return sys.stdin.readline().rstrip()


def tc():
    N = int(input())



def main():
    N = int(input())

    dp = [0]*(N+1)
    rt = int(N **0.5) +1
    for i in range(1,rt):
        ii = i**2
        for j in range(1,rt):
            jj = j**2
            if ii + jj + 1 + i*j + i + j  >N:
                break
            for k in range(1,rt):
                kk = k**2
                case =int( ii + jj + kk + i*j + i*k + j*k )
                if case <=N:
                    dp[case] +=1
                else:
                    break

    for l in range(1,N+1):
        print(dp[l])










if __name__ == "__main__":
    main()


Measured memory_bytes: 68752
#include <stdio.h>
#define N 100000

int bs(int key);

int n;
int s[N];
int main(){

  int key,count=0;
  int i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(bs(key)==1) count++;
  }
  printf("%d\n",count);
  return 0;
}

int bs(int key){
  int left=0,right=n,mid;
  while(left<right){
    mid=(left+right)/2;
    if(key==s[mid]) return 1;
    if(key>s[mid]) left=mid+1;
    else if(key<s[mid]) right=mid;
  }
  return 0;
}

Measured memory_bytes: 988
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll a,b,c,d,e,f,g;
    cin >> a >> b >> c >> d >> e >> f >> g;

    ll res1 = 0;
    if(a > 0 and d > 0 and e > 0){
        res1 += 6;
        res1 += (a-1)/2*4 + b*2 + (d-1)/2*4 + (e-1)/2*4;
    }
    ll res2 = a / 2 * 4 + b * 2 + d / 2 * 4 + e / 2 * 4 + min({a%2,d%2,e%2}) * 6;

    cout << max(res1,res2) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    int main() {
        unsigned long long sum=0;
        int n,m,a[200005]={0};
        string s;
        cin>>n;
        for(int i=1;i<n;i++){
            cin>>m;
            a[m]++;
        }
        for(int i=1;i<=n;i++){
            printf("%d\n",a[i]);
        }
    	return 0;
    }

Measured memory_bytes: 4508
N = int(input())
S = input()

a = S[1:].count('E')
W = 0
E = a
for i in range(1, N):
    if S[i - 1] == 'W':
        W += 1
    if S[i] == 'E':
        E -= 1
    a = min(W + E, a)

print(a)


Measured memory_bytes: 3668
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pf push_front
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

ll mod = 1e9+7;
ll a,B,R,t=2005;
vec<vec<ll>> dp;

int main() {
    fast;
    dp = vec<vec<ll>>(t, vec<ll>(t));
    dp[0][0] = 1;
    for(ll q=1; q<t; q++){
        for(ll w=1; w<=q; w++){
            dp[q][w] = dp[q-1][w]+dp[q-1][w-1];
            dp[q][w]%=mod;
        }
    }
    cin>>a>>B;
    R = a-B;
    for(ll q=1; q<=B; q++){
        ll o = dp[B][q]*(dp[R][q-1]+dp[R][q+1]+dp[R][q]*2);
        cout<<o%mod<<endl;
    }

}

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

int main() {
  int n,q;
  cin >> n >> q;
  vector<char>s(n);
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> s.at(i);
    if(i != 0){
      if(s.at(i-1) == 'A' && s.at(i) == 'C'){
        for(int j = i-1;j < n;j++){
          data.at(j)++;
        }
      }
    }
  }
  for(int i = 0;i < q;i++){
    int l,r;
    cin >> l >> r;
    if(l == 1){
      cout << data.at(r-2) << endl;
    }
    else{
      cout << data.at(r-2)-data.at(l-2) << endl;
    }
  }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())
#define bit(i) (1LL<<i)
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

const LLI mod = 998244353;

LLI power(LLI n, LLI p, LLI m){
  LLI ret = 1;
  while(p>0){
    if(p&1) (ret *= n) %= m;
    (n *= n) %= m;
    p /= 2;
  }
  return ret;
}

LLI mod_inv(LLI n, LLI p){return power(n,p-2,p);}

template <LLI mod> class Combination{
public:
  vector<LLI> facto = {1};
  vector<LLI> ifacto = {1};

  LLI factorial(LLI i){
    if(i < 0) throw exception();
    if(facto.size() <= i) facto.resize(i+1, -1);
    if(i == 0) return facto[0] = 1;
    LLI j = i;
    for(;j>=0;--j) if(facto[j] != -1) break;
    for(LLI k=j+1; k<=i; ++k) (facto[k] = facto[k-1] * k) %= mod;
    return facto[i];
  }

  LLI factorial_inverse(LLI i){
    if(i < 0) throw exception();
    if(ifacto.size() <= i) ifacto.resize(i+1, -1);
    if(ifacto[i] != -1) return ifacto[i];
    return ifacto[i] = mod_inv(factorial(i), mod);
  }

  LLI P(LLI n, LLI k){
    if(n < k or n < 0 or k < 0) return 0;
    return (factorial(n) * factorial_inverse(n-k)) % mod;
  }

  LLI C(LLI n, LLI k){
    if(n < k or n < 0 or k < 0) return 0;
    return (P(n,k) * factorial_inverse(k)) % mod;
  }

  LLI H(LLI n, LLI k){
    return C(n+k-1, k);
  }
};


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

  Combination<mod> com;

  LLI N,A,B,K;
  while(cin >> N >> A >> B >> K){

    LLI ans = 0;
    
    FORE(i,0,N){
      if((K-A*i)%B==0){
	int j = (K-A*i)/B;

	(ans += com.C(N,i) * com.C(N,j) % mod) %= mod;
      }
    }

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


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

using namespace std;
const int N = 1e5 + 5;

int a[N];
int n;

int main()
{
  cin >> n;
  for (int i=0; i<n; i++) cin >> a[i];
  sort(a,a+n);
  cout << a[n/2] - a[n/2 - 1];
  return 0;
}

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

int mod;

long long int l[20];

long long int cnt[20];
long long int shift[20];
long long int mp(long long int a,long long int b){
	a%=mod;
	long long int res=1;
	while(b){
		if(b&1)
			res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
long long int f(long long int n,long long int k){
	if(n==0)	return 1;
	long long int res=f((n-1)/2,k);
	res=(res+res*mp(mp(10,(n+1)/2),k))%mod;
	if(n%2==0)
		res=(res+mp(mp(10,n),k))%mod;
	return res;
}

long long int g(long long int n,long long int k){
	if(n==0)	return 0;
	long long int res=g((n-1)/2,k);
	res=(res+res*mp(mp(10,(n+1)/2),k))%mod;
	res=(res+(n+1)/2%mod*mp(mp(10,(n+1)/2),k)%mod*f((n-1)/2,k))%mod;
	if(n%2==0)
		res=(res+n%mod*mp(mp(10,n),k)%mod)%mod;
	return res;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long int L,A,B;
	cin>>L>>A>>B>>mod;
	for(int i=0;i<=18;i++){
		long long int x=1;
		for(int j=0;j<i;j++)
			x*=10;
		long long int lo=0,hi=L;
		while(lo<hi){
			long long int mid = (lo+hi)/2;
			if(A+B*mid>=x)
				hi=mid;
			else
				lo=mid+1;
		}
		l[i]=lo;
	}
	for(int i=1;i<=18;i++)
		cnt[i]=l[i]-l[i-1];
	shift[18]=1;
	for(int i=17;i>=1;i--)
		shift[i]=mp(mp(10,cnt[i+1]),i+1)%mod;
	long long int ans=0;
	long long int d = -1;
	for(int i=1;i<=18;i++){
		d+=cnt[i];
		long long int n = cnt[i];
		if(cnt[i]==0){
			ans=ans*shift[i]%mod;
			continue;
		}
		ans=(ans+(A%mod+B%mod*d%mod)%mod*f(n-1,i))%mod;
		long long int tmp=B%mod;
		tmp=tmp*g(n-1,i)%mod;
		ans=(ans-tmp+mod)%mod;
		ans=ans*shift[i]%mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define rev reverse
#define all(x) x.begin(), x.end()
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define endl '\n'
#define ull unsigned long long
#define sz(x) (int)x.size()

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

const ll inf = 1e9+7;
const ll N = 1e5+1;
const ll mod = 1e9+7;
const ll P = 31;

int main() {
    IOS
    ll n, k;
    cin >> n >> k;
    vector<ll> cnt(n+1,0);
    while(k--) {
        ll m;
        cin >> m;
        for(int i = 1; i <= m; i++) {
            ll x;
            cin >> x;
            cnt[x]++;
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++) {
        if(cnt[i] == 0)
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3660
import sys
input = sys.stdin.readline

n,m,q= map(int, input().split())
a= [list(map(int, input().split())) for i in range(m)]
b= [list(map(int, input().split())) for i in range(q)]


# ２次元累積和
c=[[0]*(n+1) for i in range(n+1)]
for i,j in a:
    c[i][j]+=1

for i in range(1,n+1):
    for j in range(1,n+1):
        c[i][j] += c[i - 1][j]+c[i][j - 1]-c[i-1][j-1]

for i,j in b:
    ans=c[j][j]-c[i-1][j]-c[j][i-1]+c[i-1][i-1]
    print(ans)

Measured memory_bytes: 77056
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        string s;
        cin >> s;
        if(s == "#")
            return 0;
        int n = s.size();

        int i = 0;
        bool ret = false;
        while(i < n){
            vector<bool> tilde(3, false);
            vector<string> t(3);
            bool b = true;
            for(int j=0; j<3; ++j){
                ++ i;
                if(s[i] == '~'){
                    tilde[j] = true;
                    ++ i;
                }
                while(s[i] != '&' && s[i] != ')'){
                    t[j] += s[i];
                    ++ i;
                }
                for(int k=0; k<j; ++k){
                    if(t[j] == t[k] && tilde[j] != tilde[k])
                        b = false;
                }
            }
            if(b){
                ret = true;
                break;
            }

            i += 2;
        }

        if(ret)
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}

Measured memory_bytes: 904
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<map>
#include<set>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = (n-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int n; cin >> n;
    map<string, int> used;
    char last;
    rep(i, n){
        string w; cin >> w;
        used[w]++;
        if(used[w] >= 2){
            cout << "No" << endl;
            return 0;
        }
        if(i >= 1){
            if(last != w[0]){
                cout << "No" << endl;
                return 0;
            }
        }
        last = w[w.size() - 1];
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 888
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch

#include<bits/stdc++.h>

using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}

char a[9][9];
int main()
{
    ios_base::sync_with_stdio(0);
    ll n;
    cin>>n;
    ll ara[n];
    ll mx=-11111111111;
    ll sum=0;
    for(int i=0;i<n;i++)
    {
         cin>>ara[i];
         sum+=ara[i];
         mx=max(mx,ara[i]);

    }
     sum-=mx;
     if(sum>mx)
        cout<<"Yes\n";
     else
        cout<<"No\n";
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <climits>
using namespace std;

bool comp(pair<int, string> a, pair<int, string> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}

long int jou(long int x, long int y){
    long int f = 1;
    for(int i = 0; i < y; ++i){
        f = f * x % int(powl(10,9) + 7);
    }

    return f;
}

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

    for(int i = 0; i < s.size(); ++i){
        if(s[i] == ',')
            cout << ' ';
        else
            cout << s[i];
        
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
s = str(input())
l = []
t = 0
for i in range(1,len(s)):
    if s[i] != s[i-1]:
        l.append(s[t:i])
        t = i
else:
    l.append(s[t:len(s)])


def calc(n):
    tmp = 0
    for i in range(1,n+1):
        tmp += i
    return tmp

left = 0
right = 0
ans = 0

for i,sg in enumerate(l):
    if sg[0]=='>':
        if left < len(sg):
            ans -= left
            ans += calc(len(sg))
        else:
            ans += calc(len(sg)-1)
    else:
        ans += calc(len(sg))
        left = len(sg)

print(ans)

Measured memory_bytes: 19772
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void)
{		
	int n;
	cin >> n;
	
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0) {
			cout << " " << i;
			continue;
		}
		
		int x = i;
		do {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}
		} while (x /= 10);
	}
	
	cout << endl;
	
	return 0;
}

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


void solve(){
    int n, a, b, c;
    cin >> n;

    vector<vector<int>> act; 
    for(int i = 0; i < n; i++){
        cin >> a >> b >> c;
        act.push_back({a, b, c});
    }

    int swim = act[0][0], bugs = act[0][1], home = act[0][2];
    for(int i = 1; i < n; i++){
        int tmp1 = swim, tmp2 = bugs;
        swim = max(bugs, home) + act[i][0];
        bugs = max(tmp1, home) + act[i][1];
        home = max(tmp1, tmp2) + act[i][2];
    }

    cout << max(swim, max(bugs, home));

}


int main(){
    solve();
}

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

int main(){
  int N, K;
  string S;
  cin >> N >> S >> K;
  char mozi = S[K-1];
  char ast = '*';
  for(int i=0; i<N; i++){
    if(S[i] != mozi) S[i] = ast;
  }
  cout << S <<endl;
  return 0;
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

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

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    int n; cin >> n;
    vector<int> X(n);
    vector<int> Y(n);
    set<P> st;
    rep(i, n) {
        cin >> X[i] >> Y[i];
        st.insert(P(X[i], Y[i]));
    }
    int ans = 0;
    rep(i, n) {
        rep(j, n) {
            if(i == j) continue;
            P p = P(X[i] - X[j], Y[i] - Y[j]);
            int cnt = 0;
            rep(k, n) {
                P q = P(p.first + X[k], p.second + Y[k]);
                if(st.count(q)) cnt++;
            }
            ans = max(ans, cnt);
        }
    }
    cout << n - ans << endl;
}


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

int main(){
	double r,pai,s,l;
	pai = 3.141592653589793
		;
	cin >> r;
	s = r * r * pai;
	l = 2 * r * pai;
	printf("%f %f\n",s,l);
	return 0;
}

Measured memory_bytes: 1232
// B: Chocolate
"use strict";

const DEBUG_MODE = false;
const rawInput = DEBUG_MODE
  ? "5\n30 44\n26\n18\n81\n18\n6"
  : require("fs")
      .readFileSync("/dev/stdin", "utf8")
      .trim();

const process = inputRaw => {
  const inputs = inputRaw.split("\n");
  const participantCount = parseInt(inputs[0]);

  const trainingCampMetadata = inputs[1].split(" ");
  const dayCount = parseInt(trainingCampMetadata[0]);
  const remainingChocolateCount = parseInt(trainingCampMetadata[1]);

  const participantConsumptionList = inputs
    .slice(2, participantCount + 2)
    .map(item => parseInt(item));

  console.log(
    participantConsumptionList.reduce(
      (acc, curr) =>
        acc + Math.floor(dayCount / curr) + (dayCount % curr === 0 ? 0 : 1),
      remainingChocolateCount
    )
  );
};

process(rawInput);


Measured memory_bytes: 7372
#include <iostream>

using namespace std;

int main()
{
    char c;
    bool a = false, b = false;

    while ((cin >> c)) {
        if (c == 'A') {
            a = true;
        }
        if (c == 'B') {
            b = true;
        }
    }
    if (a && b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
/**
 *    author:  yoseph
 *    created: 08.09.2020 23:31:00      
**/
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int d,t,s;
	cin >> d >> t >> s;
	int cost = d / s + (d % s == 0 ? 0 : 1);
	cout << (cost <= t ? "Yes" : "No");
	return 0;
}


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

long long Pow(long long x, long long y) {
	if (y == 0) return 1;
	if (y % 2 == 0) {
		long long z = Pow(x, y / 2);
		return z * z;
	}
	return x * Pow(x, y - 1);
}

int main() {
	long long N, K, A, Dig[40] = {}, KDig[40] = {}, ans = 0;
	cin >> N >> K;
	for (int i = 0; i < 40; i++) {
		if (K % 2 == 1) KDig[i] = 1;
		K /= 2;
	}
	for (int i = 0; i < N; i++) {
		cin >> A;
		ans += A;
		for (int j = 0; j < 40; j++) {
			if (A % 2 == 1) Dig[j]++;
			A /= 2;
		}
	}
	for (int i = 39; i >= 0; i--) {
		if (KDig[i] == 0) continue;
		long long count = 0;
		for (int j = 39; j > i; j--) {
			if (KDig[j] == 0) count += Dig[j] * Pow(2, j);
			else count += (N - Dig[j]) * Pow(2, j);
		}
		count += Dig[i] * Pow(2, i);
		for (int j = i - 1; j >= 0; j--) {
			count += max(Dig[j], N - Dig[j]) * Pow(2, j);
		}
		ans = max(ans, count);
	}
	long long count = 0;
	for (int i = 0; i < 40; i++) {
		if (KDig[i] == 0) count += Dig[i] * Pow(2, i);
		else count += (N - Dig[i]) * Pow(2, i);
	}
	ans = max(ans, count);
	cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<queue>
#define INF 2000000
using namespace std;
typedef long long ll;//声明// 
vector<ll>Q[205]; 
int main()
{  ll n,sum=0,i,j,k,q,t;
   cin>>n;
    for(i=1;i<=n;i++)
    Q[i].clear();
   for(i=1;i<=n;i++)
   {   t=sqrt(i);
      for(j=1;j<=n;j++)
      {  if(i%j==0)
          Q[i].push_back(j);
          
	  }
       
   }
  
   for(i=1;i<=n;i++)
   {  for(j=1;j<=n;j++)
       { for(k=1;k<=n;k++)
          {     t=0;
		      for(q=Q[i].size()-1;q>=0;q--)
		        {  if(j%Q[i][q]==0&&k%Q[i][q]==0)
		             {  sum+=Q[i][q];
		                  break;
					 }
				}
		  }
	   }
}
    cout<<sum<<endl;
}

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

int main(){
  string s;
  int n[4] = {0,0,0,0};
  int mx=300;

  cin>> s;
  for( unsigned int i=0;i<s.length();i++ ){
    switch( s[i] ){
    case 'K': ++n[0]; break;
    case 'U': ++n[1]; break;
    case 'P': ++n[2]; break;
    case 'C': ++n[3]; break;
    }
  }
  for( int i=0;i<4;i++ )
    mx=min( mx,n[i] );

  cout << mx << endl;;

  return 0;
}

Measured memory_bytes: 0
n,x,y = map(int,input().split())

li = [0]*n
x,y = x-1,y-1

for i in range(n-1):
    for j in range(i+1,n):
        ans = min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))
        li[ans] += 1
print(*li[1:],sep = '\n')

Measured memory_bytes: 3444
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, M, X = map(int, rl().split())
    C, A = [0] * N, [[] for _ in range(N)]
    for i in range(N):
        C[i], *Ai = map(int, rl().split())
        A[i] = Ai
    
    ans = 10 ** 18
    for s in range(1 << N):
        b = [0] * M
        c = 0
        for i in range(N):
            if s >> i & 1:
                c += C[i]
                for j in range(M):
                    b[j] += A[i][j]
        flg = True
        for i in range(M):
            if b[i] < X:
                flg = False
                break
        if flg:
            ans = min(ans, c)
    print(ans if ans != 10 ** 18 else -1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 68396
import numpy as np


def main():
    S = int(input())
    MOD = 10**9 + 7

    dp = np.zeros((S+1,), dtype=int)
    dp[3:] = 1

    for i in range(3, S):
        for j in range(3, S-i+1):
            dp[i+j] += dp[i]
            dp[i+j] %= MOD
    print(dp[S])


if __name__ == "__main__":
    main()

Measured memory_bytes: 26620
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

string toUpper (string s) {
    string t = s;
    for (int i = 0; i < s.size(); i++) {
        t[i] = toupper (s[i]);
    }
    return t;
}

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

    int cnt = 0;
    while (1) {
        cin >> t;
        if (t == "END_OF_TEXT") break;
        t = toUpper (t);
        if (s == t) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

public class Test {
  struct city{
  public int sector;
  public int year;
  public int index;
  public city(int s,int y,int i)
{
sector =s;
year =y;
index=i;
}
  }
  public static void Main () {
    int n, m; {
      var ins = Console.ReadLine ().Split (' ').Select (s => int.Parse (s)).ToArray ();
      n = ins[0];
      m = ins[1];
    } {
      var ins = new city[m];
      for (int i = 0; i < m; i++) {
        var ins2 = Console.ReadLine ().Split (' ').Select (s => int.Parse (s)).ToArray ();
        ins[i] = new city(ins2[0],ins2[1],i);
      }
{
int[] sectC = new int[n];
     Array.Sort(ins,(v,w)=>v.year-w.year);
var ins3 = ins.Select((v,i)=>new {index=v.index,str=v.sector.ToString("D6")+(++sectC[v.sector-1]).ToString("D6")}).ToArray();
Array.Sort(ins3,(v,w)=>v.index-w.index);
Array.ForEach(ins3,v=>
Console.WriteLine(v.str));
}
    }
  }
}

Measured memory_bytes: 32884
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <list>

using namespace std;

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

set<int> st;

int main()
{
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);
	int a, b, k;
	cin >> a >> b >> k;
	for(int i = a; i <= a+k-1; i++)
		st.insert(i);	
	for(int i = b-k+1; i <= b; i++)
		st.insert(i);
	for(auto it : st)
		if(it <= b && it >= a)
			cout << it << "\n";
}





Measured memory_bytes: 256