akhauriyash/Code-Regression huggingface dataset:
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, r: f64);
    println!("{}", 2. * r * std::f64::consts::PI);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2184
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
//#define int long long

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

	string s;
	cin >> s;
	
	if (s.size() < 4) {
		cout << "No" << endl;
		return 0;
	}

	bool flg = true;
	if (s[0] != 'Y')flg = false;
	if (s[1] != 'A')flg = false;
	if (s[2] != 'K')flg = false;
	if (s[3] != 'I')flg = false;

	if (flg) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
// JavaProgram.cpp
// Author : Priydarshi Singh (@dryairship)
// One cat just leads to another. One bug leads to two others.

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

// I like my types defined.
typedef long long           ll;
typedef pair<int, int>      pii;
typedef pair<ll, ll>        pll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<pii>         vii;
typedef vector<pll>         vll;
typedef set<int>            si;
typedef map<string, int>    msi;
typedef map<int, int>       mii;

// Traditional science is all about finding "hashtag define"s.
#define fr(i, n)            for(int i=0; i<(n); ++i)
#define frC(i, n, c)        for(int i=0; (i<(n)) && (c); ++i)
#define frA(i, a, n)        for(int i=a; i<=(n); ++i)
#define frD(i, a, n)        for(int i=a; i>=(n); --i)
#define fill(a)             memset(a, 0, sizeof(a))
#define fill1(a)            memset(a, -1, sizeof(a))
#define revsort(a, b)       sort(a, b, greater<int>())
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define dout                if(DEBUGGING) cout
#define dbg                 if(DEBUGGING) 
#define endl                "\n"

// When you realize MOD > INF...
int DEBUGGING    =          0;
const int INF    =          1000000000;
const int MOD    =          1000000007;
const ll LINF    =          1e18;
const double PI  =          3.1415926535897932;
const double EPS =          1e-7;

// I'D SPAM. Hehe.
ll gcdEx                    (ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;} 
ll x1,y1,gcd=gcdEx          (b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)         {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
ll modD(ll a, ll b)         {return (modI(b,MOD)*(a%MOD))%MOD;}
ll modS(ll a, ll b)         {return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;} y=y>>1; x=(x*x)%MOD;} return r;}
ll modA(ll a, ll b)         {return ((a%MOD)+(b%MOD))%MOD;}
ll modM(ll a, ll b)         {return ((a%MOD)*(b%MOD))%MOD;}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double dp[3005][3005];
double p[3005];

void solve(int TEST_CASE){
    int n;
    cin >> n;
    fr(i,n) cin >> p[i];
    fill(dp);
    dp[1][1] = p[0]; dp[1][0] = 1-p[0];
    frA(i,2,n) dp[i][0] = dp[i-1][0]*(1-p[i-1]);
    frA(i,2,n) dp[i][i] = dp[i-1][i-1]*p[i-1];
    frA(i,1,n){
        frA(j,1,i-1){
            dp[i][j] = dp[i-1][j]*(1-p[i-1]) + dp[i-1][j-1]*p[i-1];
            dout << "dp["<<i<<"]["<<j<<"] = " << dp[i][j] << endl;
        }
    }
    dbg{
        frA(i,0,n){
            frA(j,0,n){
                cout << dp[i][j] << ",";
            }
            cout << endl;
        }
    }
    int k = (n+1)/2;
    double ans=0;
    frA(i,k,n) ans+=dp[n][i];
    cout << ans;
}

int main(int argc, char* argv[]){
    if(argc==2 && argv[1][1]=='v') DEBUGGING = 1;
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    cout << fixed << setprecision(15);
    int nTestCases=1;
    //cin >> nTestCases;
    frA(i,1,nTestCases) solve(i);
    return 0;
}

Measured memory_bytes: 74356
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <cmath>
#include<iomanip>
#include <unordered_map>
#include <map>
#include <queue>
using namespace std;
static const long long MOD = 1000000007LL;
typedef long long ll;
unordered_map <string,int> ump;
 bool cmp(pair<int,int>a,pair<int,int>b)
 {
 	return a.second>b.second;
 }
int  p[1000][1000];
int q[1000];
int o[1000];
int s[1000];
int k[1000];
 int book[1000];
 int h,w,a,b;
 int total;

 
int main()
{
    
    cin>>h>>w>>a>>b;
  /*  void dfs(int cur)
 {
 	
 }
  int i,j;
	    total=0;
	  memset(book,0,sizeof(book));
	  dfs(0);*/
    if(a>w/2||b>h/2)
    	cout<<"No"<<endl;
    else
    {
    	int x=0;//x行 0到h-1
    	int y=0;//y列 0到w-1

    	//x=0
    	for(y=0;y<w;y++)
    	{
    		if(q[0]<a)
    			{p[0][y]=1;
    				q[0]++;
    				o[y]++;}

    		else
    			{p[0][y]=0;
    				s[0]++;
    				k[y]++;}
    	}
    	for(x=1;x<h;x++)
    		for(y=0;y<w;y++)
    	{
    		if((q[x]<a&&o[y]<b)||((q[x]>=a&&s[x]>=a)&&o[y]<b)||((o[y]>=b&&k[y]>=b)&&q[x]<a))
    		{
    			p[x][y]=1;
    				q[x]++;
    				o[y]++;
    		}
    		else
    			{p[x][y]=0;
    				s[x]++;
    				k[y]++;}
    	}

    	for(int i=0;i<h;i++)
    		for(int j=0;j<w;j++)
    		{
    				if(j==w-1)
    					cout<<p[i][j]<<endl;
    				else
    					cout<<p[i][j];
    		}
    }


    return 0;
}

