akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
static const int MOD = 1000000007;
static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//struct edge {int to,cost;};

int f[214514]={};
int exist[114514] = {};

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

void fact(){
    f[0] = f[1] = 1;
    FOR(i,2,214514) f[i] = (f[i-1] * i)%MOD;
}

int comb(int n,int r){
    return n<r?0:f[n]*power((f[n-r]*f[r])%MOD,MOD-2)%MOD;
}
 
signed main(){
    fact();

    int n;
    cin >> n;
    int pr,po;
    REP(i,n+1){
        int tmp;
        scanf("%lld",&tmp);
        if(exist[tmp]){
            pr = exist[tmp]-1;
            po = n-i;
        }
        exist[tmp] = i+1;
    }
    REP(i,n+1){
        printf("%lld\n",(comb(n+1,i+1)+MOD-comb(pr+po,i))%MOD);
    }
    return 0;
}



Measured memory_bytes: 3712
import qualified Data.IntMap as IM
main=print.solve=<<readLn
solve n=IM.foldr(\i s->(i+1)*s`mod`(10^9+7))1$foldr f IM.empty[2..n]
f k m=foldr(\i->IM.insertWith(+)i 1)m$g 2 k
g i k
  |k==1=[]
  |r==0=i:g i q
  |i*i>k=[k]
  |otherwise=g(i+1)k
  where(q,r)=divMod k i

Measured memory_bytes: 5068
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
	String s=sc.next();
	String c[]=new String[s.length()];
	String ans="";
	for(int i=0;i<s.length();i++) {
		c[i]=String.valueOf(s.charAt(i));
	}
	for(int i=0;i<s.length();i++) {
		if(c[i].equals("?")) {
			c[i]="D";
		}
	}
	
	for(int i=0;i<s.length();i++) {
	System.out.print(c[i]);
	}
	}
}

Measured memory_bytes: 68120
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;


int main()
{
    priority_queue<ll> pq;
    ll n,m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        ll k;
        cin >> k;
        pq.push(k);
    }
    for(int i = 0; i < m; i++){
        int dis = pq.top();
        pq.pop();
        pq.push(dis/2);
    }
    ll sum = 0;
    while(!pq.empty()){
        sum += pq.top();
        pq.pop();
    }
    cout << sum;
}

