akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define what_is(x) cerr << #x <<" is " << x << endl;
typedef long long ll;
const int MOD = 998244353;
const double PI = 3.14159265358979;
const int INF =  1e9 + 7;
const int nax = 100005;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc = 1;
	// cin >> tc;
	while (tc--) {
		double a, b, h, m;
		cin >> a >> b >> h >> m;
		double thetah = 2 * PI * (h + m / 60.0) / 12.0;
		double thetam = 2 * PI * m / 60;

		double x1 = a * cos(thetah);
		double y1 = a * sin(thetah);

		double x2 = b * cos(thetam);
		double y2 = b * sin(thetam);

		double ans = sqrtl((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
		cout.precision(18); cout << ans;


	}
	return 0;
}




















Measured memory_bytes: 4144
N,M=map(int,input().split())
A=[]
for i in range(N):
    A.append(list(input()))
B=[]
for i in range(M):
    B.append(list(input()))
f = False
for i in range(N-M+1):
    for j in range(N-M+1):
        g = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l]!=B[k][l]:
                    g = False
        if g:
            f = True
print("Yes" if f else "No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define Maxn 107
int n,h,w;
int ans=0;
bool flag[107*107];
int main()
{
	scanf("%d%d%d",&n,&h,&w);
	memset(flag,false,sizeof(flag));
	for (int i=1;i<=n;i++)
	{
		int lx=(i-1)*w+1,rx=i*w;
		int x;
		scanf("%d",&x);
		if (i%2==0) x=-x;
		for (int j=lx+x;j<=rx+x;j++)
			flag[j]=true;
	}
	for (int i=1;i<=n*w;i++)
		if (!flag[i]) ++ans;
	printf("%d\n",ans*h);
	return 0;
}



Measured memory_bytes: 3236
# 入力
N = int(input())
V = list(map(int, input().strip().split(' ')))
C = list(map(int, input().strip().split(' ')))

# 処理
max_X_minus_Y = 0
for i in range(N):
    if V[i] > C[i]:
        max_X_minus_Y += V[i] - C[i]
print(max_X_minus_Y)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
int main(){
    int n;
    cin >> n;
    int open=0;
    REP(i,n){
        char p;
        int x;
        cin >> p >> x;
        if(p=='(')open+=x;
        else{
            open-=x;
            if(open<0){
                FOR(j,i+1,n)cin >> p >> x;
                break;
            }
        }
    }
    cout << (open==0 ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

vector<int> T[200005];
vector<int> ans;

void dfs(int f, int p = -1){
    for(int next : T[f]){
        if(next == p) continue;
        ans[next] += ans[f];
        dfs(next,f);
    }
}

int main(){
    int N,Q; cin >> N >> Q;
    rep(i,N-1){
        int a,b; cin >> a >> b;
        a--; b--;
        T[a].push_back(b);
        T[b].push_back(a);
    }

    ans.resize(N);
    rep(i,Q){
        int c,d; cin >> c >> d;
        c--;
        ans[c] += d;
    }

    dfs(0);
    rep(i,N) cout << ans[i] << endl;
}


Measured memory_bytes: 23552
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0)
#define int long long

using namespace std;
const int N = 1e5+1;
int n, p[N], vis[N];
vector<int> X[N], G[N];

int root(int i) {
    for(; p[i]!=i; i=p[i]);
    return i;
}

void connect(int i, int j) {
    int ri = root(i),
        rj = root(j);
    if(ri == rj)    return;
    if(G[ri].size() > G[rj].size()) {
        p[rj] = ri;
        for(int k : G[rj])
            G[ri].push_back(k);
        G[rj].clear();
    } else {
        p[ri] = rj;
        for(int k : G[ri])
            G[rj].push_back(k);
        G[ri].clear();
    }
}

main() {
//    freopen("in.txt", "r", stdin);
    IOS;
    for(int i=1; i<N; i++) {
        p[i] = i;
        G[i].push_back(i);
    }
    cin >> n;
    for(int i=0; i<n; i++) {
        int x, y; cin >> x >> y;
        X[x].push_back(y);
    }
    for(int i=1; i<N; i++) {
        for(int y : X[i]) {
            if(vis[y])
                connect(i, vis[y]);
            else
                vis[y] = i;
        }
    }
    int ans = 0;
    for(int i=1; i<N; i++) {
        if(p[i]!=i) continue;
        // if is root!
        set<int> st;
        int cnt = 0;
        for(int j : G[i]) {
            cnt += X[j].size();
            for(int y : X[j])
                st.insert(y);
        }
        ans += st.size() * G[i].size() - cnt;
    }
    cout << ans;
}


Measured memory_bytes: 19184
#include <deque>
#include <iostream>
#include <vector>

int main() {
  uint32_t N = 0, L = 0;
  std::cin >> N >> L;
  std::vector<uint32_t> A(N);
  for (auto &&a : A) std::cin >> a;

  std::deque<std::pair<uint32_t, uint32_t>> D;
  for (size_t i = 0; i < N; i++) {
    while (!D.empty() && D.back().second > A[i]) D.pop_back();
    D.push_back({i, A[i]});
    if (i < L - 1) continue;
    std::cout << ((i > L - 1) ? " " : "") << D.front().second;
    if (D.front().first + L - 1 == i) D.pop_front();
  }
  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 7108
#!/usr/bin/env python
# coding: utf-8

# In[17]:


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


# In[19]:


if n%2 == 0:
    ans = list(reversed([a[i] for i in range(n) if i%2 != 0]))
    ans += [a[i] for i in range(n) if i%2 == 0]
else:
    ans = list(reversed([a[i] for i in range(n) if i%2 == 0]))
    ans += [a[i] for i in range(n) if i%2 != 0]
print(*ans)


# In[ ]:






Measured memory_bytes: 30880
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 max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func solve(s string) bool {
	f := 0
	t := len(s) - 1
	for i := 0; i < len(s); i++ {
		if s[f] != s[t] {
			return false
		}
		f++
		t--
		if f > t {
			break
		}
	}
	return true
}

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

	s := getString()

	N := len(s)
	n := (N - 1) / 2

	s0 := s[:n]
	ans0 := solve(s0)

	n = (N+3)/2 - 1
	s1 := s[n:]
	ans1 := solve(s1)

	ans2 := solve(s)
	ans := ans0 && ans1 && ans2

	if ans == true {
		out("Yes")
	} else {
		out("No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
const double EPS = 1e-8;

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

vector<P> convex_cut(vector<P> G, L l){
  vector<P> res;
  for(int i=0;i<G.size();i++){
    P A = G[i];
    P B = G[(i+1)%G.size()];
    if(ccw(l.first, l.second, A) != -1) res.push_back(A);
    if(ccw(l.first, l.second, A) * ccw(l.first, l.second, B) < 0)
      res.push_back(crossPoint(L(A,B), l));
  }
  return res;
}

bool check(vector<P> G,double d){
  vector<P> pol=G;
  int n=G.size();
  for(int i=0;i<n;i++){
    P c=(G[(i+1)%n]-G[i]);
    P a=P(abs(c),d)*(c/abs(c))+G[i];
    pol=convex_cut(pol,L(a,a+c));
    if(pol.size()<3)return 0;
  }
  return  1;
}


int main(){
  int n;
  while(cin>>n,n){
    vector<P> pol(n);
    for(int i=0,x,y;i<n;i++){
      cin>>x>>y;
      pol[i]=P(x,y);
    }

    double L=0,M,R=1e4;
    while(L<R){
      M=(L+R)/2;
      if(!check(pol,M)) R=M-EPS;
      else L=M+EPS;
    }
    printf("%lf\n",L);
  }
  return 0;
}

Measured memory_bytes: 3212
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int n;
string str;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  cin >> n;
  cin >> str;

  int w = count(all(str), 'W');
  int r = count(all(str), 'R');

  int ans = n - max(w, r);

  int cur = 0;

  for (int i = 0; i < r; i++) {
    cur += (str[i] == 'W');
  }
  // trace(ans, cur);
  ans = min(ans, cur);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3772
#include<bits/stdc++.h>
#include<cxxabi.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define TYPEVS(x) typeid(x).name()
#define TYPEGC(x) abi::__cxa_demangle(typeid(x).name(), 0, 0, 0)
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) _builtin_popcount(x)
ll nums[200001];
__int128 m=1e18;
int main(){
	int n;
	cin>>n;
	__int128 ans=1;
	ll last=1;
	int flag0=0;
	for(int i=1;i<=n;i++){
		cin>>nums[i];
		if(nums[i]==0){
			cout<<0<<endl;
			return 0;
		}
	}
	
	for(int i=1;i<=n;i++){
		ans*=nums[i];
		if(ans>m){
			cout<<-1;
			return 0;
		}
		last=ans;
	}
	cout<<last;
}


Measured memory_bytes: 4372
import java.io.BufferedReader;
        import java.io.IOException;
        import java.io.InputStreamReader;
        import java.lang.reflect.Array;
        import java.math.BigInteger;
        import java.util.*;
        import java.lang.*;

public class  Main{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st==null || !st.hasMoreElements()){
                try{
                    st=new StringTokenizer(br.readLine());
                }
                catch(IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt(){
            return Integer.parseInt(next());
        }

        Long nextLong(){
            return Long.parseLong(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str="";
            try{
                str=br.readLine();
            }
            catch(IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
        long n=in.nextInt();
        long sum=0;
        for(long i=1;i<=n;i++){
            if(i%(long)3!=0 && i%5!=0){
                sum+=i;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 32708
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int dy[8] = {1, 0, -1, 1, -1, 1 ,0 ,-1};
lli repow(lli n,lli k,lli m){
  if(k==0)return 1;
  if(m==0)return 0;
  else if(k%2==1)return repow(n,k-1,m)*n%m;
  else{
    lli temp=repow(n,k/2,m);
    return temp*temp%m;
  }
}
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N;
  Vec(P,lli,N,0);
  rep(i,1,N){
    cin >> A;
    P[A-1]++;
  }
  for(auto v:P)Out(v);
}


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

/**
 * ???????????????
 *
 * @author B7078
 *
 */
class Calcurator {

	public void Cal(int n, String str) { // Cal????????????:3????????°or3???????????´??°????????\

		for (int i = 1; i <= n; ++i) {
			if (i % 3 == 0) { // 3??§?????????????????´??°
				System.out.print(" ");
				System.out.print(i);
			} else if (String.valueOf(i).indexOf("3") != -1) { // ??´??°???"3"????????????????????\
				System.out.print(" ");
				System.out.print(i);
			}
		}
		System.out.println("");
	}
}

public class Main {

	public static void main(String[] args) throws IOException {
		/**
		 *
		 */
		Calcurator cal1;
		cal1 = new Calcurator();
		/**
		 * ?????°?????£?¨?
		 */
		int n = 0;
		String str;
		/**
		 * ??´??°n?????\?????¨??????
		 */
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		str = br.readLine();
		n = Integer.parseInt(str);
		if (n >= 3 || n <= 10000) {
			cal1.Cal(n, str);
		}

	}

}

Measured memory_bytes: 30880
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    while(n--){
        vector<int> mark;
        while(1){
            int a;
            cin >> a;
            if(a==0) break;
            else mark.push_back(a);
        }
        vector<vector<int>> ans;
        vector<int> num;
        vector<int> order;
        vector<int> dist(10000,0);
        num.push_back(mark[0]);
        ans.push_back({});
        order.push_back(0);
        int now = 0;

        for(int i=1;i<mark.size();i++){
            if(mark[i]>0){
                ans.push_back({});
                num.push_back(mark[i]);
                int next = (int)(ans.size()) - 1;

                ans[now].push_back(next);
                ans[next].push_back(now);
                dist[next] = dist[now] + 1;
                
                order.push_back(next);

                int p = (int)(order.size()) - 1;
                while(1){
                    if(num[order[p]]>(int)(ans[order[p]].size())){
                        now = order[p];
                        break;
                    }
                    p --;
                    if(p<0) break;
                }
            }else{
                int ever = (int)(order.size())-1;
                while(1){
                    if(dist[order[ever]]==dist[now]+mark[i]) break;
                    ever --;
                }

                ans[order[ever]].push_back(now);
                ans[now].push_back(order[ever]);

                int next = (int)(order.size()) - 1;
                while(1){
                    if(num[order[next]]>(int)(ans[order[next]].size())){
                        now = order[next];
                        break;
                    }
                    next --;
                    if(next<0) break;
                }
            }
        }

        rep(i,ans.size()){
            cout << i+1 ;
            sort(ans[i].begin(),ans[i].end());
            rep(j,ans[i].size()) cout << " " << ans[i][j]+1 ;
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3172
import math
n,k = map(int, input().split())

N = int(math.floor(math.log(n)/math.log(k)))+1
m = n
L = []
for i in range(N+1):
  L.append(m//(k**(N-i)))
  m = m%(k**(N-i))
  
if L[0] == 0:
  L.pop(0)

print(len(L))

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

int main() {
 int N,D,X,cont=0;
  cin >> N >> D >> X;
  vector<int> a(N);
  vector<int> cnt(N);
  for(int i=0;i<N;i++){
   cin >> a[i];

     for(int j=0;j<100;j++){
      if(j*a[i]+1<=D){
      cont++;
      }
     }
    cnt[i]=cont;
    cont=0;
  }
  int sum=0;
  for(int i=0;i<N;i++){
   sum =sum+cnt[i];
  }

  cout << sum+X << endl;

}


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

int main() {
    int N;
    cin >> N;
    int cnt[N+1];
    rep(i,N+1) cnt[i] = 0;
    for(int i = 1; 3*i*i <= N; i++) {
        for(int j = i; i*i + 2*j*j <= N; j++) {
            for(int k = j; ; k++) {
                int res = i*i + j*j + k*k + i*j + j*k + k*i;
                if(res > N) break;
                if(i == j && j == k) {
                    cnt[res] += 1;
                } else if(i != j && j != k) {
                    cnt[res] += 6;
                } else {
                    cnt[res] += 3;
                }
            }
        }
    } 
    for(int i = 1; i <= N; i++) {
        cout << cnt[i] << endl;
    }
}

Measured memory_bytes: 3532
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        long sum=0;
        while(true){
            str = scan.nextLine();
            if(str.equals("0")){
                break;
            }
            StringBuilder sb = new StringBuilder();
            for (int i=0; i<str.length(); i++) {
                char c = str.charAt(i);

                sb.append(c);
                num = sb.toString();
                sum += Long.valueOf(num);
                sb.deleteCharAt(0);
            }
            System.out.println(sum);
            sum = 0;
        }

        scan.close();
    }

}




Measured memory_bytes: 26864
#include <stdio.h>
int main()
{
  int i, j, n, A[10000], count = 0;

  scanf("%d",&n);
  for (i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  for (i = 0; i < n; i++){
    if (A[i] > 1){
      for (j = 2; j*j <= A[i]; j++)
	if (A[i] % j == 0){
	  count++;
	  break;
	}
    }
    else
      count++;
  }
  printf("%d\n",n-count);

  return 0;
}



Measured memory_bytes: 2104
#!/usr/bin/env python3

'''
Author: andyli
Time: 2020-07-25 19:57:01
'''

import os
from io import BytesIO, IOBase
import sys
import math


def main():
    n,k = map(int,input().split())

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

    for i in range(k,n):
        if a[i]>a[i-k]:
            print('Yes')
        else: print('No')

    return


# region fastio
BUFSIZE = 1048576


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = 'x' in file.mode or 'r' not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b'\n') + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode('ascii'))
        self.read = lambda: self.buffer.read().decode('ascii')
        self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip('\r\n')

# endregion


if __name__ == '__main__':
    main()


Measured memory_bytes: 95880
#include <iostream>

using namespace std;

int main () {

    float a, b , c ;

    cin >> a  >> b >> c ;

    if(a!=c && b!=c )
        cout << c << endl;
    if(b!=a && c!=a )
        cout << a << endl;
    if(a!=b && c!=b )
        cout << b << endl;


    return 0;
}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  map<int,int> m;
  for(int i = 0; i < N; ++i){
    cin >> a[i];
    m[a[i]]++;
  }
  vector<pair<int,int> > p(M);
  for(int i = 0; i < M; ++i){
    cin >> p[i].second >> p[i].first;
    m[p[i].first] += p[i].second;
  }
  ll sum = 0;
  int cnt = 0;
  for(auto itr = m.rbegin(); itr != m.rend(); ++itr){
    int c = itr->second;
    while(cnt < N && c > 0){
      sum += itr->first;
      c--;
      cnt++;
    }
    if(cnt == N) break;
  }
  
  cout << sum << endl;
  
}


Measured memory_bytes: 10752
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }

const int MAXN = 100000;
const int MAXM = 200000;

int n, m;
vector<pair<int, int> > adj[MAXN];

bool done[MAXN];
int x[MAXN];
int q[MAXN], qhead, qtail;

bool solve() {
	REP(i, n) done[i] = false;
	REP(i, n) if (!done[i]) {
		qhead = qtail = 0;
		done[i] = true, x[i] = 0; q[qhead++] = i;
		while (qtail < qhead) {
			int at = q[qtail++];
			REPSZ(i, adj[at]) {
				int to = adj[at][i].first, nx = x[at] + adj[at][i].second;
				//printf("at=%d x=%d to=%d nx=%d\n", at + 1, x[at], to + 1, nx);
				if (!done[to]) done[to] = true, x[to] = nx, q[qhead++] = to;
				if (x[to] != nx) return false;
			}
		}
	}
	return true;
}

void run() {
	scanf("%d%d", &n, &m);
	REP(i, m) {
		int a, b, d; scanf("%d%d%d", &a, &b, &d); --a, --b;
		adj[a].PB(MP(b, d)); adj[b].PB(MP(a, -d));
	}
	printf("%s\n", solve() ? "Yes" : "No");
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 9728
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int m1,m2,d1,d2;cin>>m1>>d1>>m2>>d2;
  cout<<(m1!=m2)<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define d double
#define INF INT_MAX
#define output for(int i=0;i<sizex;i++) { for(int j=0;j<sizey;j++) { cout << moveChart[i][j] << " "; }cout<<endl; }cout<<endl;

const int mod = 1000000000 + 7;
int n, m;
string mat[1001];
int dp[1001][1001];

int solve( int x, int y ){

    // cout << x << " " << y << endl;

    if( x < 0 || y < 0 || x >= n || y >= m ) return 0;
    if( mat[x][y] == '#' ) return 0;
    if( x == n-1 && y == m-1 ) return 1;

    if( dp[x][y] != -1 ) return dp[x][y];

    return dp[x][y] =  ( solve( x+1, y ) + solve( x, y+1 ) ) % mod;

}

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

    memset( dp, -1, sizeof dp );

    cin >> n >> m;
    for(int i=0;i<n;i++) cin >> mat[i];

    cout << solve( 0, 0 ) % mod << endl;
 
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve(void)
{
  int N,M;
  cin>>N>>M;
  cout<<(N-1)*(M-1)<<endl; 
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

#include <iostream>
#include <vector>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

void rectangle(int h, int w) {
	for (int i = 0; i < h; i++ ) {
		for (int j = 0; j < w; j++ ) {
			if (i == 0 or i == h -1) {
				cout << "#";
			} else {
				if (j == 0 or j == w -1) {
					cout << "#";
				} else {
					cout << ".";
				}
			}
		}
		cout << endl;
	}
	cout << endl;
}

int main() {
	while (1) {
		int H, W;
		cin >> H >> W;
		if (H == 0 and W == 0) {
			break;
		}
		rectangle(H, W);
	}
	return 0;
}



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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));		in.readLine();
		String[] d = in.readLine().split(" ");
		byte max = Byte.MIN_VALUE;
		byte num = 0;
		Byte h;
		for(String c : d) {
			h = Byte.valueOf(c);
			if(h >= max) {
				num++;
				max = h;
			}
		}
		System.out.print(num);
	}
}

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

using namespace std;

const int MAXN = 1e5 + 21;

long long a[MAXN];
long long n, b, c, x = 1;

int main() {
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int j = 0; j < n - 1; j++) {
		if(a[j] < a[j + 1]) {
			if(c > 0) {
				c = 0;
				x++;
			}
			else
				b++;
		}
		if(a[j] > a[j + 1]) {
			if (b > 0) {
				b = 0;
				x++;
			}
			else
				c++;
		}
	}
	cout << x << '\n';
	return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    ll ans = 0;
    for (ll i = 1; i <= N; ++i)
    {
        ll p = N / i;
        ans += i * (p * (p + 1)) / 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main(){
	int arr[5];
	for(int i=0;i<5;i++){
		cin>>arr[i];
	}
  for(int i=0;i<5;i++){
  	if(arr[i]==0){
  	   cout<<i+1<<endl;
  	}
  }
}

Measured memory_bytes: 3616
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005
ll fac[N];
ll expo(ll base, ll exponent, ll mod) {                                //return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}
ll com(ll n,ll r)
{
    if(n==-1&&r==-1)
        return 1;
    if(n<r||n<0)
        return 0;
    if(r<0)
        return 0;
    ll ans=fac[n];
    ans=(ans*expo(fac[r],hell-2,hell))%hell;
    ans=(ans*expo(fac[n-r],hell-2,hell))%hell;
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll i,j,k,l,m,n;
        fac[0]=1;
        for(i=1;i<10000;i++)
            fac[i]=(fac[i-1]*i)%hell;
        cin>>n>>k;
        for(i=1;i<=k;i++)
        {
            ll ans=0;
            for(j=0;j<=n;j++)
            {
                ans=(ans+((j+1)*((com(k-1,i-1)*com(n-k-j-1,i-2))%hell))%hell)%hell;
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
int digit_sums(int n){
	int sum = 0;
	while(1){
		sum += n%10;
		if (n/10 == 0) return sum;
		n /= 10;
	}
}

int main(){
	int n, S;
	std::cin >> n;
	S = digit_sums(n);
	if (n%S == 0) std::cout <<"Yes\n";
	else std::cout << "No\n";
	return 0;
}


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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 A,B,C;
	cin >> A >> B >> C;
	cout << (B / A < C ? B / A : C) << endl;
	return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    double n, m, d;
    cin >> n >> m >> d;

    if(d == 0){
        cout << (m-1)/n << endl;
        return 0;
    }
    double a = m-1;
    double b = 2*(n-d);
    double c = n*n;
    cout << a*b/c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, k, q;
cin >> n >> k >> q;
  int C[n];
  for(int i = 0; i < n; i++){
    C[i] = k - q;
  }
  
for(int i = 0; i < q; i++){
int s;
cin >> s;
  C[s-1]++;
}
  for(int i = 0; i < n; i++){
    if(C[i] <= 0){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
    
  }
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := intScanner()
	q := intScanner()
	abcd := make([][]int, q)
	for i := 0; i < q; i++ {
		abcd[i] = []int{intScanner(), intScanner(), intScanner(), intScanner()}
		abcd[i][0]--
		abcd[i][1]--
	}
	st := make([][]int, m)
	for i := 1; i <= m; i++ {
		st[i-1] = []int{i}
	}
	ans := 0
	for len(st) != 0 {
		x := st[len(st)-1]
		st = st[:len(st)-1]
		if len(x) == n {
			score := 0
			for i := 0; i < q; i++ {
				if x[abcd[i][1]]-x[abcd[i][0]] == abcd[i][2] {
					score += abcd[i][3]
				}
			}
			if ans < score {
				ans = score
			}
		} else {
			for i := x[len(x)-1]; i <= m; i++ {
				y := make([]int, len(x))
				copy(y, x)
				st = append(st, append(y, i))
			}
		}
	}
	fmt.Println(ans)
}


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


int main (int argc, char const *argv[])
{
    int N;
    string S;
    cin>>N>>S;
    int ans=0;
    int MAX=0;
    
    for(int i = 0; i < N; i++)
    {
        
        if (S[i]=='I') {
            ans++;
        }
        else if (S[i]=='D') {
            ans--;
        }
        
        MAX=max(ans,MAX);
    }
    cout<<MAX<<endl;
    
    return 0;
}

Measured memory_bytes: 256
N = input()
int_N  = int(N)
y = int_N
s = 0
for i in range(1, 9):
    x= int_N % (10 ** i) / (10 ** (i - 1))
    s += x
    int_N -= int_N % (10 ** i)
    if x == int_N:
        break
if y % s == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
 
int main(){
	u_int n;	// the number of vegetable
	u_int m;	// capacity
	
	while(std::cin >> n >> m){
        if(n == 0 && m == 0){
            break;
        }
         
        std::vector<u_int> p(n);	// price
        for(int i = 0; i < n; ++i){
            std::cin >> p[i];
        }
        
        //m, 2*m, 3*m, ... = free(sort by descending)
        std::sort(p.begin(), p.end(), std::greater<u_int>());
        for(int i = m; i <= n; i += m){
            p[i-1] = 0;
        }
        
        std::cout << std::accumulate(p.begin(), p.end(), 0) << std::endl;
    }
     
    return 0;
}

Measured memory_bytes: 1212
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> m = new HashMap<>();
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
            if(!m.containsKey(a[i])) m.put(a[i], 1);
            else m.put(a[i], m.get(a[i]) + 1);
        }
        int ans = 0;
        for(int i = 0; i < n; i++){
            if(m.containsKey(a[i])){
                if(a[i] <= m.get(a[i])) ans += m.get(a[i]) - a[i];
                else ans += m.get(a[i]);
                m.remove(a[i]);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 64620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin >> h.at(i);
  }
  
  sort(h.begin(),h.end());
   int sa=h.at(k-1)-h.at(0);
   //cout<<h.at(k-1)<<" "<<h.at(0)<<endl;
   for(int i=1;i<=n-k;i++){
     //cout << sa << endl;
     sa=min(sa,h.at(k+i-1)-h.at(i));
   }
   cout << sa << endl;
   return 0;
}


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



int main(void)
{
    int n,h,w;
    cin >> n >> h >> w;
    int count = 0;
    for (int i = 0; i < n; i++){
        int a,b;
        cin >> a >> b;
        if ((a >= h) && (b >= w)) count++;
    }
    cout << count << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int n;
	int a[100];
	int i;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	for(i = n-1; i >= 0; i--) {
		printf("%d", a[i]);
		if(i != 0) {
			printf(" ");
		} else{
			printf("\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main(void)
{
	int a,b;
	int d,r;
	double f;

	scanf("%d %d",&a,&b);

	d = a / b;
	r = a % b;
	f = (double)a / b;

	printf("%d %d %.6lf\n",d,r,f);

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int A,B;
	scanf("%d %d",&A,&B);

	if((A*B)%2 == 0){

		printf("No\n");

	}else{

		printf("Yes\n");
	}

	return 0;
}


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

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


int main() {
	
	int N; cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;

	}

	else {
		int A, B;cin >> A >> B;
		cout << A + B << endl;

	}




}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello
{

    public static void Main()
    {
        string s = Console.ReadLine();
        string s_ = new string(s.Reverse().ToArray());
        //まず1文字消す
        s_ = s_.Substring(1);
        //奇数ならもう1文字
        if (s_.Length % 2 == 1) s_ = s_.Substring(1);
        int ans = 0;
        while (true)
        {
            if (s_.Substring(0, (s_.Length) / 2) == s_.Substring((s_.Length) / 2)) break;
            else s_ = s_.Substring(2);
        }

        Console.WriteLine(s_.Length);
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <queue>
#include <set>

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

const LL inf = 1000000000000000;
const LL mod = 1000000007;

int main()
{
	
	LL n;
	cin >> n;

	vector<LD> p(n);

	for (auto &e : p) {
		cin >> e;
	}

	vector<vector<LD>> dp(n+1, vector<LD> (n+1, 0));

	dp[0][0] = 1;
	for (int i = 0; i < n+1; ++i) {
		for (int j = 0; j <= i; ++j) {
			if (i > 0 && j > 0) {
				dp[i][j] = dp[i-1][j-1]*p[i-1];
			}
			if (i > 0) {
				dp[i][j] += dp[i-1][j]*(1-p[i-1]);
			}
		}
	}


	LD pr = 0;

	for (int i = n/2+1; i < n+1; ++i) {
		pr += dp[n][i];
	}
	cout << fixed << setprecision(12) <<  pr << endl;
	 
}

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  int r = 0;
  int st = 0;
  int en = s.length()-1;
  while (st < en) {
    if (s[st] == s[en]) {
      st++;
      en--;
    } else if (s[st] == 'x') {
      st++;
      r++;
    } else if (s[en] == 'x') {
      en--;
      r++;
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << r << endl;
}

Measured memory_bytes: 512
n,m = map(int,input().split())
sc = [ list(map(int,input().split())) for _ in range(m) ]

a = [-1]*n

for i in range(m):
    if a[sc[i][0]-1] == -1:
        a[sc[i][0]-1] = sc[i][1]
    else:
        if a[sc[i][0]-1] == sc[i][1]:
            pass
        else:
            print(-1)
            exit()

if n==1:
    if a[0]==-1:
        print(0)
    else:
        if a[0]==-1:
            a[0]=0
        print("".join(list(map(str,a))))
elif n==2:
    if a[0]==0:
        print(-1)
    elif a[0]==-1:
        a[0]=1
        if a[1]==-1:
            a[1]=0
        print("".join(list(map(str,a))))
    else:
        if a[1]==-1:
            a[1]=0
        print("".join(list(map(str,a))))
elif n==3:
    if a[0]==0:
        print(-1)
    elif a[0]==-1:
        a[0]=1
        if a[1]==-1:
            a[1]=0
        if a[2]==-1:
            a[2]=0
        print("".join(list(map(str,a))))
    else:
        if a[1]==-1:
            a[1]=0
        if a[2]==-1:
            a[2]=0
        print("".join(list(map(str,a))))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&an[0][0],n*m,0); typedef long long ll;*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
#define print(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}

void solve(){
	int n,k;
	cin >> n >> k;
	int d;
	set<int> st;
	FO(i,0,k){
		cin >> d;
		int a;
		FO(j,0,d){
			cin >> a;
			st.insert(a);
		}
	}
	int ans = (int)st.size();
	cout << n-ans << endl;
}
/* When you have to multiply many things , do it in different (multiple) lines, not in a single line .*/
int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(15); std::cout << std::fixed;
	int nT = 1;
	//cin >> nT;
	FE(i,1,nT)
		solve();
	return 0;
}


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

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string a, b; cin >> a >> b;
    if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int main(void)
{
	long long int x,y,z;
	int a=0;
	scanf("%lld%lld",&x,&y);
	for(z=x; z<=y; z=z*2){
		a=a+1;
	}
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 128