akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt() {return Integer.parseInt(s.next());}
	static long gLong() {return Long.parseLong(s.next());}

	public static void main(String[]$){
		char[]c=s.next().toCharArray();
		int n=c.length;
		int[]rem=new int[n];
		int res=0,rem_=0;
		for(int i=0;i<n;++i) {
			if(c[i]=='g') {
				++rem_;
			} else {
				if(rem_>0) {
					--rem_;
				}else {
					++res;
				}
			}
			rem[i]=rem_;
		}
		System.out.println(res+rem[n-1]/2);
	}
}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
main(){
int h,w;
while(cin>>h>>w&&(h!=0&&w!=0)){
  for(int i=0;i<h;i++){
    cout<<"#";
    for(int j=2;j<w;j++){
      if(i!=0&&i!=h-1)cout<<".";
      else cout<<"#";
    }
    cout<<"#"<<endl;
  }
  cout<<endl;
}
return 0;
}



Measured memory_bytes: 3056
#include<stdio.h>

int main(){
	
	//準備部分
	char ch;
	
	//入力・変換・出力部分
	while(1){
		scanf("%c",&ch);
		if(ch>='A' && ch<='Z')ch+=32;
		else if(ch>='a' && ch<='z')ch-=32;
		printf("%c",ch);
		if(ch=='\n')break;
	}
	
	return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  rep(i, (m+1)/2)
    cout << i+1 << ' ' << n-i << '\n';
  for (int i = (m+1)/2; i < m; i++)
    cout << i+1 << ' ' << i+1+(m-i)*2 << '\n';
  return 0;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
const int N = 1e5 + 5;
const int mod = 1e9 + 7; 
using namespace std;

int n, m, a, b, fac[N << 1], inv[N << 1], ans; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int fpow(int x, int y)
{
	int res = 1;
	for( ; y; y >>= 1, x = 1ll * x * x % mod)
		if(y & 1) res = 1ll * res * x % mod;
	return res; 
}

int C(int n, int m)
{
	if(n < m || n < 0 || m < 0) return 0;
	return 1ll * fac[n] * inv[m] % mod * inv[n - m] % mod; 
}

int main()
{
	n = read <int> (), m = read <int> (), a = read <int> (), b = read <int> ();
	for(int i = (fac[0] = 1); i <= n + m; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
	inv[n + m] = fpow(fac[n + m], mod - 2);
	for(int i = n + m - 1; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
	for(int i = 1; i <= a; i++)
		ans = (1ll * C(b - 1 + n - i, b - 1) * C(m - b - 1 + i - 1, i - 1) + ans) % mod;
	ans = (C(n + m - 2, n - 1) - ans + mod) % mod;
	printf("%d\n", ans); 
	return 0; 
}


Measured memory_bytes: 4788
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

class color{
public:
	int r,g,b;
	string name;
	color(int x,int y,int z){r=x;g=y;b=z;}
	color(string s,int x, int y, int z){name = s; r=x; g=y; b=z;}

	double dist(const color arg){
		return sqrt(pow(abs(r - arg.r),2) +
				pow(abs(g - arg.g),2) +
				pow(abs(b - arg.b),2));
	}
};

int c2d(char c){
	if('a' <= c && c <= 'f'){
		return c - 'a' + 10;
	}else{
		return c - '0';
	}
}

int main(void){
	string str;
	vector<color> co;
	co.push_back(color("black",0,0,0));
	co.push_back(color("blue",0,0,255));
	co.push_back(color("lime",0,255,0));
	co.push_back(color("aqua",0,255,255));
	co.push_back(color("red",255,0,0));
	co.push_back(color("fuchsia",255,0,255));
	co.push_back(color("yellow",255,255,0));
	co.push_back(color("white",255,255,255));
	while(cin >> str){
		if(str[0] == '0') break;
		int c[3] = {0,0,0};
		char tmp;
		double dist = 1 << 30;
		int index;
		for(int i=0;i<3;i++){
			c[i] += c2d(str[i*2+1]) * 16;
			c[i] += c2d(str[i*2+2]);
		}
		color arg = color(c[0],c[1],c[2]);

		for(int i=0;i<8;i++){
			double tdist = co[i].dist(arg);
			if(dist > tdist){
				dist = tdist;
				index = i;
			}
		}
		cout << co[index].name << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
#define fastio std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pii pair<int, int>
#define pll pair<ll , ll>
#define mpi make_pair
#define F first
#define S second
#define pb push_back
#define N 200005
#define INF 1000000000000000

bool dp[100005];


int main()
{   
    fastio
    
    int n, k;cin>>n>>k;
    vector<int> arr(n);
    for(int i = 0 ;i<n;i++)
    {
        cin>>arr[i];
    }

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

    for(int i = 1 ; i <=k;i++)
    {
        bool temp = true;

        for(int j =0;j<n;j++)
        {
            if(i-arr[j] <0)break;

            temp = temp&dp[i-arr[j]];
        }
        
        dp[i] = !temp;
        // cout<<dp[i]<<" ";
    }

    
    if(dp[k] == true)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
} 

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
int a[20001],b[20001]; char op[20001]; int i=0;
    while (1) {
    scanf("%d %c %d",&a[i],&op[i],&b[i]);
    if (op[i]=='?') break; i++;
    }

    for (i=0;1;i++)
    {
        if (op[i]=='?') break;
        if (op[i]=='+') printf("%d\n",a[i]+b[i]);
        if (op[i]=='-') printf("%d\n",a[i]-b[i]);
        if (op[i]=='*') printf("%d\n",a[i]*b[i]);
        if (op[i]=='/') printf("%d\n",a[i]/b[i]);
    }

}



Measured memory_bytes: 2756
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;

int main() {
	set<int> x;

	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int flag = 0;
		cin >> flag;
		int value;
		cin >> value;
		if(flag == 0) {
			x.insert(value);
			cout << x.size() << endl;
		}
		else {
			set<int>::iterator itr = x.find(value);
			if(itr != x.end()) {
				cout << 1 << endl;
			}
			else {
				cout << 0 << endl;
			}
		}
	}

	return 0;
}




Measured memory_bytes: 12364
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 5e5 + 10;
const ll mod = 998244353;
int a, b, c;
int main() {
	scanf("%d%d%d", &a, &b, &c);
	if (b*c >= a)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
    int N, sum = 0;
    cin >> N;
    vector<int> a(N);
    for (auto& i : a) {
        cin >> i;
        sum += i;
    }
    int ans = a.size() - 1, min = 100;
    for (int i = ans; i >= 0; i--) {
        int d = abs(sum - N * a[i]);
        if (d <= min) {
            min = d;
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;

int main(void){
	int N,a[3000],Sum=0,max=0,i,j;
	cin >> N;
	for(i=0;i<N;i++){
		cin >> a[i];
	}
	for(i=0;i<N;i++){
		Sum=Sum+a[i];
	}
	max=Sum-N;
	cout << max << endl;
}

Measured memory_bytes: 256
<>;@D=(1)x2e6;$==1e9+7;$s=.5;($x^=$_)?($P[$x]+=($D[$x]+=$P[$x]*($%-$c[$x]))%=$=)%=$=:($%++,$s=$s*2%$=),$c[$x]=$%for split$",<>;$s+=$_ for@P;print$x?$D[$x]:$s%$=

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;

    cout << n * n << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max_first = 0;
    int max_second = 0;
    int[] a = new int[n];
    for(int i=0; i<n; ++i){
      a[i] = sc.nextInt();
      if(max_first<=a[i]) {
        max_second=max_first;
        max_first=a[i];
      }
      if(max_first>a[i] && max_second<=a[i]) {
        max_second=a[i];
      }
    }
    for(int ii:a) {
      if(ii!=max_first)
        System.out.println(max_first);
      else if(ii!=0)
        System.out.println(max_second);
    }
  }
}

Measured memory_bytes: 92780
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    ll K; cin >> K;
    for(int t = 0; t < K;t++){
        ll a,b; cin >> a >> b;
        if(a*2 > N) a = N - a + 1;
        if(b*2 > N) b = N - b + 1;
        
        if(a < b) swap(a,b);
        if(b%3 == 1){
            cout << 1 << endl;
        }else if(b%3 == 2){
            cout << 2 << endl;
        }else{
            cout << 3 << endl;
        }
    }
    return 0;
}

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

int main() {
	int x, y;
	cin >> x >> y;
	set<int>a = { 4,6,9,11 };
	if (x == 2 || y == 2)cout << "No" << endl;
	else if (a.count(x) && a.count(y))cout << "Yes" << endl;
	else if (!a.count(x) && !a.count(y))cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <math.h>
using namespace std;

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}

bool sosu(ll p){
    bool ans = true;
    double psqrtd = pow(p, 0.5);
    ll psqrt = psqrtd;
    for(ll i = 2; i <= psqrt; i++){
        if(p%i==0)ans = false;
    }
    if(p==1)ans = false;
    return ans;
}



int main(void){
    ll ans = 0;
    ll n;
    cin >> n;
    ll k;
    cin >> k;
    int s[n];
    for(ll i=0;i<n;i++){
        char x;
        cin >> x;
        if(x=='L')s[i]=0;
        else s[i]=1;
    }
    
    for(ll i=1;i<n;i++){
        if(s[i-1]==s[i])ans++;
    }
    ll o = n-ans;
    for(ll i=0;i<k;i++){
        if((n-ans)!=2&&(n-ans)!=1)ans+=2;
        else if((n-ans)==2)ans++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include<math.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define PI 3.1415926535
int main()
{
	int a, b, x;
	double sum;
	cin>>a>>b>>x;
	if (2*x<=a*a*b)
	{
		double ans=2*x*1.0/(a*b);
		double t=b/ans;
		sum= 180*atan(b/ans)/PI;
	}
	else
	{
		double h = x*1.0 / (a*a);
		double c = 2 * h - b;
		double s = b - c;
		sum= 180 * atan(s / a) / PI;
	}
	printf("%.6f",sum);
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), G<type>())
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく、n=10が限界(500 ms)
#define ENDL cout << endl;

const int INF = 2e9;
const LL MOD = 1e9 + 7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << a*b << endl;

  return 0;
}


Measured memory_bytes: 3548
#include <cstdio>

const int MAX = 10000;
const int NIL = -1;

struct Node {
    int parent;
    int left;
    int right;
};

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
    D[u] = d;
    if (T[u].left != NIL) {
        setDepth(T[u].left, d + 1);
    }
    if (T[u].right != NIL) {
        setDepth(T[u].right, d + 1);
    }
}

int setHeight(int u) {
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL) {
        h1 = setHeight(T[u].left) + 1;
    }
    if (T[u].right != NIL) {
        h2 = setHeight(T[u].right) + 1;
    }
    return H[u] = (h1 > h2 ? h1: h2);
}

int getSibling(int u) {
    if (T[u].parent == NIL) {
        return NIL;
    }
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) {
        return T[T[u].parent].left;
    }
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) {
        return T[T[u].parent].right;
    }
    return NIL;
}