Measured memory_bytes: 1400
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt(), m = in.nextInt();

		int[] w = new int[n + 1];
		int[] a = new int[m], b = new int[m];

		for (int i = 0; i < m; i++) {
			a[i] = in.nextInt();
			b[i] = in.nextInt();
		}

		Arrays.fill(w, 0);

		for (int i = 0; i < m; i++) {
			if(a[i] != 1) {
				++w[a[i]];
			}
			if (b[i] != 1) {
				++w[b[i]];
			}
		}
		boolean judge = true;
		for (int i = 0; i < w.length; i++) {
			if (w[i] % 2 == 1) {
				judge = false;
				break;
			}
		}
		if (judge) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 65304
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N,M;
ll A[214514];
int main(){
	cin>>N;
	map<ll,int> data;
	rep(i,N){
		cin>>A[i];
		data[A[i]]++;
	}
	sort(A,A+N);
	reverse(A,A+N);
	/*rep(i,N)cout<<A[i]<<" ";
	cout<<endl;*/
	ll now=1;
	while(A[0]>=now)now*=2;
	int ans=0;
	rep(i,N){
		ll x=A[i];
		while(A[i]<now/2)now/=2;
		//cout<<now<<endl;
		if(data[now-A[i]]>0&&data[A[i]]>0){
			if(A[i]==now-A[i]&&data[A[i]]>1){
				data[A[i]]-=2;
				ans++;
				//cout<<i<<" "<<ans<<endl;
			}else if(A[i]!=now-A[i]){
				data[A[i]]--;
				data[now-A[i]]--;
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 26752
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstdio>
#include <map>
#include <string>
using namespace std;

typedef long long li;
const li MAX = 200001;
li inf = 10000000000000000;
li n, mod = 1000000007, dp[MAX][13];
string s;
int main() {
//	freopen("chip.in", "r", stdin);
//  freopen("chip.out", "w", stdout);
	cin >> s;
	n = s.size();
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 13; j++) {
			if (s[i] != '?') {
				dp[i + 1][(10 * j + s[i] - 48) % 13] += dp[i][j];
				dp[i + 1][(10 * j + s[i] - 48) % 13] %= mod;
			}
			else {
				for (int z = 0; z < 10; z++) {
					dp[i + 1][(10 * j + z) % 13] += dp[i][j];
					dp[i + 1][(10 * j + z) % 13] %= mod;
				}
			}
		}
	}
	cout << dp[n][5];
//	system("pause");
	return 0;
}

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

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


signed main(){
    int n;
    string s;
    cin >> n >> s;
    for(auto& c : s){
        c = (c - 'A' + n) % 26 + 'A';
    }
    cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const int N = 100100;
const int LOG = 17;
int n, L, q;
int Q[N][2];
int ANS[N];
int a[N];
int b[LOG][N];

void solve() {
	int p = 0;
	for (int i = 0; i < n; i++) {	
		while(p + 1 < n && a[p + 1] - a[i] <= L) p++;
		b[0][i] = p;
	}
	for (int k = 0; k < LOG - 1; k++)
		for (int i = 0; i < n; i++)
			b[k + 1][i] = b[k][b[k][i]];
	for (int i = 0; i < q; i++) {
		int v = Q[i][0], u = Q[i][1];
		if (v > u) continue;
		int ans = 0;
		for (int k = LOG - 1; k >= 0; k--) {
			if (b[k][v] < u) {
				v = b[k][v];
				ans += 1 << k;
			}
		}
		ANS[i] = ans + 1;
	}
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	scanf("%d%d", &L, &q);
	for (int i = 0; i < q; i++) {
		scanf("%d%d", &Q[i][0], &Q[i][1]);
		Q[i][0]--;
		Q[i][1]--;
	}
	solve();
	for (int i = 0; i < q; i++) {
		Q[i][0] = n - 1 - Q[i][0];
		Q[i][1] = n - 1 - Q[i][1];
	}
	reverse(a, a + n);
	for (int i = 0; i < n; i++)
		a[i] *= -1;
	solve();
	for (int i = 0; i < q; i++)
		printf("%d\n", ANS[i]);

	return 0;
}


Measured memory_bytes: 11408
#include <iostream>
    #include <string>
    #include <vector>
    #include <algorithm>
    #include <cmath>
    #include <cstdio>
    #include <functional>
    #include <numeric>
    #include <stack>
    #include <queue>
    #include <map>
    #include <set>
    #include <utility>
    #include <sstream>
    #include <complex>
    #include <fstream>
    #include <bitset>
    #include <time.h>
    #include <tuple>
     
    using namespace std;
     
    typedef long long ll;
    typedef pair<ll, ll> P;
    typedef vector<ll> V;
    typedef complex<double> Point;
     
    #define PI acos(-1.0)
    #define EPS 1e-10
    const ll INF = 1e12;
    const ll MOD = 1e9 + 7;
     
    #define FOR(i,a,b) for(int i=(a);i<(b);i++)
    #define rep(i,N) for(int i=0;i<(N);i++)
    #define ALL(s) (s).begin(),(s).end()
    #define EQ(a,b) (abs((a)-(b))<EPS)
    #define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
    #define fi first
    #define se second
    #define N_SIZE (1LL << 20)
    #define NIL -1
    #define MAX_N 100100 * 3
     
    int n;
    ll a[100100];
    bool dp[101][100100];
     
    int main() {
    	cin >> n;
    	rep(i, n) {
    		cin >> a[i];
    	}
    	dp[0][0] = 1;
    	rep(i, n) {
    		rep(j, 10010) {
    			if (dp[i][j]) {
    				dp[i + 1][j + a[i]] = 1;
    				dp[i + 1][j] = dp[i][j];
    			}
    		}
    	}
    	ll MAX = 0;
    	rep(i, 10010) {
    		if (dp[n][i] && i % 10 != 0)MAX = max(MAX, (ll)i);
    	}
    	cout << MAX << endl;
    }

Measured memory_bytes: 8576
n, k = map(int, input().split())
s = input()

a = [s[0]]
b = [1]
for i in range(1, n):
    if a[-1] != s[i]:
        a.append(s[i])
        b.append(1)
    else:
        b[-1] += 1
if a[0] == '0':
    a = ['1'] + a
    b = [0] + b
if a[-1] == '0':
    a = a + ['1']
    b = b + [0]


ans = cand = 0
for i in range(len(a)):
    cand += b[i]

    if i > 2 * k and i % 2 == 0:
        cand -= b[i-2*k-1] + b[i-2*k-2]

    if i % 2 == 0:
        ans = max(ans, cand)

print(ans)


Measured memory_bytes: 5748
class unionfind:
    def __init__(self,n): #準備
        self.par=[-1]*(n+1) #ノードは１スタート。各ノードの根を記録。自分が根のときは、-1
        
    def find(self,x): #ノードxの根を調べる
        if self.par[x]<0:
            return x #-1ではなく、根の番号を返す
        else:
            self.par[x]=self.find(self.par[x]) #経路圧縮。ノードxの根を再帰的に更新
            return self.par[x]
        
    def union(self,x,y): #併合
        x=self.find(x) #xの根
        y=self.find(y) 
        if x==y: #根が同じ
            return
        if self.par[y]<self.par[x]: #yのほうが、xよりサイズが大きいとき
            x,y=y,x
        #xのほうがサイズが大きくなるようにしてから、サイズの大きいxにyを併合。サイズが同じなら、どちらが根でも問題ない
        self.par[x]+=self.par[y]
        self.par[y]=x
        
                
    def same_check(self,x,y): #同じ集合に属するか判定
        return self.find(x)==self.find(y)
    
    def size(self,x):
        return -self.par[self.find(x)] #xの根のサイズ

n,m,k=map(int,input().split())
uf=unionfind(n)
kankei=[0]*(n+1) #0番目はなし
for i in range(m):
    a,b=map(int,input().split())
    uf.union(a,b)
    kankei[a]+=1
    kankei[b]+=1
for i in range(k):
    c,d=map(int,input().split())
    if uf.same_check(c,d):
        kankei[c]+=1
        kankei[d]+=1
for i in range(1,n+1):
    print(str(uf.size(i)-kankei[i]-1),end=" ")

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

bool uku(string s) {
  if (s[0] == '0') return s.size() == 1;
  return stoi(s) <= 255;
}

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

  int ans = 0;
  for (int i = 1; i < s.size(); ++i) {
    for (int j = 1; i + j < s.size(); ++j) {
      for (int k = 1; i + j + k < s.size(); ++k) {
        string a = s.substr(0, i);
        string b = s.substr(i, j);
        string c = s.substr(i + j, k);
        string d = s.substr(i + j + k, (s.size() - (i + j + k)));

        ans += uku(a) && uku(b) && uku(c) && uku(d);
      }
    }
  }

  cout << ans << endl;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define oo 1000000010
#define mod 1000000007
const int N = 210;
int n;
char grid[N][N];

bool done[N];

int group[N];

int ans = -1;

void start(int node){
	for(int i = 0 ;i < n;i++){
		done[i] = false;
	}
	group[node] = 1;
	queue < int > q;
	done[node] = true;
	q.push(node);
	int mx = 0;
	while(!q.empty()){
		node = q.front();
		q.pop();
		mx = max(mx,group[node]);
		for(int i = 0 ;i < n;i++){
			if(grid[node][i] == '0') continue;
			if(!done[i]){
				done[i] = true;
				group[i] = group[node] + 1;
				q.push(i);
				continue;
			}
			if(abs(group[i] - group[node]) != 1)
				return;
		}
	}
	ans = max(ans , mx);
}

int main(){
	scanf("%d",&n);
	for(int i = 0 ;i < n;i++){
		scanf("%s",grid[i]);
		
	}
	for(int i = 0 ;i < n;i++){
		start(i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
/// Updated! https://www.youtube.com/watch?v=U07_n9xGIlM
#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int maxn = 2e5+100;

const ll inf = 1e18;
ll arr[maxn];

int main()
{
    fast;
    ll a,b;
    cin >> a >> b;
    if(a==b){
        cout << "Yes";
    }
    else cout << "No";
    return 0;
}
/*



*/



Measured memory_bytes: 256
#!/usr/bin/python

from sys import stdin
from keyword import iskeyword

if __name__ == "__main__":
    n,x,t = map(int, input().split())
    if n % x != 0:
        yaku_num = int(n / x) + 1
    else:
        yaku_num = int(n / x)
    print(yaku_num * t)

Measured memory_bytes: 9176
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<time.h>
#include<vector>
using namespace std;
long long x,k,d;

int main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    scanf("%lld%lld%lld",&x,&k,&d);
    x = abs(x);
    long long t1 = x/d;
    //long long t2 = k - t1;
    if(t1<=k){//先移动t1次
        x -= t1 * d;
        k -= t1;
    }
    else if(t1>k){ //不够t1移动k次
        x -= k * d;
        k = 0;
    }
    if(k==0)
        printf("%lld\n",abs(x));
    else{
        k = k % 2;
        x -= k * d;
        printf("%lld\n",abs(x));
    }

    return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define dbg puts("bug bug bagum");
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(), _a.end()
#define EPS 1e-9
#define PI acos(-1.0)
#define MAX 200005
#define MOD 1000000007
#define INF (1 << 31)
#define nl '\n'
#define fast ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define in_file freopen("input.txt", "r", stdin)
#define out_file freopen("output.txt", "w", stdout)
#define fr(i, b, e) for (int(i) = (b); (i) < (e); (i)++)
#define fr(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define ms0(x) memset((x), 0, sizeof((x)));
#define ms1(x) memset((x), -1, sizeof((x)));
#define pqmin(x) priority_queue<x, vector<x>, greater<x>>
#define pqmax(x) priority_queue<x>
#define sortd(x) sort(all(x), greater<int>())
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) __lcm(x, y)
#define fact(x) factorial(x)
#define sieve(x) normal_sieve(x)
#define bsieve(x) bitwise_sieve(x)
#define bprime(x) !Chk(x)
#define in_file freopen("input.txt", "r", stdin)
#define out_file freopen("output.txt", "w", stdout)
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
typedef pair<int, pii> tii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
/* Function to check if x is power of 2*/
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x & (x - 1)));
}
///code starts from here.............................................
int main()
{
    fast;
   int n;cin>>n;
   string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n;i++){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')c++;
    }
    cout<<c<<nl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int N = 200003, mod = 1000000007;

int n, m;
int a[N];
char s[N];

int main()
{
    n = gi();
    double ans = acos(-1) * 2 * n;
    printf("%.13lf\n", ans);
    return 0;
}


Measured memory_bytes: 3720
n,m = map(int,input().split())
ans = 0
if m < 2:
  print(0)
  exit()
if n >= 2*m:
  ans += n
elif 0 <= n <= m//2:
  ans += n
  ans += (m - 2*n)//4
else:
  ans += m//2
    
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#pragma GCC diagnostic error "-Wconversion"
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
ll digits(ll x){
  ll length = 0;
  while (x > 0){
    x /= 10;
    length++;
  }
  return length;
  if (x == 0) return 0;
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
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;
}

int main(){
  cout << fixed << setprecision(15);
  
  int ans = 0;
  int x, y; cin >> x >> y;
  rep(i, x + 1){
    rep(j, x + 1){
      if (i + j <= y && y - i - j <= x) ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

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

using namespace std;

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

  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 3 and i % 5) {
      ans += i;
    }
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000

bool isPrime(ll x)
{
  if (x==2) return true;
  if (x%2==0) return false;
  
  ll d=3;
  while (d <= x/2)
  {
    d++;
    if (x % d==0) return false;
  }
  return true;
}


int main()
{
  ll X;cin>>X;
  
  while (isPrime(X)!=true)
  {
     X++;
  }
  cout<<X<<endl;
}

Measured memory_bytes: 256
n, K = map(int,input().split())
A = list(map(int,input().split()))

for _ in range(K):
    b = [0 for _ in range(n+1)]
    for i,a in enumerate(A):
        b[max(0, i-a)] += 1
        b[min(n, i+a+1)] -= 1

    for i in range(n):
        b[i+1] += b[i]

    A = b[:-1]
    if all(a == n for a in A):
        break
print(*A)

Measured memory_bytes: 170424
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long long;
using llu = long long unsigned;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod(ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

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

////////////////////////// Solution starts below. //////////////////////////////

const int N = 2e5 + 10;

int n, k;
int a[N], acu[N];
map<int, int> mp;

int main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
	
	cin >> n >> k;
	int x;
	for(int i = 1; i <= n; i++) {
		cin >> x;
		acu[i] = (acu[i-1] + x)%k;
	}
	for(int i = 1; i <= n; i++)
		acu[i] = (acu[i] - (i%k) + k)%k;
	mp[0] = 1;

	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		if(i >= k) mp[acu[i-k]]--;
		ans += mp[acu[i]];
		mp[acu[i]]++;
	}
	cout << ans << '\n';

	return 0;
}


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

class Main {
    static BufferedReader br;
    static StringTokenizer tok;
    static int h, w;
    static char[][] mat;
    static boolean[] rowVisible, colVisible;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        tok = new StringTokenizer(br.readLine());
        h = Integer.parseInt(tok.nextToken());
        w = Integer.parseInt(tok.nextToken());
        mat = new char[h][w];
        rowVisible = new boolean[h];
        colVisible = new boolean[w];
        // 読み込み
        for (int i = 0; i < h; i++) {
            String row = br.readLine();
            for (int j = 0; j < w; j++) {
                char c = row.charAt(j);
                mat[i][j] = c;
                if (c == '#') {
                    rowVisible[i] = true;
                    colVisible[j] = true;
                }
            }
        }
        // 表示
        for (int i = 0; i < h; i++) {
            if (!rowVisible[i]) continue;
            for (int j = 0; j < w; j++) {
                if (!colVisible[j]) continue;
                System.out.print(mat[i][j]);
            }
            System.out.print("\n");
        }
    }
}


Measured memory_bytes: 22228
#include <stdio.h>
using namespace std;
int map[3][101];
int max=0;
int N;
int main()
{
      int N;
      scanf("%d",&N);
      for(int i=1;i<=2;i++)
		for(int j=1;j<=N;j++)
			scanf("%d",&map[i][j]);
	for(int i=1;i<=N;i++)
	{
		int count=0;
		for(int j=1;j<=i;j++)
			count+=map[1][j];
		for(int k=i;k<=N;k++)
			count+=map[2][k];
		if(count>max) max=count;
	}
	printf("%d",max);
	return 0;
}


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

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

  if (N%10 == N/10%10) {

    if (N%10 == N/100%10) {
      cout << "Yes" << endl;
    }

    else {
      cout << "No" << endl;
    }
  }

  else if (N/10%10 == N/100%10) {
    
    if (N/10%10 == N/1000) {
      cout << "Yes" << endl;
    }
    
    else {
      cout << "No" << endl;
    }

  }

  else {
    cout << "No" << endl;
  }

}


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

int n;
int a[105];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int cnt=0;
	bool flag=true;
	while(flag){
		flag=false;
		for(int j=0;j<n-1;j++){
			if(a[j+1]<a[j]){
				cnt++;
				swap(a[j],a[j+1]);
				flag=true;
			}
		}
	}
	for(int i=0;i<n;i++){
		printf("%d%c",a[i],i==n-1?'\n':' ');
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 2664
//    >File Name: 78D.cpp
//    > Author: Webwei

#include<bits/stdc++.h>
using namespace std;

int n,a,b,v[2010];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> a >> b;
	for(int i=0; i<n; i++)	cin >> v[i];
	cout << max(abs(b-v[n-1]),abs((n==1?0:v[n-1]-v[n-2])))<<'\n';
	return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int G[101][101];
int raw[101][101];
vector<pair<int, int>> vs;

int main() {
  int N, M; cin >> N >> M;
  rep(i, N) rep(j, N) G[i][j] = raw[i][j] = i == j ? 0 : inf;
  rep(i, M) {
    int a, b, c; cin >> a >> b >> c;
    a--, b--;
    G[a][b] = G[b][a] = c;
    raw[a][b] = raw[b][a] = c;
    vs.emplace_back(a, b);
  }
  rep(k, N) rep(i, N) rep(j, N) {
    minimize(G[i][j], G[i][k] + G[k][j]);
  }
  int count = 0;
  for (auto e: vs) {
    count += G[e.first][e.second] < raw[e.first][e.second];
  }
  cout << count << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,a[MAXN];
map<int,int> zz;
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) {read(a[i]);zz[a[i]]++;}
    int r = 0,c = 0;
    while(1) {
        if(zz.empty()) break;
        auto t = *(--zz.end());zz.erase(--zz.end());
        if(t.se >= 2) {
            if(!r) r = t.fi;
            else if(!c) c = t.fi;
        }
        if(t.se > 2) zz[t.fi] = t.se - 2;
        if(r && c) break;
    }
    out(1LL * r * c);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

int main(){
	int x;
  	cin>>x;
  
  	int i, j;
  	if(x==2){
    	i=x;
    }else{
      if(x%2==1) i=x;
      else i=x+1;

      int end=0;
      while(end==0){
          int ri=(int)sqrt((double)i);
          for(j=2;j<=ri;j++){
              if(i%j==0){
                break;
              }
          }
        
          if(j==ri+1){
          	break;
          }
        
          i+=2;
      }
    }
  	cout<<i<<endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: i32,
        m: i32,
        xs: [i32; m],
    }
    let work:i32 = xs.iter().sum();
    let ans = match n-work {
        x if x >= 0 => x,
        _ => -1
    };
    println!("{}", ans);
}

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

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

    vector<bool> a(26);

    
    for(int i = 0; s[i] != 0; i++){
        a[s[i] - 'a'] = true;
    }
    
    int flag = 0;
    for(int i = 0; i < 26; i++){
        if(!a[i]){
            flag = 1;
            char c = i + 'a';
            cout << c;
            break;
        }
    }
    if(!flag) cout << "None";
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a<1200)cout<<"ABC"<<endl;
	else if(a>=2800)cout<<"AGC"<<endl;
	else cout<<"ARC"<<endl;
}