Measured memory_bytes: 5120
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;

	//隣接テーブルをつくる
	int n,v; //葉と枝の数
	cin >> n >> v; 
	int tab[n+1][n+1] = {};
	REP(i,v){
		int sta, goa;
		cin >> sta >> goa;
		tab[sta][goa]++;
		tab[goa][sta]++;
	}
	//
	vector<int > vc;
	REP1(i, n) vc.push_back(i);
	bool ch;
	do{
		ch = true;
		REP(i, n-1) if(tab[vc[i]][vc[i+1]]==0) ch = false;
		if(ch) ans++;
	}while(next_permutation(vc.begin()+1, vc.end()));
	cout << ans << endl;
}

Measured memory_bytes: 256
s = list(input())

for index,value in enumerate(s):
  if index%2==0:
    if value!="R" and value!="U" and value!="D":
      print("No")
      exit()
  else:
    if value!="L" and value!="U" and value!="D":
      print("No")
      exit()

print("Yes")

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

//-----------------------------------------------------------------------------

string a,b;

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

	cin>>a>>b;
	string c=a+b;
	int n=stoi(c);
	if(floor(sqrt(n))==ceil(sqrt(n))) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
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; }
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);

    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> B[i];
    rep(i, 0, N) cin >> C[i];

    sort(A.begin(), A.end());
    sort(C.begin(), C.end());

    ll res = 0;
    for (int i = 0; i < N; i++) {
        ll a = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        ll c = N - (upper_bound(C.begin(), C.end(), B[i]) - C.begin());
        res += a * c;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#define maxn 100010
struct node{
	int to,next;
}e[maxn<<1];
int h[maxn],head[maxn],tot,cnt;
void add_edge(int u,int v){
	tot++,e[tot].to=v,e[tot].next=head[u],head[u]=tot;
}
int main(){
	int n,m,u,v,i,b,flag1,flag2;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)scanf("%d",&h[i]);
	for(i=1;i<=m;i++){
		scanf("%d%d",&u,&v);
		add_edge(u,v),add_edge(v,u);
	}
	for(i=1;i<=n;i++){
		flag1=0,flag2=0;
		for(b=head[i];b;b=e[b].next){
			flag1=1,v=e[b].to;
			if(h[i]<=h[v]){flag2=1;break;}
		}
		if(!flag1)cnt++;
		else if(!flag2)cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 5572
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<int, int>;

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

    int h, w, k;
    cin >> h >> w >> k;

    int si, sj, ti, tj;
    cin >> si >> sj >> ti >> tj;
    --si, --sj, --ti, --tj;
    vector< string > field(h);
    rep (i, h) cin >> field[i];

    const int inf = 1e9;
    int d[h][w];
    rep (i, h) rep (j, w) d[i][j] = inf;

    queue<P> q;
    q.emplace(si, sj);
    d[si][sj] = 0;
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, -1, 0, 1};
    while (!q.empty())
    {
        auto from = q.front(); q.pop();
        int fi = from.first;
        int fj = from.second;
        rep (i, 4)
        {
            int ni = fi;
            int nj = fj;
            int dyy = dy[i];
            int dxx = dx[i];
            rep (j, k)
            {
                ni += dyy;
                nj += dxx;
                if (!(IN(0, h, ni) && IN(0, w, nj))) break;
                if (d[ni][nj] < d[fi][fj] + 1 || field[ni][nj] == '@') break;
                if (d[ni][nj] != inf) continue;
                d[ni][nj] = d[fi][fj] + 1;
                q.emplace(ni, nj);
            }
        }
    }

    s64 ans = d[ti][tj];
    if (ans == inf) cout << "-1\n";
    else cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 9292
#include<stdio.h>

int main(void){
  int n,i=1,N=1,yakusuu;
  scanf("%d",&n);

  while(1){
    yakusuu=0;
    while(i<=N){
        if(N%i==0) yakusuu++;
        i++;
    }
    if(yakusuu==n) break;
    i=1;  N++;
  }
  printf("%d\n",N);
  return 0;
}



Measured memory_bytes: 2100
#include <cstdio>
#include <vector>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

int n;
vector<int> t[100000];
int d[100000];
int s[100000][17];
int q;

void dfs(int x){
	rep(i, t[x].size()){
		int y = t[x][i];
		d[y] = d[x] + 1;
		dfs(y);
	}
}

void init(){
	rep(i, n){
		fill_n(s[i], 17, -1);
	}

	rep(i, n){
		rep(j, t[i].size()){
			s[t[i][j]][0] = i;
		}
	}

	for(int i = 1; i < 17; ++i){
		rep(j, n){
			int p = s[j][i - 1];
			s[j][i] = p != -1 ? s[p][i - 1] : -1;
		}
	}
}

int up(int i, int x){
	rep(j, 17){
		if(x & (1 << j)){
			i = s[i][j];
		}
	}
	return i;
}

int lca(int u, int v){
	if(d[u] > d[v]){
		swap(u, v);
	}
	v = up(v, d[v] - d[u]);

	if(u == v){
		return u;
	}

	for(int i = 16; i >= 0; --i){
		if(s[u][i] != s[v][i]){
			u = s[u][i];
			v = s[v][i];
		}
	}
	return s[u][0];
}

int main(){
	scanf("%d", &n);
	rep(i, n){
		int k;
		scanf("%d", &k);
		rep(j, k){
			int c;
			scanf("%d", &c);
			t[i].push_back(c);
		}
	}

	dfs(0);

	init();

	scanf("%d", &q);
	rep(i, q){
		int a, b;
		scanf("%d%d", &a, &b);
		printf("%d\n", lca(a, b));
	}
	return 0;
}

Measured memory_bytes: 16648
import java.util.Scanner;

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int[] A = new int[N];
      int[] B = new int[N];
      int[] C = new int[N - 1];
      int satisfaction = 0;

      for (int i = 0; i < A.length; ++i) {
        A[i] = in.nextInt();
      }


      for (int i = 0; i < B.length; ++i) {
        B[i] = in.nextInt();
        satisfaction += B[i];
      }

      for (int i = 0; i < C.length; ++i) {
        C[i] = in.nextInt();
      }

      for (int i = 1; i < A.length; ++i) {
        if (A[i] - 1 == A[i - 1]) {
          satisfaction += C[A[i - 1] - 1];
        }
      }

      System.out.println(satisfaction);
    }
  }
}

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