void print(int u) {
    printf("node %d: ", u);
    printf("parent = %d, ", T[u].parent);
    printf("sibling = %d, ", getSibling(u));
    int deg = 0;
    if (T[u].left != NIL) {
        deg++;
    }
    if (T[u].right != NIL) {
        deg++;
    }
    printf("degree = %d, ", deg);
    printf("depth = %d, ", D[u]);
    printf("height = %d, ", H[u]);

    if (T[u].parent == NIL) {
        printf("root\n");
    }
    else if (T[u].left == NIL && T[u].right == NIL) {
        printf("leaf\n");
    }
    else {
        printf("internal node\n");
    }
}

int main() {
    int v, l, r, root = 0;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        T[i].parent = NIL;
    }

    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &v, &l, &r);
        T[v].left = l;
        T[v].right = r;
        if (l != NIL) {
            T[l].parent = v;
        }
        if (r != NIL) {
            T[r].parent = v;
        }
    }

    for (int i = 0; i < n; i++) {
        if (T[i].parent == NIL) {
            root =i;
        }
    }

    setDepth(root, 0);
    setHeight(root);

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

Measured memory_bytes: 2724
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  string s;
  int64_t k;
  cin>>s>>k;
  
  set<char> st;
  for(auto&& e: s) {
    st.insert(e);
  }
  if(st.size()==1){
    cout<<s.size()*k/2;
    return 0;
  }

  if(s.front()!=s.back()){
    int64_t tmp=1,ans=0;
    for (int i = 1; i < s.size(); ++i)
    {
      if(s[i]==s[i-1]) tmp++;
      else {
        ans+=tmp/2;
        tmp=1;
      }
    }
    ans+=tmp/2;
    cout<<ans*k;
    return 0;
  }

  string ss=s+s;
  int64_t tmp=1,ans_ss=0,ans_s=0;
  for (int i = 1; i < ss.size(); ++i)
  {
    if(ss[i]==ss[i-1]) tmp++;
    else {
      ans_ss+=tmp/2;
      tmp=1;
    }
  }
  ans_ss+=tmp/2;
  tmp=1;
  for (int i = 1; i < s.size(); ++i)
  {
    if(s[i]==s[i-1]) tmp++;
    else {
      ans_s+=tmp/2;
      tmp=1;
    }
  }
  ans_s+=tmp/2;
  int64_t diff=ans_ss-ans_s;
  
  cout<<ans_s+diff*(k-1);
}

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