Measured memory_bytes: 256
#include <iostream>                                             
using namespace std;                                            
                                                                
int main() {                                                    
  int S;                                                        
  cin >> S;                                                     
  int h = S/3600;                                               
  int m = S%3600/60;                                            
  int s = S%3600%60;                                            
  cout << h << ":" << m << ":" << s << endl;                    
  return 0;                                                     
}                  

Measured memory_bytes: 3100
s=list(input())
counter=0
makkusu=0

for i in range(len(s)):
  if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
    counter +=1
    if counter > makkusu:
      makkusu = counter
  else:
    counter = 0
    
print(makkusu)

Measured memory_bytes: 3064
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, A, B): (i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = if B < A || (N == 1 && A != B) { 0 } else { (B * (N - 1) + A) - (A * (N - 1) + B) + 1 };

    println!("{}", ans);
}

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

using namespace std;

int main(void)
{
    long long n; cin >> n;

    if(n % 2)
    {
        cout << 0;
        return 0;
    }

    long long ans = 0;

    for(long long i = 10; i <= n; i *= 5)
    {
        ans += (n / i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,b = 0,h;
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> h;
    if(h-1 >= b) b = h-1;
    else if(h < b){
      cout << "No";
      return 0;
    }
    else b = h;
  }
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>

#include <string>

class Union_Find {
    public:
    std::vector<int> par;
    Union_Find() {}
    Union_Find(int n){
        par.resize(n, 0);
        for(int i = 0; i < n; i++){
            par[i] = i;
        }
    }

    void simplify(int x) {
        std::vector<int> path;
        while (par[x] != x) {
            path.push_back(x);
            x = par[x];
        }
        for (int p : path) {
            par[p] = x;
        }
    }
    
    int find(int x){
        simplify(x);
        return par[x];
    }
    
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if (x != y) {
            par[y] = x;
            // 改造する時は「根になっているノードの親を変更する」という原則が守られていることに注意。
        }
    }
};

struct Node {
    std::vector<int> edge;
    int color;
};

const int MAX_N = 100050;
const int MAX_M = 200050;

int N, M;
int u[MAX_M], v[MAX_M];

int num[MAX_N] = {};
Node graph[MAX_N];
Union_Find union_find = Union_Find(MAX_N);

bool is_bipertite(int n, int color) {
    if (graph[n].color == color) {
        return true;
    } else if (graph[n].color == -color) {
        return false;
    }

    graph[n].color = color;

    for (int e : graph[n].edge) {
        if (!is_bipertite(e, -color)) {
            return false;
        }
    }
    return true;
}

int main(int argc, char **argv) {
    std::cin >> N >> M;

    for (int i = 1; i <= M; i++) {
        std::cin >> u[i] >> v[i];
    }

    for (int i = 1; i <= M; i++) {
        union_find.unite(u[i], v[i]);
        graph[u[i]].edge.push_back(v[i]);
        graph[v[i]].edge.push_back(u[i]);
    }

    for (int i = 1; i <= N; i++) {
        num[union_find.find(i)]++;
        graph[i].color = 0;
    }

    long long single_num = 0;
    long long bipertite_num = 0;
    long long other_num = 0;

    for (int i = 1; i <= N; i++) {
        if (union_find.find(i) == i) {
            if (num[i] == 1) {
                single_num++;
            } else if (is_bipertite(i, 1)) {
                bipertite_num++;
            } else {
                other_num++;
            }
        }
    }

    //std::cout << single_num << " " << bipertite_num << " " << other_num << std::endl;

    long long ret = single_num * single_num + single_num * (N - single_num) * 2;
    ret += bipertite_num * bipertite_num * 2;
    ret += other_num * other_num + other_num * bipertite_num * 2;

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 9984
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<long long>a(N + 1, 0), sum(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
        sum[i] += sum[i - 1] + a[i];
    }

    long long ans = abs(2*sum[1]-sum[N]);
    for (int i = 1; i < N; i++) {
        ans = min(ans, abs(2 * sum[i] - sum[N]));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

main(void)
{
  int n,i,j,aa;
  int count=0;
  int gusu=0;
  int kekka=1;
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++)
  {
    aa = i;
   while(aa%2==0)
   {
     aa = aa/2;
     count++;
     
   }
    
      if(gusu<count)
      {
        gusu = count;
        count=0;
        
      }
    count=0;
  }

  for(j=1;j<=gusu;j++)
  {
    kekka = kekka*2;
  
   
  }
  printf("%d",kekka);
  
  return 0;
}

Measured memory_bytes: 128
($H,$W)=glob<>;
@a=map[/./sg],<>;
for$y(0..$H-1){
	for$x(0..$W){
		$t=1;
		$t&=$a[$_][$x]eq'.'for 0..$H-1;
		$u=1;
		$u&=$a[$y][$_]eq'.'for 0..$W-1;
		if(!($t|$u)){
			print$a[$y][$x]
		}
	}
}


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

int dp[100][100];

int rec(int n, int m)
{
    if(n==1 && m==1) return 0;
    if(n==1 && m==0) return 0;
    if(n==0 && m==1) return 0;
    if(dp[n][m]!=-1) return dp[n][m];
    int f = 1;
    for(int i = 1; 2*i<=n; i++)
        f &= rec(n - 2*i, m+i);
    for(int i = 1; 2*i<=m; i++)
        f &= rec(n + i, m - 2*i);
    return dp[n][m] = !f;
}


int main()
{
    long long int n, m;
    cin >> n >> m;

    if((n-1<=m && m<=n+1) || (n==0 && m==0)) cout << "Brown" << endl;
    else cout << "Alice" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define pr_arr(name, a, b) \
  for (int i = (a); i < (b); i++) { \
    for (int j = (a); j < (b); j++) {\
      if (j > (a)) printf(" "); \
      printf("%lld", name[i][j]); \
    }\
    printf("\n");\
  }\



using namespace std;

typedef long long ll;

static const long long MAX = 10;
static const long long MOD = 1000000007;

int H, W, K;
ll d[10]; //d[i] i本の時の組み合わせ数
ll dp[105][10]; //dp[i][j] i行目までを考えた時のj番目の縦棒にいる組み合わせ総数 mod 1e9+7
long long fac[MAX],   // i!    mod p iの階乗
          finv[MAX],  // i!^-1 mod p iの階乗の逆元
          inv[MAX];   // i^-1  mod p iの逆元 inverse

void comb_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;
    }
}
long long combination(long long n, long long k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

/*
j-2 j-1 j  j+1 j+2
 |   |__|   |   |
 |   |  |   |   |

j-2 j-1 j  j+1 j+2
 |   |  |   |   |
 |   |  |   |   |

j-2 j-1 j j+1 j+2
 |   |  |__|   |
 |   |  |  |   |
*/

void init_d() {
    rep(i, 1, 9) {
        ll j = (ll)i-1, k = 1;
        while (j >= k) {
            d[i] += combination(j, k);
            j--; k++;
        }
        d[i] += 1; //一つも横棒なし
    }
}

long long calc_d(long long n) {
    if (n < 1) return 1;
    return d[(int)n];
}

int main(void) {
    scanf("%d %d %d", &H, &W, &K);
    comb_init();
    init_d();
    dp[0][1] = 1;
    rep(i, 1, H+1) {
        rep(j, 1, W+1) {
            dp[i][j] += dp[i-1][j-1] * calc_d(j-2) * calc_d(W-j) % MOD;
            dp[i][j] %= MOD;
            dp[i][j] += dp[i-1][j] * calc_d(j-1) * calc_d(W-j) % MOD;
            dp[i][j] %= MOD;
            dp[i][j] += dp[i-1][j+1] * calc_d(j-1) * calc_d(W-j-1) % MOD;
            dp[i][j] %= MOD;
        }
    }



  
    printf("%lld\n", dp[H][K]);

	return 0;
}


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

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

	string s;
	cin >> s;

	bool flag = true;
	for (int i=0;i<a;i++) {
	if (s[i]!= '0'&&s[i]!= '1' &&s[i]!= '2'&&s[i]!= '3'&&s[i]!= '4'&&s[i]!= '5'&&s[i]!= '6'&&s[i]!= '7'&&s[i]!='8'&&s[i]!= '9') {
	flag = false;
	}
	}

	if (s[a]!='-') {
	flag = false;
	}
	int len = a+b+1;

	for (int i=a+1;i<len;i++) {
	if (s[i]!= '0'&&s[i]!= '1' &&s[i]!= '2'&&s[i]!= '3'&&s[i]!= '4'&&s[i]!= '5'&&s[i]!= '6'&&s[i]!= '7'&&s[i]!='8'&&s[i]!= '9') {
        flag = false;
        }
        }

	if (flag) {
	cout << "Yes" << endl;
	}
	else {
	cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    switch(S[K - 1]) {
        case 'A' : S[K - 1] = 'a'; break;

        case 'B' : S[K - 1] = 'b'; break;

        case 'C' : S[K - 1] = 'c'; break;
    }
    cout << S << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws Exception {
        int[] arr = inputval();
        int N, A, B;
        N = arr[0];
        A = arr[1];
        B = arr[2];
        int m,n;
        int sum_digits;
        int sum = 0;
        for (int i = 1; i <= N; i++) {
            m = i;
            n = i;
            sum_digits = 0;
            while (n > 0) {
                sum_digits += n % 10;
                n /= 10;
            }
            if (A <= sum_digits && sum_digits <=B){
                sum += m;
            }
        }
        System.out.println(sum);
    }


    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    static void array_sout(int[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
    }

    static void array_sout(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
    }
}

Measured memory_bytes: 21076
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

			String in = br.readLine();
			System.out.println("ABC"+in);

		}
	}
}