public class Main {
	public static void main(String[] args) {
		try {
	   		BufferedReader br = createBufferedReader();
	        String line = br.readLine();
	       	System.out.println(method(line));
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}

	private static int method(final String str) {
		String[] strings = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
		for (int i = 0; i < strings.length; i++) {
			if (str.equals(strings[i])) {
				return 7 - i;
			}
		}
		return -1;
	}

	// 以下問題問わずに共通部分
	// 標準入力の BufferedReader を返す.
	private static BufferedReader createBufferedReader() {
		InputStreamReader isr =new InputStreamReader(System.in);
	   	return new BufferedReader(isr);
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <climits>	
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int wf[11][11] = {0};
int dp[1<<11][11];

void tsp(int n){
	rep(i,1<<11)rep(j,11)dp[i][j] = (1<<21);
	
	dp[1][0] = 0;
	rep(i,1<<n){
		rep(j,n){
			rep(k,n){
				dp[i|(1<<k)][k] = min( dp[i][j]+wf[j][k] , dp[i|(1<<k)][k] );
			}
		}
	}
}

void doWF(){
	rep(k,11)rep(i,11)rep(j,11)wf[i][j] = min(wf[i][j],wf[i][k]+wf[k][j]);
}

int main(){
	int n,m,q;
	while(cin >> n , n){
		rep(i,11)rep(j,11)wf[i][j] = (i==j?0:(1<<21));
		vector< vector< pair<string,int> > > shop(n);
		rep(i,n){
			int s;
			cin >> s;
			rep(j,s){
				string str; int val;
				cin >> str >> val;
				shop[i].push_back(make_pair(str,val));
			}
		}
		cin >> q;
		set<string> want;
		rep(i,q){
			string str;
			cin >> str;
			want.insert(str);
		}
		
		cin >> m;
		rep(i,m){
			int a,b,c;
			cin >> a >> b >> c;
			wf[a][b] = wf[b][a] = min(c,wf[a][b]);
		}
		doWF();
		tsp(n+1);
		
		int money = INT_MAX , route = INT_MAX;
		
		rep(i,1<<n){
			map<string,int> get;
			rep(j,n){
				if( i & (1<<j) ){
					rep(k,shop[j].size()){
						string a = shop[j][k].first;
						int b = shop[j][k].second;
						if(want.find(a) != want.end()){
							if(get.find(a) == get.end()){
								get[a] = b;
							}else{
								get[a] = min(get[a],b);
							}
						}
					}
				}
			}
			int sum = 0;
			if(get.size() == want.size()){
				for(map<string,int>::iterator it = get.begin(); it != get.end();++it){
					sum += (*it).second;
				}
				if(sum <= money){
					int bit = (i << 1) + 1;
					int cost = INT_MAX;
					rep(j,n){
						cost = min(cost , dp[bit][j] + wf[j][0]);
					}
					if(sum == money){
						route = min(cost,route);
					}else{
						route = cost;
					}
					money = sum;
				}
			}
			
		}
		if(money == INT_MAX){
			cout << "impossible" << endl;
		}else{
			cout << money << " " << route << endl;
		}
	}
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        String s = sc.next();

        if(s.length() <= k){
            System.out.println(s);
        } else {
            System.out.println(s.substring(0, k) + "...");
        }
    }
}

Measured memory_bytes: 38652
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n,m = ips()
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
s = []
for i in range(4):
    s.append(a[i])
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[1] != s[2]:j(1)
j(0)


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

long long pop(long long num){
    long long cnt = 0;
    while(num > 0){
        if(num % 2 != 0){
            cnt++;
        }
        num /= 2;
    }
    return cnt;
}

int main(void){

    long long digit;
    cin >> digit ;
    
    string s ;
    cin >> s ;
    
    long long cnt = 0;
    for(int i = 0; i < s.size(); i++){
        if(s.at(i) == '1'){
            cnt++;
        }
    }
    
    vector<long long> op(cnt + 2), pow2m(s.size()), pow2p(s.size());
    long long summ = 0, sump = 0;
    for(int i = 0; i < cnt + 2; i++){
        if(i == 0){
            op.at(i) = 0;
        } else {
            op.at(i) = op.at(i % pop(i) ) + 1;
        }
        //cout << i << " " << op.at(i) << endl;
    }
    
    for(int i = s.size() - 1; i >= 0; i--){
        if(i == s.size() - 1){
            if(cnt - 1 != 0){
                pow2m.at(i) = 1 % ( cnt - 1 );
            }
            pow2p.at(i) = 1 % ( cnt + 1 );
        } else {
            if(cnt - 1 != 0){
                pow2m.at(i) = pow2m.at(i + 1) * 2 % ( cnt - 1 );
            }
            pow2p.at(i) = pow2p.at(i + 1) * 2 % ( cnt + 1 );
        }
        if(s.at(i) == '1'){
            if(cnt - 1 != 0){
                summ = ( summ + pow2m.at(i) ) % ( cnt - 1 );
            }
            sump = ( sump + pow2p.at(i) ) % ( cnt + 1 );
        }
    }
    
    //cout << cnt - 1 << " " << cnt + 1 << endl;
    //cout << summ << " " << sump << endl;
    
    //*
    long long treat;
    for(int i = 0; i < s.size(); i++){
        //printf("%2d ", i);
        if(s.at(i) =='1'){
            if(cnt - 1 == 0){
                cout << 0 << endl;
            } else {
                treat = ( summ - pow2m.at(i) ) % ( cnt - 1 );
                while(treat < 0){
                    treat = ( treat + ( cnt - 1 ) ) % ( cnt - 1 );
                }
                //cout << treat % ( cnt - 1 ) << endl;
                cout << 1 + op.at(treat % ( cnt - 1 )) << endl;
            }
        } else {
            treat = ( sump + pow2p.at(i) ) % ( cnt + 1 );
            //cout << treat % ( cnt + 1 ) << endl;
            cout << 1 + op.at(treat % ( cnt +  1)) << endl;
        }
    }
    //*/

    return 0;

}


Measured memory_bytes: 7548
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    int w[110];
    int max=0;
    for(int i=0;i<n;i++){
        cin>>w[i];
        max+=w[i];
    }
    int ans=0,wa=0,memo=0;
  wa=w[0];
    memo=max-wa*2;
  ans=(memo>0)?memo:-memo;
    for(int i=1;i<n;i++){
        wa+=w[i];
      memo=max-wa*2;
      memo=(memo>0)?memo:-memo;
        ans=min(ans,memo);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	x, a, b := getInt(), getInt(), getInt()

	if asub(x, a) >= asub(x, b) {
		out("B")
	} else {
		out("A")
	}

}


Measured memory_bytes: 640
import java.util.*;
import java.lang.Math;

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

 		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	int cc = a % b;
      	int ce = cc;
      	String str = "NO";
      	boolean con = true;
      	int i = 1;
      	
      	do{
          if(cc == c) {
            str = "YES";
            con = false;          
          }
          i++;
          cc = (a*i)%b;
          if(ce == cc) con = false;
        }while(con);
      
      	System.out.println(str);
        
	}
}


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