using i64 = long long;
using P = pair<i64, i64>;


void solve(std::string S, std::string T){
    cout << T + S << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache
import bisect

class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def map_int():
        return [int(x) for x in Scanner.string().split()]
    def string_list(n):
        return [input() for i in range(n)]
    def int_list_list(n):
        return [Scanner.mapInt() for i in range(n)]
    def int_cols_list(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    N,M = Scanner.map_int()
    X = M * 1900 + (N - M) * 100
    X = X * (2 ** M)
    print(X)
    return

if __name__ == "__main__":
    main()


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

int main() {

  int H, W;

  for(;;) {
    std::cin >> H >> W;
    if( H == 0 && W == 0 ) {
      break;
    }
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
	if( (i+j)%2 == 0 ) {
	  std::cout << "#";
	}
	else {
	  std::cout << ".";
	}
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 1152
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	
	ll N; cin >> N;
	N--;
	cout << N*(N+1)/2 << endl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

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


int main()
{
 int x;
 cin>>x;
 int c500 = x/500; 
 int r500 = x%500; 
 int c5 = r500/5; 
 printf("%d\n",c500*1000+c5*5);
 
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i,ans=0;
  cin >> n;
  vector<int> v(n+3,0),c(n+3,0);
  for (i=0;i<n;i++) cin >> v.at(i);
  for (i=0;i<n;i++) cin >> c.at(i);
  for (i=0;i<n;i++) if (v.at(i)>c.at(i)) ans+=v.at(i)-c.at(i);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a == b){
       printf("a == b\n");
    
    }else if (a > b) {
        printf("a > b\n");
    
    }else{
        printf("a < b\n");
    }
    return 0;
}


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

namespace CompetitiveProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB_Array = new List<TwoInt>();
            string[] n_m = Console.ReadLine().Split(' ');
            int n = int.Parse(n_m[0]);
            int m = int.Parse(n_m[1]);

            //入力を受け取る
            for (var i = 0; i < n; i++)
            {
                string[] A_B = Console.ReadLine().Split(' ');

                int a = int.Parse(A_B[0]);
                int b = int.Parse(A_B[1]);
                var ab = new TwoInt(a, b);
                AB_Array.Add(ab);
            }
            //ソートする
            AB_Array = SortTwoIntList(AB_Array);

            //foreach(var rec in AB_Array)
            //{
            //    Console.WriteLine($"{rec.A},{rec.B}");
            //}

            //計算する
            long totalPrice = 0;
            for (var i = 0; i < n; i++)
            {
                if (m - AB_Array[i].B >= 0)
                {
                    m -= AB_Array[i].B;
                    totalPrice += (long)AB_Array[i].A * (long)AB_Array[i].B;
                }
                else
                {
                    totalPrice += (long)AB_Array[i].A * (long)m;
                    break;
                }
            }
            Console.WriteLine(totalPrice);
        }
        static List<TwoInt> SortTwoIntList(List<TwoInt> list)
        {
            IOrderedEnumerable<TwoInt> sortList =
                list.OrderBy(rec => rec.A).ThenBy(rec => rec.B);

            List<TwoInt> returnValue = sortList.ToList();

            return returnValue;
        }



    }

    class TwoInt
    {
        public int A;
        public int B;

        public TwoInt(int A, int B)
        {
            this.A = A;
            this.B = B;
        }
    }
}


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