Measured memory_bytes: 25304
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void) {
	string b;
	cin >> b;
	int a = 0,sum=0;

	for (int i = 0; i < b.size(); i++) {


		if (b[i] == 'A') {
			a++;
		}
		else if (b[i] == 'T') {
			a++;
		}
		else if (b[i] == 'C') {
			a++;
		}
		else if(b[i]=='G'){
			a++;
		}
		else {
			a = 0;
		}
		sum = max(sum, a);
	}
	cout << sum << endl;

	return 0;


}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N, A, B;
	int con = 0;
	
	cin>>N>>A>>B;
	
	con += A * (N / (A + B))
	;
	
	con += min(N%(A+B), A);
	
	
	cout<<con<<endl;
	
	return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include<deque>
#include<queue>
#include<set>
#include <functional>
#include <cmath>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
int x;
int prime[50000] = { 0 };
int idx;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

//numまでの素数を求める
void getPrime(int num) {
	if (num < 2) {
		idx = -1;
		return;
	}
	prime[0] = 2;
	if (num < 3) {
		idx = 0;
		return;
	}
	idx = 1;
	prime[0] = 2;
	prime[1] = 3;
	int i, j;
	int start;
	int flag;
	for (i = prime[idx] + 2; i <= num; i += 2) {
		flag = 1;
		for (j = 0; prime[j] <= (int)sqrt(i); j++) {
			if (i%prime[j] == 0) {
				flag = 0;
				break;
			}
		}
		if (flag)prime[++idx] = i;
	}
}

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

	cin >> x;
	getPrime(x*2);
	REP(i, idx) {
		if (x <= prime[i]) {
			cout << prime[i] << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 384
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

a,b,c,d = map(int, input().split())
t = True
while(a >0 and b > 0):
    c-=b
    if(c <= 0):
        t = True
        break
    a-=d
    if(a  <= 0):
        t = False
        break
if(t):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 62008
# N 人の生徒を分けて、 3 人以上のグループのを最大化
# 3人以上のグループを最大で ｘ 個つくれるとき、 ｘ を出力

# 入力値を数値に変換
N = int(input())

# 3で割った時の整数の商をｘとして出力
x = N // 3
print(x)


Measured memory_bytes: 9084
import java.util.*;

class Main
{

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        int an = 0;
        
        for (int x = 1; x <= m; x++) {
            int y = 0;
            for(int X = x; X>0; X/=10){
                y += X % 10;
            }
            
            int y_plus_a = y + a;
            int xx = 1;
            for (int i = 0; i < n; i++) {
                xx *= y_plus_a;
            }
            if(xx == x){
                an++;
            }
        }
        System.out.println(an);
    }
}



Measured memory_bytes: 26724
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int l, r, d, cnt=0;
    cin >> l >> r >> d;
    rep2(i, l, r+1){
        if(i%d==0){cnt++;}
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632