using namespace std;
#define loop(i,n) for(int i = 0; i < (n); ++i)
#define loops(i,f,n) for(int i = (f); i < (n); ++i)
#define INF 9999999
#define lint long long int
#define VEC vector<int>
#define VEC2 vector<vector<int>>
int n;

bool solve(vector<int> dis)
{
	int t = 0;
	bool ret = true;
	loop(i, n)
	{
		if (i > t) { ret = false; break; }
		t = max(i + dis[i] / 10, t);
	}
	return ret;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	vector<int> dis(n);
	loop(i, n)cin >> dis[i];
	vector<int> dis_back = dis;
	reverse(dis_back.begin(), dis_back.end());
	bool ans = true;
	if (!solve(dis) || !solve(dis_back))ans = false;
	cout << (ans ? "yes" : "no") << endl;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  vector<int> a(N + 1);
  rep(i, 1, N + 1) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  vector<vector<int>> dp(N + 1, vector<int>(N + 1, INF));
  rep(i, 0, N) dp[i][i + 1] = 0;

  rep(w, 2, N + 1) {
    rep(i, 0, N + 1 - w) {
      int j = i + w;
      rep(k, i + 1, j) {
        chmin(dp[i][j], dp[i][k] + dp[k][j] + a[j] - a[i]);
      }
      dump(i,j,dp[i][j]);
    }
  }
  cout<<dp[0][N]<<endl;

  return 0;
}