int cnt[26];
int main()
{
    string s;
    cin >> s;
    rep(i, s.length())
    {
        cnt[s[i] - 'a']++;
    }
    if (s.length() < 26)
    {
        rep(i, 26)
        {
            if (cnt[i] == 0)
            {
                s += 'a' + i;
                break;
            }
        }
        cout << s << endl;
    }
    else
    {
        for (int i = 25; i >= 0; i--)
        {
            rep(j, 26)
            {
                if (cnt[j] == 0 && j > s[i] - 'a')
                {
                    cout << s.substr(0, i) << char('a' + j) << endl;
                    return 0;
                }
            }
            cnt[s[i] - 'a'] = 0;
        }
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    vector<int> h(n, 0); for(int i = 0; i < n; i++) cin >> h[i];
    sort(h.begin(), h.end());
    int ret = INT_MAX;
    
    for(int i = 0; i < n - k + 1; i++)
    {
        auto temp = h[i+k-1] - h[i];
        ret = min(ret, temp);
    }
    
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 640
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

int main() {
    int N,M;
    cin >> N >> M;
    int pre_L,pre_R;
    int ans;
    REP(i,M) {
        int L,R; cin >> L >> R;
        if(i == 0) {
            pre_L = L;
            pre_R = R;
        } else {
            if(R < pre_L || pre_R < L) {
                ans = 0;
                cout << ans << endl;
                return 0;
            } else {
                chmax(pre_L,L);
                chmin(pre_R,R);
            }
        }
    }
    //cout << pre_L << " " << pre_R << endl;
    cout << pre_R - (pre_L - 1) << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a[5], k;

    for (int i=0; i<5; i++) cin >> a[i];
    cin >> k;

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

    cout << "Yay!" << endl;

    return 0;
}

Measured memory_bytes: 256
///////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
///////////////////////////////////////////////////////////
#define ll long long
#define ull insigned lon long
///////////////////////////////////////////////////////////
int absolute(int n);
void input(vector<int>& vec);
void print(vector<int> vec);
int sum(vector<int> vec);
void upsort(vector<int>& vec);
void downsort(vector<int>& vec);
int maxvec(vector<int> vec);
int minvec(vector<int> vec);
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int main()
{
    int n;
    cin>>n;
    vector<int>v(n);
    input(v);
    upsort(v);
    double k=v.at(0);
    for(int i=1;i<n;++i){
        k=(k+v.at(i))/2;
    }
    cout << k << endl;
    return 0;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int absolute(int n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

void input(vector<int>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cin >> vec.at(i);
    }
}

void print(vector<int> vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

int sum(vector<int> vec)
{
    int s = accumulate(vec.begin(), vec.end(), 0);
    return s;
}

void upsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end());
}

void downsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end(), greater<int>());
}

int maxvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = max(m, vec.at(i));
    }
    return m;
}

int minvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = min(m, vec.at(i));
    }
    return m;
}
///////////////////////////////////////////////////////////

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
vis = [0]*N
p = 1
Town = []

while vis[p-1] == 0:
    Town.append(p)
    vis[p-1] = 1
    p = A[p-1]

l = Town.index(p)

if K < len(Town):
    print(Town[K])
else:
    print(Town[l + (K-l)%(len(Town[l:]))])

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

int main()
{
    int h, w;
    
    while(1) {
        cin >> h >> w;
        
        if((h==0)&&(w==0)) break;
        
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                if((i == 0) || i == (h-1)) {
                    cout << '#';
                }else {
                    if((j==0) || (j==w-1)) {
                        cout << '#';
                    } else {
                        cout << '.';
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 3092
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double[][] p = new double[20][2];
		int n = 0;
		while(sc.hasNext()){
			String s[] = sc.next().split(",");
			p[n][0]=Double.parseDouble(s[0]);
			p[n][1]=Double.parseDouble(s[1]);
			n++;
		}
		double a = 0;
		for(int i=0;i<n;i++){
			double x1 = p[i][0];
			double y1 = p[i][1];
			double x2 = p[(i+1)%n][0];
			double y2 = p[(i+1)%n][1];
			a += x1*y2-x2*y1;
		}
		System.out.println(Math.abs(a/2));
		sc.close();
	}
}



Measured memory_bytes: 25904
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	put(min(n * a, b));
	return 0;
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

h,w,k = m()

po = [list(input()[:-1]) for i in range(h)]

hei = 2 ** h

wid = 2 ** w

dph = [0 for i in range(h)]

dpw = [0 for i in range(w)]
ans = 0
for i in range(hei):
	ii = str(bin(i)[2:]).zfill(h)
	#print(ii)
	for j in range(h):
		if ii[j] == "1":
			dph[j] = 1
		else:
			dph[j] = 0

	
	for j in range(wid):
		jj = str(bin(j)[2:]).zfill(w)
		#print(jj)
		for ii in range(w):
			if jj[ii] == "1":
				dpw[ii] = 1
			else:
				dpw[ii] = 0

		co = 0
		for ii in range(h):
			for jj in range(w):
				if dph[ii] or dpw[jj]:
					continue
				elif po[ii][jj] == "#":
					co += 1
		if co == k:
			ans += 1
print(ans)




Measured memory_bytes: 69332
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

const ll MAX = 510000;

ll fac[MAX], finv[MAX], inv[MAX];

void init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i = 2; i < MAX; i++){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

// n! * k!^(-1) * ((n - k)!)^(-1)
ll comb(ll n, ll k) {
  
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k]* finv[n - k] % MOD) % MOD;
}


