akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let x = read::<String>();
    let xn = x.parse::<u64>().ok().unwrap();
    let p = xn/100;
    let l = x.len();
    let le = if l > 1 {u64::from((x.bytes().nth(l-2).unwrap() - 48)*10 + x.bytes().nth(l-1).unwrap() - 48)} else{
        999999
    };
    if le <= 5*p {
        println!("{}",1);
    }else {
        println!("{}",0);
    }
    
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<std::pair<lint,lint>>a(n);
    for(lint i=0;i<n;i++){
        std::cin>>a.at(i).first>>a.at(i).second;
    }
    double ans=0;
    for(lint i=0;i<n;i++){
        for(lint j=i+1;j<n;j++){
            ans+=std::hypot(a.at(i).first-a.at(j).first,a.at(i).second-a.at(j).second);
        }
    }
    std::cout<<ans*2/n<<'\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;


int main() {

	string S;

	cin >> S;

	cout << (!(S[0] == S[1] && S[0] == S[2]) ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}


int main(){
  ll a,b;
  cin >> a >> b;
  FOR(i,0,1000000){
    ll ans = i;
    ll x = i*8/100;
    ll y = i*10/100;
    if(x==a && y==b){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        struct Color
        {
            internal string name;
            internal int R, G, B;

            public Color(string name, int R, int G, int B)
            {
                this.name = name;
                this.R = R;
                this.G = G;
                this.B = B;
            }
        }

        static void Main(string[] args)
        {
            Color[] colors = new Color[]
            {
                new Color("black",0,0,0),
                new Color("blue",0,0,255),
                new Color("lime",0,255,0),
                new Color("aqua",0,255,255),
                new Color("red",255,0,0),
                new Color("fuchsia",255,0,255),
                new Color("yellow",255,255,0),
                new Color("white",255,255,255)
            };

            StringBuilder sb = new StringBuilder();

            while (true)
            {
                string input = Console.ReadLine();

                if (input == "0") break;

                int r = Convert.ToInt32(input.Substring(1, 2), 16);
                int g = Convert.ToInt32(input.Substring(3, 2), 16);
                int b = Convert.ToInt32(input.Substring(5, 2), 16);

                int index = 0;
                double min = double.MaxValue;

                for (int i = 0; i < colors.Length; i++)
                {
                    int R = colors[i].R;
                    int G = colors[i].G;
                    int B = colors[i].B;

                    double d = Math.Sqrt((R - r) * (R - r) + (G - g) * (G - g) + (B - b) * (B - b));

                    if (d < min)
                    {
                        index = i;
                        min = d;
                    }
                }
                sb.AppendLine(colors[index].name);
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 8908
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl
 
#define ld double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
 
#define INF 1000000000000000000
ll dp[100007];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double pi= 3.14159265358979323846;
    ll n,w1,w=100000;
    cin>>n>>w1;
    ll ma=0;
    rep(i,100007)
    {
        dp[i]=INF;
    }
    rep(j,n)
    {
        // debug(j);
        ll x,y;
        cin>>y>>x;
 
        for(ll i=w-x;i>=0;i--)
        {
            
 
            if(dp[i])
            { 
                dp[i+x]=min(y+dp[i],dp[i+x]);
            }
        }dp[x]=min(y,dp[x]);
    }
    // rep(i,91ll)
    // {
    // 	debug(i);
    // 	debug(dp[i]);
    // }
    for(ll i=100000;i>=1;i--)
    {
        if(dp[i]<=w1)
        {
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1024
#include<iostream>
#include<queue>
using namespace std;
static const int N = 100;
static const int INF = (1<<21);

int n,M[N][N];
int d[N];

void bfs(int s)
{
	queue<int> q;
	q.push(s);
	for(int i=0;i<n;i++) d[i] = INF;
	d[s] = 0;
	int u;
	while(!q.empty()){
		u = q.front();q.pop();
		for(int v=0;v<n;v++){
			if(M[u][v] == 0)continue;
			if(d[v] != INF)continue;
			d[v] = d[u]+1;
			q.push(v);
		}
	}
	for(int i=0;i<n;i++){
		cout << i+1 << " " <<((d[i] == INF)?(-1):d[i])<<endl;
	}
}

int main()
{
	int u,k,v;
	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			M[i][j] = 0;
		}
	}
	
	for(int i=0;i<n;i++){
		cin >> u >> k;
		u--;
		for(int j=0;j<k;j++){
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}
	
	bfs(0);
	
	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a * b == 15) {
    cout << "*" << endl;
  } else if (a + b == 15) {
    cout << "+" << endl;
  } else {
    cout << "x" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
#define MOD 1000000007
int main(){
    int n;cin >> n;
    string u,d;cin >> u >> d;
    long long ans;
    bool ver;
    int i=0;
    if(u[0] == d[0]){
        ver = true;
        ans = 3;
        i++;
    }
    else{
        ver = false;
        ans = 3*2;
        i +=2;
    }
    while(i < n){
        if(ver && (u[i] == d[i])){
            ans = (ans*2)%MOD;
            ver = true;
            i++;
        }
        else if(ver && (u[i] != d[i])){
            ans = (ans*2)%MOD;
            ver = false;
            i += 2;
        }
        else if((!ver) && (u[i]== d[i])){
            ver = true;
            i ++;
        }
        else if((!ver) && (u[i] != d[i])){
            ans = (ans*3)%MOD;
            ver =false;
            i +=2;
        }
        else{
            cout << "error" << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

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

//const int INF = 1001001001;
const ll INF = 1000000000000000000;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	vector<double> b(n);
	rep(i,n) {
		ll x;
		cin >> x;
		if (x == 0) {
			cout << 0 << endl;
			return 0;
		}
		a[i] = x;
		double keta = log10(x);
		b[i] = keta;
	}
	
	double sum = 0;
	rep(i,n) sum += b[i];
	if (sum > 18) {
		cout << -1 << endl;
		return 0;
	}
	
	ll ans = 1;
	rep(i,n) {
		ans *= a[i];
		if (ans > INF) {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
	return 0;
} 


Measured memory_bytes: 4904
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

const int MAX = 1000000001;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    set<int> s;
    rep(i, n) s.insert(a.at(i));
    string ans = "YES";
    if (s.size() != n) ans = "NO";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13528
MAX = 10**6
N = int(input())
A = list(map(int, input().split()))
B = [0] * (MAX+1)
for i in range(N):
  B[A[i]] += 1
L = [0] * (MAX+1)
for k in range(MAX+1):
  if(B[k] >= 1 and L[k] == 0):
    tmp = 2*k
    while(tmp <= MAX):
      L[tmp] = 1
      tmp += k

ans = 0
for i in range(N):
  if(B[A[i]] == 1 and L[A[i]] == 0):
    ans += 1
print(ans)

Measured memory_bytes: 104788
#from collections import Counter

S = list(input())
T = list(input())

dics = {}
dicst= {}
sets = set()
sett = set()
flag = True
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in sets and t in sett:
        if dics[s] != t or dicst[t] != s:
            flag = False
            break
    elif s in sets and not(t in sett):
        flag = False
        break
    elif t in sett and not(s in sets):
        flag = False
        break
    else:
        sets.add(s)
        sett.add(t)
        dics[s] = t
        dicst[t] = s
    
print('Yes') if flag else print('No')

Measured memory_bytes: 6704
N,K = map(int,input().split())
H = list(map(int,input().split()))

dp = [0]

for i in range(1,N):
  h = H[i]
  dp.append(min(dp[-j-1]+abs(h-H[i-j-1]) for j in range(min(i,K))))

print(dp[-1])

Measured memory_bytes: 59232
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pll, int> plp;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//--------------------------------//

int N, Q;
int sum[312345];

int main() {
	cin >> N >> Q;
	REP(i, N) {
		int c; scanf("%d", &c);
		sum[c]++;
	}
	
	FOR(i, 1, 312345) sum[i] += sum[i - 1];
	
	while (Q--) {
		int q; scanf("%d", &q);
		
		int l = 0, r = q;
		while (r - l > 1) {
			int m = (l + r) / 2;
			bool ok = false;
			
			for (int i = q; i <= 312345; i += q) {
				if (sum[i - 1] - sum[i - q + m - 1]) ok = true;
			}
			if (ok) l = m;
			else r = m;
		}
		
		cout << l << endl;
	}
	
	return 0;
}

Measured memory_bytes: 4336
N = input()
S = input()
ans = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            a = S.find(str(i))
            if a == -1:
                continue
            b = S.find(str(j), a+1)
            if b == -1:
                continue
            c = S.find(str(k), b+1)
            if c == -1:
                continue
            ans+=1

print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <map>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fore(i,a,b) for(int i = (int)a; i < (int)b; i++)
#define fr(i,a,b) for(int i = (int)a - 1; i >= (int)b; i--)
#define inf INT32_MAX
#define N 200005
#define mod 1000000000 + 7

using namespace std;

typedef long long ll;
typedef pair<int,int> pr;

inline void solve()
{
    int n;
    cin >> n;
    vector<vector<ll>> arr(n);
    fore(i,0,n)
    {
        string s;
        cin >> s;
        fore(j,0,s.size())
        arr[i].push_back(s[j] - 'a');
        sort(arr[i].begin(),arr[i].end());
    }
    map<vector<ll>,ll> mp;
    fore(i,0,n)
    {
        mp[arr[i]]++;
    }
    ll otv = 0;
    for (pair<vector<ll>, ll> x : mp)
    {
        otv += (x.second * (x.second - 1))/2;
    }
    cout << otv;
}



int main()
{
    fast;
    solve();
    return 0;
}

Measured memory_bytes: 33920
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Main{
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n;
		while((n=scanner.nextInt())>0){
			int a=0,b=0;
			for(int i=0;i<n;i++){
				int aa=scanner.nextInt(),bb=scanner.nextInt();
				if(aa>bb)a+=aa+bb;
				else if(aa<bb)b+=aa+bb;
				else {a+=aa;b+=bb;}
			}
			System.out.println(a + " "+b);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;

bool check(string s)
{
    int len = s.length();
    if (s.substr(0, len / 2) == s.substr(len / 2)) return true;
    else return false;
}

signed main()
{
    string S;
    cin >> S;

    int len = S.length();
    for (int i=len-2; i>=2; i-=2) {
        if (check(S.substr(0, i))) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<int,int>pi;
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0)
#define bitseT(y,pos) (1<<pos)|y
#define bitchecK(y,pos) ((1<<pos)&y)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
int fx[]={1,0,-1,0};
int fy[]={0,1,0,-1};
const int N=4010;
int x,y;
int dp[N+2][16001];
vector<int>v;
int rec(int i,int w)
{
//    cout<<i<<" "<<w<<endl;
    if(i>=v.size())
    {
        if(w==8000)return 1;
        else return 0;
    }
    if(dp[i][w]!=-1)return dp[i][w];
    return dp[i][w]=max(rec(i+1,w+v[i]),rec(i+1,w-v[i]));
}
int main()
{
    IOS;
    string s;cin>>s;
    int pos=0;
    vector<int>aa[2];
    int i=0;
    int l=s.length();
    while(i<s.length())
    {
        int cnt=0;
        while(s[i]=='F'&&i<l)cnt++,i++;
        aa[pos].pb(cnt);
//        cout<<i<<" "<<pos<<" "<<cnt<<endl;
        cnt=0;
        while(s[i]=='T'&&i<l)i++,cnt++;
        if(cnt%2==1)pos=1-pos;
    }
    int x,y;cin>>x>>y;
    v=aa[0];
//    prinT(v,v.size());
    int z=0;
    if(v.size()>=1)z=v[0];
    x+=8000,y+=8000;
    memset(dp,-1,sizeof dp);
    int f1=rec(1,x-z);
    v=aa[1];
//    cout<<"OK"<<endl;
    memset(dp,-1,sizeof dp);
    int f2=rec(0,y);
//    prinT(v,v.size());
    //    cout<<f1<<" "<<f2<<endl;
    if(f1==1&&f2==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
/*
FFFTTFFFTFTFTTF
FFTFFTTFFFTTFFFTFFFF

FFTFFTFFTFFTFF
7 0
*/






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

int main() {
    string s, t;
    cin >> s >> t;
    vector<vector<int>> dp(s.size()+1, vector<int>(t.size()+1));
    for (int i = 1; i <= (int)s.size(); i++)
        for (int j = 1; j <= (int)t.size(); j++) {
            dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
            if (s[i-1] == t[j-1])
                dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
        }
    int i = s.size();
    int k = t.size();
    int len = dp[i][k];
    string ans;
    ans.resize(len);
    while (len) {
        if (s[i-1] == t[k-1]) {
            ans[--len] = s[--i];
            k--;
        } else if (dp[i][k] == dp[i-1][k])
            i--;
        else
            k--;
    }
    cout << ans;
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        int a = scanner.nextInt();
        String s = scanner.next();

        if(a>=3200){
        System.out.println(s);
        }else{
        System.out.println("red");
        }
    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 21332
#define ll long long int
#include<bits/stdc++.h>
using namespace std;
int main()
{


ll n,sum=0,sum1=0,sum2=0;
cin>>n;
ll a[n];
for(int i=0;i<n;i++)
{
    ll k;
    cin>>k;
    a[i]=k;
    sum=sum+k;
}
sum=sum/n;

for(int i=0;i<n;i++)
{
    ll x=(a[i]-sum)*(a[i]-sum);
    ll y=(a[i]-(sum+1))*(a[i]-(sum+1));
    sum1=sum1+x;
    sum2=sum2+y;
}
cout<<min(sum1,sum2);

}


Measured memory_bytes: 256
using System;
using System.Linq.Expressions;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            int[] a = new int[10000];
            int min = 1000000, max = -1000000;
            int n;
            long sum = 0;
            n = Convert.ToInt32(Console.ReadLine());
            s = Console.ReadLine();
            string[] words = s.Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(words[i]);
                sum += a[i];
                if (a[i] > max)
                {
                    max = a[i];
                }
                if (a[i] < min)
                {
                    min = a[i];
                }
            }
            Console.WriteLine("{0} {1} {2}", min, max, sum);
        }
    }
}


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

bool solve(){
    int n;
    cin>>n;
    vector<int> t(n+1),x(n+1),y(n+1);
    rep1(i,n){
        cin>>t[i]>>x[i]>>y[i];
    }
    rep1(i,n){
        int cost = abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        int dt = t[i]-t[i-1];
        if(dt<cost || (dt-cost)&1){
            return false;
        }
    }
    return true;
}

int main(void){
    cout<<((solve()) ? "Yes" : "No")<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> //tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric>
using namespace std;

long long i_sqrt(int n) {
    long long ret = 1;
    while ((ret+1)*(ret+1) <= n) {
        ret++;
    }
    return ret;
}

int main() {
    string a, b;
    cin >> a >> b;
    long long ab = stoi(a + b);
    cout << (i_sqrt(ab) * i_sqrt(ab) == ab ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<math.h>
typedef long long ll;
using namespace std;
int main()
{   
    int t;
    cin >> t;
    string s;
    int a = 0, b = 0, c = 0, d = 0;
    while (t--) {
        cin >> s;
        if (!s.compare("AC")) a++;
        else if (!s.compare("WA")) b++;
        else if (!s.compare("TLE")) c++;
        else if (!s.compare("RE")) d++;
    }
    cout << "AC x " << a <<endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
    return 0;
}

Measured memory_bytes: 3624
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int cnt[2];
int maxi[2];
int main()
{
	int n,i,j,k,x,y,ans,curr,temp,m;
	int tc;
	cin >> n >> m;
	vector<int> va;
	cnt[1]++;
	maxi[1] = 1;
    temp = m;
    m--;
    for(i=2;i<=temp;i++) {
        cnt[i % 2]++;
        maxi[i % 2] = max(maxi[i % 2], i);
        m--;
    }
    vector<pair<int,int> > chaeng;
    int now = 1;
    i = 0;
    int l, r;
    l = now;
    r = now + maxi[i % 2];
    while(cnt[i % 2] > 0) {
        chaeng.push_back({l, r});
        l++;
        r--;
        cnt[i % 2]--;
    }
    now += maxi[i % 2] + 1;
    i++;
    l = now;
    r = now + maxi[i % 2];
    while(cnt[i % 2] > 0) {
        chaeng.push_back({l, r});
        l++;
        r--;
        cnt[i % 2]--;
    }
    for(auto x : chaeng) cout << x.first << " " << x.second << endl;
	return 0;
}


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

int main(){
    long long int n, k;
    cin >> n >> k;
    // a % b >= k
    // --> k+1 <= a, b <= n

    if(k == 0){
        cout << n * n << endl;
        return 0;
    }

    long long int count = 0;
    for(int b=k+1; b<=n; b++){
        // 0 * b + k  ~  0 * b + (b-1)
        // 1 * b + k  ~  1 * b + (b-1)
        // ...
        // n/b * b + k  ~  n
        count += n/b * ((b - 1) - k + 1) + max((n - (n/b * b + k) + 1),0LL);
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>
#include <iomanip>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

template <typename T> ostream& operator<<(ostream& out, vector<T> &v){
  for (int i = 0; i < (int)v.size(); i++) {
    out<<v[i]<<' ';
  }
  return out;
}

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

  int n; cin >> n;
  cout << (1000 - n % 1000) % 1000 << endl;









  return 0;
}


Measured memory_bytes: 3656
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute20_3();
	}
	
	private static void execute20_3() {
		try (Scanner sc = new Scanner(System.in)) {
			String n = sc.next();
			
			int sum =0;
			for(int i=0;i<n.length();i++) {
				int num = Character.getNumericValue(n.charAt(i));
				sum+=num;
			}
			if(sum%9==0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> x(n);
  for (ll i = 0; i < n; ++i) {
    cin >> x[i];
  }

  vector<ll> r;
  vector<ll> l;
  for (ll i = 0; i < n; ++i) {
    if (x[i] < 0) l.push_back(x[i]);
    else r.push_back(x[i]);
  }
  reverse(l.begin(), l.end());

  ll ans = 1e18;
  for (ll i = k-1; i >= 0; --i) {
    ll j = k-1-i-1;
    if (i < r.size() && j < 0) {
      ans = min(ans, r[i]);
    }
    if (i < r.size() && j < l.size()) {
      ans = min(ans, r[i] + abs(r[i]-l[j]));
    }

    if (i < l.size() && j < 0) {
      ans = min(ans, abs(l[i]));
    }
    if (i < l.size() && j < r.size()) {
      ans = min(ans, abs(l[i]) + abs(l[i]-r[j]));
    }
  }

  cout << ans << endl;

  return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;

#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define ferrari ios_base::sync_with_stdio(false); cin.tie(NULL)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << ' ' << b << ' ' << c;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] d = new int[N];
        for (int i = 0; i < N; i++) {
            d[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        int i = 0;
        int j = 0;
        int ans = 0;
        for (i = 0; i < N - 1; i++) {
            for (j = i+1; j < N; j++) {
                ans += d[i] * d[j];
            }
        }

        System.out.println(ans);
    }
}


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


using namespace std;
#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 repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int h, w;
int a[85][85], b[85][85];
bool dp[85][85][160 * 80 * 2];
void solve() {
    cin >> h >> w;
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) cin >> b[i][j];

    dp[0][0][160 * 80] = true;
    rep(i, h) rep(j, w) rep(k, 160 * 80 * 2) {
        if (!dp[i][j][k]) continue;
        auto s = abs(a[i][j] - b[i][j]);
        dp[i + 1][j][k + s] |= dp[i][j][k];
        dp[i + 1][j][k - s] |= dp[i][j][k];
        dp[i][j + 1][k + s] |= dp[i][j][k];
        dp[i][j + 1][k - s] |= dp[i][j][k];
    }

    int ans = iinf;
    rep(i, 160 * 80 * 2) if (dp[h][w - 1][i]) mins(ans, abs(i - 160 * 80));
    cout << ans << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 171136
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
 
int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if (s == u)
    a--;
  else if(t == u)
    b--;
  cout << a << " " << b << endl;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
  int n;
  double ans = 0.0;
  cin >> n;
  vector<int> d(n);
  rep(i,n){
    cin >> d[i];
  }
  rep(i,n){
    ans += 1.0/d[i];
  }
  cout << setprecision(16) << 1.0/ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {

	string s;
	cin >> s;
	int n = s.size();

	string as;
	for (int i = 0; i < n; i = i + 2) {

		as = as + s[i];

		}

	cout << as << endl;

	}
	

Measured memory_bytes: 640
H, W, K = map(int, input().split())
graph = []
for i in range(H):
    graph.append(list(input()))
    
ans = 0
for i in range(2**H):
    for j in range(2**W):
        black = 0
        for k in range(H):
            for l in range(W):
                if((i>>k)&1 == 0 and (j >>l)&1 == 0 and graph[k][l] == "#"):
                    black += 1
        if(black == K):
            ans += 1
print(ans)   

Measured memory_bytes: 9004
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
B = [int(x) for x in stdin.readline().rstrip().split()]
C = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0
for i in A:
    ans += B[i-1]
for j in range(0,N-1):
    if A[j+1] - A[j] == 1:
        ans += C[A[j]-1]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

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

typedef long long int int64;


const int N = (int) 1e5 + 100;
vector <int> v[N];


int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif


	int n, m;
	scanf("%d%d", &n, &m);

	for (int i = 0; i < n; i++)
	{
		int x;
		scanf("%d", &x);
		v[x % m].push_back(x);
	}

	for (int i = 0; i < m; i++)
		sort(v[i].begin(), v[i].end() );

	int ans = 0;
	for (int i = 0; 2 * i <= m; i++)
	{
		if ( (2 * i) % m == 0)
		{
			ans += (int) v[i].size() / 2;
			continue;
		}
		int pL = 0, pR = 0;
		for (int j = 0; j + 1 < (int) v[i].size(); j++)
			if (v[i][j] == v[i][j + 1] )
			{
				pL++;
				j++;
			}
		for (int j = 0; j + 1 < (int) v[m - i].size(); j++)
			if (v[m - i][j] == v[m - i][j + 1] )	
			{
				pR++;
				j++;
			}
		int p = min(v[i].size(), v[m - i].size() );
		int bst = 0;
		for (int j = 0; j <= p; j++)
		{
			int cur = j + min(pL, ( (int) v[i].size() - j) / 2) + min(pR, ((int) v[m - i].size() - j) / 2);
			bst = max(bst, cur);
		}
		ans += bst;
	}

	printf("%d\n", ans);

	return 0;
}



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

int main() {
    int m, d; cin >> m >> d;

    int ans = 0;
    for (int i = 2; i <= m; i++) {
        for (int j = 1; j <= d; j++) {
            int d10 = j / 10;
            if (d10 < 2) continue;
            int d1 = j % 10;
            if (d1 < 2) continue;
            if (i == d10 * d1) {
                ans++;
                //printf("%d %d\n", i, j);
            }
        }
    }
   cout << ans << endl;
}

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

using ll = long long;
const ll amari = 1e9+7;
#define ben(a) a.begin(),a.end()

int main(){
	string s;
	int n;
	cin >> n >> s;
	int r = 0,b = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'R')r++;
		else b++;
	}

	if(b < r)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
data=[]
data.append(s[1:].count('E'))
for i in range(1,n):
    d=data[-1]
    if s[i-1]=='W':d+=1
    if s[i]=='E':d-=1
    data.append(d)
    
print(min(data))

Measured memory_bytes: 15564
# -*- coding:utf-8 -*-

"""考え方
[入力例１]
10000

N = A * B より

A=10000, B=1
A=5000, B=2
A=2500, B=4
A=1250, B=8
A=1000, B=10
A=500, B=20
A=250, B=40
A=200, B=50
A=125, B=80
A=100, B=100
A=50, B=200  <-- ここまで来ると、Bの桁数が大きくなるいっぽうなので、最小値が更新されることはもうない
...

つまり、i = 1 ~ √N までを全探索しても、N<=10**10なので、計算量は高々10**5 これは間に合う。

"""
import math

def F(A, B):
    """ 10進表記における、Aの桁数とBの桁数のうち大きい方を返す """
    def keta(n):
        """ 桁数を求める """
        ans = 1
        while True:
            n = n // 10
            if n == 0:
                break
            ans += 1
        return ans
    
    return max(keta(A), keta(B))
    

def solve():
    N = int(input())
    ans = float("inf")

    for i in range(1, math.ceil(math.sqrt(N))+1):
        A = i
        if N%A != 0: continue
        B = int(N/A)

        ans = min(ans, F(A, B))

    print(ans)

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u64 = itr.next().unwrap().parse().unwrap();
    let mut ans = 0u64;
    let mut i = 1u64;
    // n = m * q + q
    while i * i <= n {
        if n % i == 0 {
            let a = n / i - 1;
            let b = n / (n / i) - 1;
            if a > 0 && n / a == n % a {
                ans += a;
            }
            if b > 0 && n / b == n % b {
                ans += b;
            }
        }
        i += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] d = new int[n];

    for (int i = 0; i < n; i++) {
      d[i] = sc.nextInt();
    }

    Arrays.sort(d);

    int x = d[n/2-1];
    int y = d[n/2];
    System.out.println(y-x);
  }

}


Measured memory_bytes: 52180
#include<stdio.h>
int main(){
int a[10001],b[501],c,d,i,j,e=0;
scanf("%d\n",&c);
for(i=0;i<c;i++){
scanf("%d ",&a[i]);
}
scanf("\n");
scanf("%d\n",&d);
for(i=0;i<d;i++){
scanf("%d ",&b[i]);
}
scanf("\n");
for(i=0;i<d;i++){
for(j=0;j<c;j++){
if(b[i]==a[j]){
e++;
break;
}
}
}
printf("%d\n",e);
return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>

int main() {
	int N;
	int Ni[100000];
	int i;
	int K;
	int count = 0;

	scanf("%d %d", &N, &K);

	for (i = 0; i < N; i++) {
		scanf("%d", &Ni[i]);

	}

	for (i = 0; i < N; i++) {
		if (Ni[i] >= K) {
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    ll a,b;
    cin>>a>>b;
    a--;
    if(a!=-1){
        ll ans_1=0;
        if(a%4==0){
            ans_1=a;
        }
        else if(a%4==3){
            ans_1=0;
        }
        else if(a%4==2){
            ans_1=(((a^2)^(a-1))^a);
        }
        else{
            ans_1=(a^(a-1));
        }

        ll ans_2=0;
        if(b%4==0){
            ans_2=b;
        }
        else if(b%4==3){
            ans_2=0;
        }
        else if(b%4==2){
            ans_2=(((b^2)^(b-1))^b);
        }
        else{
            ans_2=(b^(b-1));
        }
        cout<<(ans_2^ans_1)<<endl;
    }
    else{
        ll ans_2=0;
        if(b%4==0){
            ans_2=b;
        }
        else if(b%4==3){
            ans_2=0;
        }
        else if(b%4==2){
            ans_2=(((b^2)^(b-1))^b);
        }
        else{
            ans_2=(b^(b-1));
        }
        cout<<ans_2<<endl;
    }




    return 0;
}


Measured memory_bytes: 256
def binary_search(a,b,j):
   left=j
   right=N
   while left<right-1:
      mid=(left+right)//2
      if L[mid]<a+b:
         left=mid
      else:
         right=mid

   return left

N=int(input())
L=list(map(int,input().split()))
L.sort()

count=0

for i in range(N):
   for j in range(N):
      if j<=i:
         continue
      if j==N-1:
         continue
      a=L[i]
      b=L[j]

      c_index=binary_search(a,b,j)
      count+=c_index-j

print(count)

Measured memory_bytes: 46940
#include <iostream>
#include <string> 
#include <cstring>
#include <map>

using namespace std;

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

   if (a <= b) {
      ans = b - a - w;
   } else {
      ans = a - b - w;
   }

   if (ans <= 0) { ans = 0; }
   cout << ans << endl;

}

Measured memory_bytes: 256
#include<cstdio>
int main(){
    char str[20];
    while(scanf("%s",str)!=EOF){
        int d[10];
        for(int i=0;i<10;i++){
            d[i]=str[i]-'0';
        }

        for(int i=0;i<9;i++){
            for(int j=0;j<10-i-1;j++){
                d[j]=(d[j]+d[j+1])%10;
            }
        }
        printf("%d\n",d[0]);
    }

    return 0;
}

Measured memory_bytes: 968
#include<bits/stdc++.h>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e5+5;

ll g1(int);
ll g2(int);

ll mem1[N], mem2[N];
bool u1[N], u2[N];

int n, a[N];
ll inf = 1e18;

ll g1(int k){
	ll &res = mem1[k];
	if(!u1[k]){
		res = -inf;
		for(int j=k;j<n;++j){
			ll call = g2(j+1);
			res = max(res, call);
		}
		ll cur = abs(a[n]-a[k-1]);
		res = max(res, cur);
		u1[k] = 1;
	}
	//cerr<<"?1 "<<k<<' '<<res<<endl;
	return res;
}

ll g2(int k){
	ll &res = mem2[k];
	if(!u2[k]){
		res = inf;
		for(int j=k;j<n;++j){
			ll call = g1(j+1);
			res = min(res, call);
		}
		ll cur = abs(a[n]-a[k-1]);
		res = min(res, cur);
		u2[k] = 1;
	}
	//cerr<<"?2 "<<k<<' '<<res<<endl;
	return res;
}

int main(){
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);//cout.precision(12);cout<<fixed;
	
	int z, w;
	
	cin>>n>>z>>w;
	for(int i=1;i<=n;++i) cin>>a[i];
	
	a[0] = w;
	
	cout<<g1(1)<<endl;
	
	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int n,m,k,ans=0,fact[maxn],invfact[maxn];

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> m >> k;
	fact[0]=invfact[0]=1;
	rep(maxn-1) fact[i+1]=fact[i]*(i+1)%MOD;
	rep(maxn) invfact[i]=inverse(fact[i]);
	rep1(i,k+1) ans=add(ans,m*Pow(m-1,n-1-i)%MOD*fact[n-1]%MOD*invfact[i]%MOD*invfact[n-1-i]%MOD);
	print1(ans);
	return 0;
}

Measured memory_bytes: 6800
#include "bits/stdc++.h"
using namespace std;
int main() {
	int sum;
	string s, frag = "Yes";
	cin >> s;
	sum = s.length();
	for (int i = 0; i <= sum; i++) {
		if (i % 2 == 0) {
			if (s[i] == 'L') frag = "No";
		}
		else {
			if (s[i] == 'R') frag = "No";
		}
	}
	cout << frag;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

        int col = sc.nextInt();
        int row = sc.nextInt();

        for(int i = 0; i < col;i++){
            for(int j = 0 ;j < row;j++){
                if(sc.next().equals("snuke")){
                    System.out.println();
                    System.out.println(sn.alpha(j+1)+(i+1));
                }

            }
        }


    }

    public String alpha(int a){

        switch(a){
        case 1:
            return "A";
        case 2:
            return "B";
        case 3:
            return "C";
        case 4:
            return "D";
        case 5:
            return "E";
        case 6:
            return "F";
        case 7:
            return "G";
        case 8:
            return "H";
        case 9:
            return "I";
        case 10:
            return "J";
        case 11:
            return "K";
        case 12:
            return "L";
        case 13:
            return "M";
        case 14:
            return "N";
        case 15:
            return "O";
        case 16:
            return "P";
        case 17:
            return "Q";
        case 18:
            return "R";
        case 19:
            return "S";
        case 20:
            return "T";
        case 21:
            return "U";
        case 22:
            return "V";
        case 23:
            return "W";
        case 24:
            return "X";
        case 25:
            return "Y";
        case 26:
            return "Z";

        }
        return null;
    }
}

Measured memory_bytes: 10756
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int h, w;
    cin >> h >> w;

    string S[h];
    REP(i, h) cin >> S[i];

    REP(i, w + 2) cout << '#';
    cout << endl;
    REP(i, h) cout << '#' << S[i] << '#' << endl;
    REP(i, w + 2) cout << '#';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <cstdio>
#include <cstring>

using namespace std;

const char* INSERT       = "insert";
const char* DELETE       = "delete";
const char* DELETE_FIRST = "deleteFirst";
const char* DELETE_LAST  = "deleteLast";

struct Node {
    int val;
    Node *next;
    Node *prev;
};

Node *head, *tail;

vector<Node*> cache;

int main(void) {

    int n;
    cin >> n;

    head = new Node;
    head->val = -1;

    tail = new Node;
    tail->val = -1;
    tail->next = head;
    tail->prev = head;

    head->next = tail;
    head->prev = tail;

    char command[12];
    for (int i = 0; i < n; ++i) {
        cin >> command;
        if (strncmp(command, INSERT, 6) == 0) {
            int x;
            cin >> x;
            Node *newnode;
            if (cache.size() > 0) {
                newnode = cache.back();
                cache.pop_back();
            }
            else {
                newnode = new Node;
            }
            newnode->val = x;
            newnode->next = head->next;
            newnode->prev = head;
            head->next->prev = newnode;
            head->next = newnode;
        }
        else if (strncmp(command, DELETE_FIRST, 11) == 0) {
            Node *node = head->next;
            node->next->prev = head;
            head->next = node->next;
            cache.push_back(node);
        }
        else if (strncmp(command, DELETE_LAST, 10) == 0) {
            Node *node = tail->prev;
            tail->prev = node->prev;
            node->prev->next = tail;
            cache.push_back(node);
        }
        else if (strncmp(command, DELETE, 6) == 0) {
            int x;
            cin >> x;
            Node *node = head->next;
            while (node != tail) {
                if (node->val == x) {
                    node->next->prev = node->prev;
                    node->prev->next = node->next;
                    cache.push_back(node);
                    break;
                }
                node = node->next;
            }
        }
    }

    Node *node = head->next;
    if (node != tail) {
        printf("%d", node->val);
        node = node->next;
        while (node != tail) {
            printf(" %d", node->val);
            node = node->next;
        }
    }
    printf("\n");

    delete head;
    delete tail;

    return 0;
}

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

int main() {
  int K;
  string S;
  cin >> K >> S;
  string res;
  if (S.size() <= K){
    res = S;
  } else {
    res = S.substr(0, K) + "...";
  }
  cout << res << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,K;
    cin >> N >> K;
    vector<double> A(N);
    rep(i,N) cin >> A[i];
    // K回の操作で長さL以下にできますか？
    ll ok = 1000001000;
    ll ng = 0;
    while(ok-ng>1){
        ll mid = (ok+ng)/2;
        ll cnt = 0;
        rep(i,N){
            cnt += (A[i]+mid-1)/mid - 1;
        }
        if(cnt>K){
            ng = mid;
        }else{
            ok = mid;
        }
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4824