Measured memory_bytes: 1536
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

def solve():
    from bisect import bisect_right

    N,D,A = II()
    X,H = Line(N,2)
    #Binary Indexed Tree（区間加算）
    #1-indexed
    class Range_BIT():
        def __init__(self, N):
            self.size = N
            self.data0 = [0]*(N+1)
            self.data1 = [0]*(N+1)

        def _add(self, data, k, x):
            while k <= self.size:
                data[k] += x
                k += k & -k

        # 区間[l,r)にxを加算
        def add(self, l, r, x):
            self._add(self.data0, l, -x*(l-1))
            self._add(self.data0, r, x*(r-1))
            self._add(self.data1, l, x)
            self._add(self.data1, r, -x)

        def _get(self, data, k):
            s = 0
            while k:
                s += data[k]
                k -= k & -k
            return s

        # 区間[l,r)の和を求める
        def query(self, l, r):
            return self._get(self.data1, r-1)*(r-1)+self._get(self.data0, r-1)\
                    -self._get(self.data1, l-1)*(l-1)-self._get(self.data0, l-1)

    #インデックス付きソート
    #(index,value)の順に格納
    from operator import itemgetter
    def index_sort(A):
        return sorted(enumerate(A),key=itemgetter(1))

    num = [math.ceil(H[i]/A) for i in range(N)]
    temp = index_sort(X)

    X2 = [temp[i][1] for i in range(N)]
    num = [num[t[0]] for t in temp]

    bit = Range_BIT(N)
    for i in range(1,N+1):
        bit.add(i,i+1,num[i-1])

    ans = 0
    for i in range(1,N+1):
        c = bit.query(i,i+1)
        if c<=0:
            continue
        p = bisect_right(X2,X2[i-1]+2*D)
        bit.add(i,p+1,-c)
        ans += c

    print(ans)

solve()

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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 50;

int n, m;

char g[maxn + 5][maxn + 5];

int dp[maxn + 5][maxn + 5][maxn + 5][maxn + 5];

int sum[maxn + 5][maxn + 5];

inline int get_sum(int xl, int yl, int xr, int yr)
{
	return sum[xr][yr] - sum[xl][yr] - sum[xr][yl] + sum[xl][yl];
}

int px, py;

int ans = oo;

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	REP(i, 0, n) scanf("%s", g[i]);
	px = py = -1;
	REP(i, 0, n) REP(j, 0, m) if (g[i][j] == 'P') px = i, py = j;
	REP(i, 0, n) REP(j, 0, m)
		sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + (g[i][j] == '#');
	memset(dp, oo, sizeof dp);
	dp[0][0][n][m] = 0;
	REP(xl, 0, n) REP(yl, 0, m) for (int xr = n; xr > xl; --xr) for (int yr = m; yr > yl; --yr) if (dp[xl][yl][xr][yr] < oo)
	{
		REP(xmid, xl + 1, xr) REP(ymid, yl + 1, yr)
		{
			chkmin(dp[xl][yl][xmid][ymid], dp[xl][yl][xr][yr] + get_sum(xl, ymid, xmid, yr) + get_sum(xmid, yl, xr, ymid));
			chkmin(dp[xmid][ymid][xr][yr], dp[xl][yl][xr][yr] + get_sum(xl, ymid, xmid, yr) + get_sum(xmid, yl, xr, ymid));
			chkmin(dp[xl][ymid][xmid][yr], dp[xl][yl][xr][yr] + get_sum(xl, yl, xmid, ymid) + get_sum(xmid, ymid, xr, yr));
			chkmin(dp[xmid][yl][xr][ymid], dp[xl][yl][xr][yr] + get_sum(xl, yl, xmid, ymid) + get_sum(xmid, ymid, xr, yr));
		}
	}
	ans = oo;
	REP(xl, 0, px + 1) REP(yl, 0, py + 1) REP(xr, px + 1, n + 1) REP(yr, py + 1, m + 1)
		if (dp[xl][yl][xr][yr] < oo) 
		{
			chkmin(ans, dp[xl][yl][xr][yr] + min({get_sum(xl, yl, px + 1, py + 1), get_sum(xl, py, px + 1, yr), get_sum(px, yl, xr, py + 1), get_sum(px, py, xr, yr)}));
		}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 36096
N = str(input())
hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]
if int(N[-1]) in hon:
    print("hon")
elif int(N[-1]) in pon:
    print("pon")
elif int(N[-1]) in bon:
    print("bon")

Measured memory_bytes: 9180
#include <cstdio>