int main() {
  int n;
  int left, right;

  cin >> n;
  vector<ll> a(n+1);
  map<ll,ll> mp;

  rep(i, n + 1) {
    cin >> a[i];
    if (mp[a[i]] != 0) {
      right = i + 1;
      left = mp[a[i]];
    } else {
      mp[a[i]] = i + 1;
      // debug(mp[a[i]]);
    }
  }
  
  init();
  for (int i = 1; i <= n + 1; ++i) {
    ll all = comb(n + 1, i);
    ll diff = comb(left - 1 + n + 1 - right, i - 1);
    // debug(left - 1 + n + 1 - right);

    cout << (all - diff + MOD) % MOD << endl;
  }
}


Measured memory_bytes: 20224
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>
 
using namespace std;
 
#define mod 1000000007
 
int n, m;
int a[301][301];
 
int solve(set<int> s)
{
	if(s.empty()) return n;
	int cnt[301] = {};
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(s.find(a[i][j]) != s.end()){
				cnt[a[i][j]]++;
				break;
			}
		}
	}
	int maxcnt = *max_element(cnt, cnt + m);
	int ans = maxcnt;
	for(auto itr = s.begin(); itr != s.end(); itr++){
		if(cnt[*itr] == maxcnt){
			s.erase(*itr);
			ans = min(ans, solve(s));
            return ans;
		}
	}
}
 
int main()
{
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
			a[i][j]--;
		}
	}
 
	set<int> s;
	for(int i = 0; i < m; i++){
		s.insert(i);
	}
	cout << solve(s) << endl;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main()
{
	cin >> n >> k;
	if (n > k / 2)
	{
		ans = k / 2;
	}
	else
	{
		ans = (2 * n + k) / 4;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
using namespace std;
struct kk
{
	int mod,num;
	bool operator <(const kk &rhs) const
	{
		return num<rhs.num;
	}
}a[100010];
int i,j,k,ans[100010];
int main()
{
	scanf("%d",&k);
	for (i=1;i<=k;i++)
	{
		ans[i]=0;
		j=i;
		while (j>0)
		{
			ans[i]+=j%10;
			j/=10;
		}
	}
	ans[0]=ans[k];
	priority_queue<kk>q;
	for (i=0;i<k;i++)
	{
	  kk u;
	  u.mod=i;u.num=ans[i];
	  q.push(u);
    }
	while (!q.empty())
	{
		kk s=q.top();q.pop();
		if (s.num+1<ans[(s.mod+1)%k])
		{
			kk u;
	        u.mod=(s.mod+1)%k;u.num=s.num+1;
	        q.push(u);
			ans[(s.mod+1)%k]=s.num+1;
		}
		if (s.num<ans[s.mod*10%k])
		{
			kk u;
	        u.mod=s.mod*10%k;u.num=s.num;
	        q.push(u);
			ans[s.mod*10%k]=s.num;
		}
	} 
	printf("%d\n",ans[0]);
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Aug  2 21:38:01 JST 2020
 **/

using namespace std;
struct Mo {
    int width;
    vector<int> left, right, order;
    vector<bool> v;

    Mo(int N, int Q) : width((int)sqrt(N)), order(Q), v(N) { iota(begin(order), end(order), 0); }

    void add(int l, int r) { /* [l, r) */
        left.emplace_back(l);
        right.emplace_back(r);
    }

    template <class ADD, class DEL, class REM> void run(const ADD &add, const DEL &del, const REM &rem) {
        assert(left.size() == order.size());
        sort(begin(order), end(order), [&](int a, int b) {
            int ablock = left[a] / width, bblock = left[b] / width;
            if (ablock != bblock) return ablock < bblock;
            if (ablock & 1) return right[a] < right[b];
            return right[a] > right[b];
        });
        int nl = 0, nr = 0;
        auto push = [&](int idx) {
            v[idx].flip();
            if (v[idx])
                add(idx);
            else
                del(idx);
        };
        for (auto idx : order) {
            while (nl > left[idx]) push(--nl);
            while (nr < right[idx]) push(nr++);
            while (nl < left[idx]) push(nl++);
            while (nr > right[idx]) push(--nr);
            rem(idx);
        }
    }
};

signed main() {
    Int n, Q;
    std::cin >> n >> Q;
    std::vector<Int> a(n);
    REP(i, n) std::cin >> a[i];
    Mo mo(n, Q);
    REP(q, Q) {
        Int l, r;
        std::cin >> l >> r, l--;
        mo.add(l, r);
    }
    Int cur = 0;
    std::vector<Int> cnt(n), ans(Q);
    auto add = [&](Int i) {
        if (cnt[a[i]]++ == 0) cur++;
    };
    auto del = [&](Int i) {
        if (--cnt[a[i]] == 0) cur--;
    };
    auto rem = [&](Int i) { ans[i] = cur; };
    mo.run(add, del, rem);
    REP(q, Q) std::cout << ans[q] << "\n";
}


Measured memory_bytes: 21552
#include <iostream>
#include <math.h>
#include <string>
#include <iomanip>


using namespace std;

int main()
{
	double a;
	double L = 0;
	double total = 0;

	cin >> a;

	L = a / 3;

	total = L * L * L;

	cout << fixed << setprecision(99) << total;

	return 0;
}

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

#define ll long long


using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	int ans=0;
	for(int i=0;i<k;i++)
		ans = ans+arr[i];
	cout<<ans;
	return 0;
}

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

int main() {

  int N;
  cin >> N;

  vector<int> A(N);
  int max = 0;
  long long cnt = 0;

  for(int i = 0; i < N; i++){
    cin >> A[i];
    if(max > A[i]){
      cnt += max - A[i];
    }
    if(A[i] > max){
      max = A[i];
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3980
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args)throws Exception{
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    
    int X = (B+C-1)/B;
    int Y = (A+D-1)/D;
    System.out.println(X<=Y ? "Yes" : "No");
  }
}

Measured memory_bytes: 35752
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [b, c] <- words <$> getLine
    -- 出力
    putStrLn $ if (fromEnum (sqrt $ strToDouble (b++c))) ^ 2 == strToInt (b++c) then "Yes" else "No"


Measured memory_bytes: 508
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {

	uint N, W;
	cin >> N >> W;

	vector<pair<uint, uint>> vw(N);
	ull vsum = 0;
	ull wsum = 0;
	for(uint i=0; i<N; i++) {
		uint w, v;
		cin >> w >> v;
		vw[i] = make_pair(v, w);
		vsum += v;
		wsum += w;
	}

	sort(vw.begin(), vw.end());
	vector<vector<ull>> dp(vsum+1, vector<ull>(N+1, wsum));

	for(uint i=0; i<=N; i++) {
		dp[0][i] = 0;
	}

	ull ans = 0;

	for(uint j=vw[0].first; j<=vsum; j++) {
		for(uint i=1; i<=N; i++) {
			uint vi = vw[i-1].first;
			uint wi = vw[i-1].second;

			dp[j][i] = (j < vi) ? dp[j][i-1] : min(dp[j-vi][i-1] + wi, dp[j][i-1]);
			ans = (dp[j][i] > W) ? ans : j;
		}
	}

	cout << ans;

	return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;

  int ans = 0;
  for (int i = 1; i * i <= M; i ++) {
    if (M % i == 0) {
      if (i <= M / N) ans = max(ans, i);
      if (M / i <= M / N) ans = max(ans, M / i);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int main(){
    int n;
    scanf("%d", &n);
    if(n == 0 || n == 2){
        puts("1");
    }else if(n == 1){
        puts("2");
    }else{
        puts("0");
    }
    return 0;
}

Measured memory_bytes: 1168
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = pi * r * r;
        double length = 2 * pi * r;

        System.out.printf("%.6f %.6f\n", area, length);


    }
}


Measured memory_bytes: 28380
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << min(a,b) + min(c,d) << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
char s1[100],s2[100];
int main() {
	scanf("%s%s",s1,s2);
	int i=0,j=0;
	while (i<strlen(s1)||j<strlen(s2)) {
		if (i<strlen(s1))
			printf("%c",s1[i]);
		if (j<strlen(s2))
			printf("%c",s2[j]);
		i++; j++;
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
import java.io.*;
  
class Main {
    public static void main( String[] args ) throws IOException 
    {
        String line;
        int x;
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        line = br.readLine();
        x = Integer.parseInt( line );
        System.out.println( x*x*x );
    }
}

Measured memory_bytes: 24180
ls =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

n = int(input()) - 1
print(ls[n])

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

public class Program
{
    #region Standard I/O
    readonly TextReader input;
    readonly TextWriter output;

    X[] ReadLine<X>(Func<string, X> func)
    {
        return input.ReadLine().Split(' ').Select(func).ToArray();
    }

    void WriteLineOne(object obj)
    {
        output.WriteLine("{0}", obj);
    }

    void WriteLineMany(params object[] objects)
    {
        output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString())));
    }
    #endregion

    long p;

    long MeguruBinarySearch(long ok, long ng, Func<long, bool> isOk)
    {
        while (Math.Abs(ok - ng) > 1)
        {
            var m = (ok + ng) / 2;
            if (isOk(m))
            {
                ok = m;
            }
            else
            {
                ng = m;
            }
        }

        return ok;
    }

    bool CanReach(long t)
    {
        var x = p;
        for (var s = t; s >= 0; s--)
        {
            if (x <= s)
            {
                return true;
            }

            x -= s;
        }

        return false;
    }

    long Solve()
    {
        return MeguruBinarySearch(p, 0, CanReach);
    }

    public void Run()
    {
        p = ReadLine(long.Parse)[0];
        WriteLineOne(Solve());
    }

    public Program(TextReader input, TextWriter output)
    {
        this.input = input;
        this.output = output;
    }

    public static void Main(string[] args)
    {
        new Program(Console.In, Console.Out).Run();
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
constexpr int MX = 100005;
ll n, m, v, p, a[MX], k, ac;
int main(){
	scanf("%lld%lld%lld%lld", &n, &m, &v, &p);
	rep(i,n) scanf("%lld", a+i);
	sort(a,a+n);
	for(ll i=n-p-1; i>=0; i--){
		if(a[i]+m < a[n-p] || (i+p < v && (v-i-p)*m - ac - (a[i]+m - a[n-p]) * (n-p-i) > 0)) return 0*printf("%lld\n", n-i-1);
		ac += a[n-p] - a[i];
	}
	printf("%lld\n", n);
}

Measured memory_bytes: 1024