#define R register
#define cabs(_x) ((_x) < 0 ? -(_x) : (_x))
const int mod = 1e9 + 7;
int main()
{
	R int n, m; scanf("%d%d", &n, &m);
	if (cabs(n - m) > 1) return !printf("0\n");
	if (n == m)
	{
		R int ret = 2;
		for (R int i = 1; i <= n; ++i) ret = 1ll * ret * i % mod * i % mod;
		printf("%d\n", ret);
	}
	else
	{
		R int ret = 1;
		for (R int i = 1; i <= n; ++i) ret = 1ll * ret * i % mod;
		for (R int i = 1; i <= m; ++i) ret = 1ll * ret * i % mod;
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int bit1, bit2, bit3;
int n;
ll tmp;

void dfs(ll res, int bit, int &ans)
{
    if (res > pow(10, 9) || res > n)
        return;

    if (bit == 0b111)
    {
        ans++;
    }

    tmp = res * 10 + 3;
    bit1 = bit | 0b001;
    dfs(tmp, bit1, ans);
    tmp = res * 10 + 5;
    bit2 = bit | 0b010;
    dfs(tmp, bit2, ans);
    tmp = res * 10 + 7;
    bit3 = bit | 0b100;
    dfs(tmp, bit3, ans);
}

int main()
{
    int ans = 0;
    cin >> n;

    dfs(0, 0, ans);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
    long long int N;
    cin >> N;
    long long int num = 0;
    vector<long long int> v;
    vector<long long int> v_all;
    vector<long long int> v_ans;
    v.push_back(3);
    v.push_back(5);
    v.push_back(7);
    for (int i = 1; i < 10; i++)
    {
        vector<long long int> v_tmp;
        for (auto vv : v)
        {
            v_tmp.push_back(3 * pow(10, i) + vv);
            v_tmp.push_back(5 * pow(10, i) + vv);
            v_tmp.push_back(7 * pow(10, i) + vv);
        }
        v = v_tmp;
        for (auto vv : v)
        {
            v_all.push_back(vv);
        }

        std::sort(v_all.begin(), v_all.end());
    }
    // for (auto vv : v_all)
    for (auto it = v_all.begin(); it != v_all.end(); ++it)
    {
        // cout << *it << endl;
        // cout << vv << endl;
        string s = to_string(*it);
        // cout << s << endl;
        int c7 = 0, c5 = 0, c3 = 0;
        c3 = count(s.begin(), s.end(), '3');
        c5 = count(s.begin(), s.end(), '5');
        c7 = count(s.begin(), s.end(), '7');
        if (c3 > 0 && c5 > 0 && c7 > 0 && (int)(*it / 100) >= 1)
        {
            ;
        }
        else
        {
            // cout << c3 << ", " << c5 << ", " << c7 << endl;
            v_all.erase(std::remove(v_all.begin(), v_all.end(), *it), v_all.end());
            it--;
        }

        // if (*it == 3577)
        //     break;
    }
    for (auto vv : v_all)
    {
        if (vv <= N)
        {
            num++;
            // cout << vv << endl;
        }
    }
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 5748
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

ll fac[maxn],inv[maxn],n,k,a,b,c,ans;
const ll mod=998244353;

inline ll pw(ll a,ll b)
{
	ll ans=1,base=a;
	while(b)
	{
		if(b&1) ans=(ans*base)%mod;
		base=(base*base)%mod; b>>=1;
	}
	return ans;
}

inline ll C(ll N,ll M){return (fac[N]*inv[M]%mod)*inv[N-M]%mod;}

int main()
{
	fac[0]=1; inv[0]=1;
	rep(i,1,(maxn-5)) fac[i]=(fac[i-1]*i)%mod;
	rep(i,1,(maxn-5)) inv[i]=pw(fac[i],mod-2);
	cin>>n>>a>>b>>k;
	for(ll i=0;i<=n;i++)
	{
		ll res=k-i*a; if(res<0) break;
		if(res%b!=0||res/b>n) continue;
		ll x=i,y=res/b; ans=(ans+C(n,x)*C(n,y))%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 19296
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a = str(input())
b = ["abc", "acb", "bac", "bca", "cab", "cba"]
if a in b:
    print("Yes")
else:
    print("No")


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

public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static int Modpow(int a,int p,int m){int res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
//......................................@uthor_Alx..............................................
static long mod=(long)1e9+7;

public static void main(String[] args) throws  IOException{
                assign();
                int[] x=int_arr();
                int h=x[0],w=x[1],m=x[2];
                Set<Integer>[] col=new HashSet[300001];
                for(int i=0;i<=300000;i++){col[i]=new HashSet<>();}
                int[] row=new int[300001]; int maxc=0,maxr=0;
                for(int i=0;i<m;i++){
                	int[] e=int_arr();
                	row[e[0]]++;
                	col[e[1]].add(e[0]);
                }
                for(int i=0;i<=300000;i++){
                    maxc=Math.max(maxc,col[i].size());
                    maxr=Math.max(maxr,row[i]);
                }
                List<Integer> r=new ArrayList<>();
                List<Integer> c=new ArrayList<>();
                for(int i=0;i<=300000;i++){
                    if(col[i].size()==maxc){c.add(i);}
                    if(maxr==row[i]){r.add(i);}
                }
                int res=maxr+maxc-1;
                for(int z:r){
                    if(res==maxc+maxr) break;
                    for(int y:c){
                        if(!col[y].contains(z)){
                            res=maxr+maxc;
                            break;
                        }
                    }
                }

              out.write(res+"");
                out.flush();

    }
}

Measured memory_bytes: 135508
import heapq

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

A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))

heapq.heapify(A)

for i in range(M):
    x = (heapq.heappop(A))*(-1)
    heapq.heappush(A, -(x//2))

print(sum(A)*(-1))

Measured memory_bytes: 14180
import heapq

n,m = map(int,input().split())
a = list(map(int,input().split()))

hq = []
for i in a:
    heapq.heappush(hq,-i)

for _ in range(m):
    heapq.heappush(hq,-(-heapq.heappop(hq)//2))

print(-sum(hq))


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

using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    if((N-1)*(N-2)/2<K){
        cout << -1 << endl;
    }else{
        cout << N-1 + (N-1)*(N-2)/2 - K << endl;

        int count = (N-1)*(N-2)/2 - K;

        for(int i=2;i<=N;i++){
            cout << 1 << " " << i << endl;
        }
        
        for(int i=2;i<N;i++){
            for(int j=i+1;j<=N;j++){
                if(count==0){
                    return 0;
                }
                cout << i << " " << j << endl;
                count--;
            }
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  std::string s;

  std::cin >> s;

  int S = 0;

  for (const auto& c : s)
    S += c - '0';

  std::cout << (std::stoi(s) % S == 0 ? "Yes" : "No") << std::endl;
  
  return 0;
}


Measured memory_bytes: 888
package main

import (
	"fmt"
)

func main() {
	var n, m int64
	fmt.Scanf("%d %d", &n, &m)
	as := scanInts(n)
	bs := make([]int64, n)
	for i, a := range as {
		bs[i] = a / 2
	}
	l := slice_lcm(bs)
	for _, b := range bs {
		if l/b%2 != 1 {
			l = m + 1
		}
	}
	if l > m {
		fmt.Println(0)
	} else {
		muls := m / l
		fmt.Println((muls + 1) / 2)
	}
}

func scanInts(length int64) []int64 {
	ints := make([]int64, length)
	for i := range iter(0, length) {
		var x int64
		_, _ = fmt.Scan(&x)
		ints[i] = x
	}
	return ints
}

func iter(l int64, r int64) chan int64 {
	var i int64 = l
	c := make(chan int64)
	run := func() {
		for i < r {
			c <- i
			i += 1
		}
		close(c)
	}
	go run()
	return c
}

func gcd(a int64, b int64) int64 {
	x, y := a, b
	for true {
		if x%y == 0 {
			break
		}
		x, y = y, x%y
	}
	return y
}

func slice_gcd(ints []int64) int64 {
	if len(ints) == 0 {
		return 1
	}
	ans := ints[0]
	for i := range iter(1, int64(len(ints))) {
		ans = gcd(ans, ints[i])
	}
	return ans
}

func lcm(a int64, b int64) int64 {
	g := gcd(a, b)
	return a * b / g
}

func slice_lcm(ints []int64) int64 {
	if len(ints) == 0 {
		return 1
	}
	ans := ints[0]
	for i := range iter(1, int64(len(ints))) {
		ans = lcm(ans, ints[i])
	}
	return ans
}


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

int main() {
    string N;
    cin >> N;
    if (N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7') {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
string f(int k) { string s = ""; while (k--)s += '.'; return s; }
int main() {
	int n; scanf("%d", &n);
	if (n == 2) { printf("-1\n"); return 0; }
	if (n == 3) { printf("aab\nc.b\ncdd\n"); return 0; }
	string s1, s2; int sum = 0;
	if (n % 4 == 3) {
		s1 = f(sum), s2 = f(n - sum - 7);
		cout << s1 << "aabb..c" << s2 << "\n";
		cout << s1 << ".i..llc" << s2 << "\n";
		cout << s1 << ".imm..d" << s2 << "\n";
		cout << s1 << "h...n.d" << s2 << "\n";
		cout << s1 << "h...nk." << s2 << "\n";
		cout << s1 << "gjj..k." << s2 << "\n";
		cout << s1 << "g..ffee" << s2 << "\n";
		sum += 7;
	}
	else if (n % 4 == 2) {
		s1 = f(sum), s2 = f(n - sum - 6);
		cout << s1 << "aabb.c" << s2 << "\n";
		cout << s1 << ".i.llc" << s2 << "\n";
		cout << s1 << "hi...d" << s2 << "\n";
		cout << s1 << "h...kd" << s2 << "\n";
		cout << s1 << "gjj.k." << s2 << "\n";
		cout << s1 << "g.ffee" << s2 << "\n";
		sum += 6;
	}
	else if (n % 4 == 1) {
		s1 = f(sum), s2 = f(n - sum - 5);
		cout << s1 << "aabbc" << s2 << "\n";
		cout << s1 << "hii.c" << s2 << "\n";
		cout << s1 << "h..jd" << s2 << "\n";
		cout << s1 << "g..jd" << s2 << "\n";
		cout << s1 << "gffee" << s2 << "\n";
		sum += 5;
	}
	while (sum < n) {
		s1 = f(sum), s2 = f(n - sum - 4);
		cout << s1 << "aacd" << s2 << "\n";
		cout << s1 << "bbcd" << s2 << "\n";
		cout << s1 << "efgg" << s2 << "\n";
		cout << s1 << "efhh" << s2 << "\n";
		sum += 4;
	}
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = Integer.parseInt(a+""+b);
		int d = (int) Math.sqrt(c);
		if (d*d == c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}

}

Measured memory_bytes: 27036
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int p[100100];

int main(){
	cin>>n;
	int ans=0;
	int f=0;
	REP(i,n){
		cin>>p[i];
		p[i]--;
		if(p[i]==i){
			f++;
		}else{
			ans+=(f+1)/2;
			f=0;
		}
	}
	ans+=(f+1)/2;
	cout<<ans<<endl;
}
	
	

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main(){
    int w, h;
    cin >> w >> h;
    vector<int> a(w);
    for(int i = 0; i < w; i++)  cin >> a[i];
    sort(a.rbegin(), a.rend());
    priority_queue<int> q;
    for(int i = 0; i < h; i++){
        int x;  cin >> x;
        if(x)   q.push(x);
    }
    bool valid = true;
    for(int i = 0; i < w; i++){
        if(a[i] > q.size()){
            valid = false;
        }else{
            vector<int> v;
            while(a[i]-- > 0){
                int t = q.top();    q.pop();
                if(t-1 > 0) v.push_back(t-1);
            }
            for(int t : v)  q.push(t);
        }
    }
    valid &= (q.size() == 0);
    cout << valid << endl;
    return 0;
}


Measured memory_bytes: 3144
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int d;
	while (cin >> d) {
		int a = 0;
		for (int i = d; i < 600; i += d) {
			a += d * i*i;
		}
		cout << a << endl;
	}
}


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

int main(){
    string T,N;
    int a;
    int b;
    while(1){
        cin >> T;
        if(T == "-") break;
        cin >> a;
        for(int i=0; i<a; i++){
            cin >> b;
            N = T.substr(0, b);
            T.insert(T.size(), N);
            T.erase(0, b);
        }
        cout << T << endl;
    }
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define REP(i,n) for (long long i=0;i<(n);i++)
#define FOR(i,a,b) for (long long i=(a);i<(b);i++)
#define RREP(i,n) for(long long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl
#define dump(x)  cerr << #x << " => " << (x) << endl
#define dumpP(p) cerr << "( " << p.first << " , " << p.second << " )" << ends
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end())
#define MAX(vec) *max_element(vec.begin(), vec.end())
#define UNIQ(vec) vec.erase(unique(vec.begin(), vec.end()),vec.end()) //ソートの必要あり
#define IN(n,m)  (!(m.find(n) == m.end()))
#define ENUM(m) for (auto itr = m.begin(); itr != m.end(); ++itr)
#define dump_MAP(m) for(auto itr = m.begin(); itr != m.end(); ++itr) { cerr << itr->first << " --> "  << itr->second << endl; }
#define FINDL(vec,x) (lower_bound(vec.begin(),vec.end(),x) - vec.begin())
#define FINDU(vec,x) (upper_bound(vec.begin(),vec.end(),x) - vec.begin())
#define ROUND(N) setprecision(N)
#define ROUND_PRINT(N,val) cout << fixed;cout << setprecision(N) << val << endl
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define INARR(h,w,x,y) (0 <= y && y < h && 0 <= x && x < w)
#define EQ(a,b) (abs(a - b) < 1e-10)
using namespace std;
constexpr int dx[4] = {0,1,0,-1};
constexpr int dy[4] = {1,0,-1,0};
constexpr long double pi = M_PI;
constexpr double EPS = 1e-10;
constexpr long MOD = 1000000007;
constexpr short shINF = 32767;
constexpr long loINF = 2147483647;
constexpr long long llINF = 9223372036854775807;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL,LL> pr;
typedef vector<bool> VB;
typedef vector<pr> VP;
typedef priority_queue<pr,vector<pr>,greater<pr>> pq;

template<typename T>
void countingSort(vector<T> &seq) {
    int n = seq.size();
    int maxValue = *max_element(seq.begin(), seq.end());
    vector<int> index(maxValue+1,0);
    vector<T> cp(seq);
    for (int i = 0;i < n;i++) index[seq[i]]++;
    for (int i = 0;i < maxValue;i++) index[i+1] += index[i];
    for (int i = n-1;i >= 0;i--) {
        seq[index[cp[i]]-1] = cp[i];
        index[cp[i]]--;
    }
}

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    VL A(N);
    REP(i,N) cin >> A[i];
    countingSort(A);
    REP(i,N-1) cout << A[i] << " ";
    cout << A[N-1] << endl;
}



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


int main()
{
	int sx, sy, tx, ty,dx,dy;
	cin >> sx >> sy >> tx >> ty;
	dx = tx - sx;
	dy = ty - sy;
	cout << string(dy, 'U') << string(dx, 'R') << string(dy, 'D') << string(dx, 'L') << "L" << string(dy + 1, 'U') << string(dx + 1, 'R') << "DR" << string(dy + 1, 'D') << string(dx + 1, 'L') << "U" << endl;
	return 0;


}	

Measured memory_bytes: 256