akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		WriteLine(Hoge() ? "Yes" : "No");
	}
	bool Hoge()
	{
		var N = F;
		var used = new HashSet<string>();
		var t = Str;
		used.Add(t);
		var last = t.Last();
		for (var i = 1; i < N; i++)
		{
			var S = Str;
			if (S[0] != last || used.Contains(S)) return false;
			used.Add(S);
			last = S.Last();
		}
		return true;
	}
}


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

int main() {
  //freopen("input.txt", "r", stdin);
  ios::sync_with_stdio(false); cin.tie(0);
 
  int n; cin >> n;
  
  unordered_map<long long, int> mp;
  mp[0]++;
  long long ps = 0, ans = 0;
  REP(i, n) {
    int a; cin >> a;
    ps += a;
    if (mp.count(ps)) ans += mp[ps];
    mp[ps]++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8520
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
	char* stations = new char[3];
	for (int i = 0; i < 3; i++) {
		std::cin >> *(stations + i);
	}
	if (*(stations + 0) == *(stations + 1) && *(stations + 1) == *(stations + 2)) {
		std::cout << "No";	
	}
	else {
		std::cout << "Yes";
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
	#include<ext/pb_ds/assoc_container.hpp>
	#include<ext/pb_ds/tree_policy.hpp>
	#define int long long
	#define w(t) int t;cin>>t;while(t--)
	#define pb push_back
	#define mk make_pair
	#define ascSort(v) sort(v.begin(), v.end())
	#define descSort(v) sort(v.begin(), v.end(), greater<int>())
	#define ff first
	#define ss second
	#define pi pair<int,int>
	#define vi vector<int>
	#define umapi unordered_map<int,int>

	const int m=998244353;
	using namespace std;
	using namespace __gnu_pbds;

	typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>PBDS;

	void FIO(){
		#ifndef ONLINE_JUDGE
			freopen("input.txt", "r", stdin);
			freopen("output.txt", "w", stdout);
		#endif
		ios_base::sync_with_stdio(false);
	    cin.tie(NULL);	
	}

	int32_t main(){
		
		//FIO();
		string s;cin>>s;
		int sum=0;
		for(int i=0; i<(int)s.length(); i++){
			sum+=(s[i]-'0')%9;//cout<<sum<<" ";
			sum%=9;
		}
		cout<<(sum?"No":"Yes")<<"\n";		
			
		return 0;
		
			
	}



		
		

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

int main(){
  string s;
  cin >> s;
  int count = 0;
    for(int i =0;i<s.length()/2;i++){
      if(s[i]!=s[s.length()-(i+1)]){
        count++;
      }
    }
  cout << count;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main(){
int A,B;
char op;
scanf("%d %c %d",&A,&op,&B);
if(op=='+'){
   printf("%d\n",A+B);
}
   else if(op=='-'){
          printf("%d\n",A-B);
   }
return 0;
}

Measured memory_bytes: 128
n,m = list(map(int, input().split()))
# 隅は必ず表
# 辺は行か列なら1なら裏、以外は表
# 上記以外は裏

if n==1 and m==1:
    print(1)
elif n==1 or m==1:
    print(max(n,m)-2)
else:
    print((n-2)*(m-2))


Measured memory_bytes: 9168
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> al = new ArrayList<Integer>();

        int n = scanner.nextInt();
        int cnt = 0;
        for(int i = 0; i < n; i++ ){
            int lover = scanner.nextInt() - 1;
            if(lover < i){
                if(al.get(lover)==i){
                    cnt++;
                }
            }
            al.add(lover);
        }

        System.out.println(cnt);
    }
}



Measured memory_bytes: 60280
from math import floor,ceil
def f(b,n):
    if n < b:
        return n
    else:
        return f(b,floor(n/b))+n%b
n = int(input())
s = int(input())

for b in range(2,320000):
    if f(b,n)==s:
        print(b)
        exit()

if n==s:
    print(s+1)
    exit()

d = {}
for i in range(1,ceil(n**0.5)):
    m = f(n//i,n)
    if n//i==n//(i+1):
        d[i] = (m,m)
    else:
        M = f(n//(i+1)+1,n)
        d[i] = (m,M)

for i in range(ceil(n**0.5)-1,0,-1):
    m,M = d[i]
    if m<=s<=M and (s-m)%i==0:
        print(n//i-(s-m)//i)
        exit()

print(-1)

Measured memory_bytes: 67668
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a,b;
  int  u=0;
  cin >>a>>b;
  if(a=='9')u++;
  if(b=='9')u++;
  
  if(u!=0) cout<<"Yes"<<endl;
  else  cout<<"No"<<endl;
  
  }

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPP(x,y,c) for(const auto& [x,y]:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;
	VS mat(H);
	REP(i, H) { cin >> mat[i]; }

	REP(h, H) {
		REP(w, W) {
			char c = mat[h][w];
			if (c == '#') {
				cout << "#";
			} else {
				int count = 0;
				REP(i, 9) {
					int dh = i % 3 - 1;
					int dw = i / 3 - 1;
					if ((dh != 0 || dw != 0) &&
						h + dh >= 0 && h + dh < H &&
						w + dw >= 0 && w + dw < W) {
						if (mat[h + dh][w + dw] == '#') { ++count; }
					}
				}
				cout << count;
			}
		}
		cout << endl;
	}

}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

n=input()

if n[-1]=='3':
    print('bon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
    print('pon')
else:
    print('hon')

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

int main(int argc, const char * argv[]) {
    uint64_t N;
    cin >> N;
    
    vector<uint64_t> H;
    for (uint64_t i = 0; i < N; i++) {
        uint64_t tmp;
        cin >> tmp;
        H.push_back(tmp);
    }
    
    bool ans = true;
    uint64_t max = H[0];
    if (N > 1) {
        for (uint64_t i = 0; i < N - 1; i++) {
            uint64_t h = H[i];
            uint64_t h_next = H[i + 1];
            
            if (h > h_next) {
                h = h - 1;
                if (max > h) {
                    ans = false;
                    break;
                }
                H[i] = h;
                max = h;
            }
            
            if (h <= h_next) {
                continue;
            }else {
                ans = false;
                break;
            }
        }
    }
    
    if (ans) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

/////////////////////////////////////

int main() {
	ll N, K;
	cin >> N >> K;
	vll P(N + 1), C(N + 1);
	repn(i, N)cin >> P[i];
	repn(i, N)cin >> C[i];

	ll ans = -INF;
	repn(i, N) {
		vll od(N + 1, 0);
		vll sc(N + 1, 0);

		od[i] = 0;
		sc[i] = 0;
		ll now = i;

		ll st = 0;
		ll cyc = 0;
		ll S = 0;
		while (1) {
			ll prev = now;
			now = P[now];
			if (od[now] == 0) {
				od[now] = od[prev] + 1;
				sc[now] = sc[prev] + C[now];
			}
			else {
				cyc = od[prev] + 1 - od[now];
				st = od[now];
				S = sc[prev] + C[now] - sc[now];
				break;
			}
		}

		ll nowsc = -INF;
		repn(j, N) {
			if (od[j] == 0||od[j]>K) { continue; }
			else if (od[j] < st) { nowsc = max(nowsc, sc[j]); }
			else {
				ll t = (K - od[j]) / cyc;
				ll x = max(sc[j], sc[j] + S * t);
				nowsc = max(nowsc, x);
			}
		}

		ans = max(ans, nowsc);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3772
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int M = 1e5 + 50;
long long a[M],b[M];
int main(){
	int n;
	cin>>n;
	for(int i = 0; i < n + 1; i++){
		cin>>a[i];
	}
	long long ans = 0;
	for(int i = 0; i < n; i++){
		cin>>b[i];
		ans+=min(a[i],b[i]);
		b[i]-=min(a[i],b[i]);
		ans+=min(a[i+1],b[i]);
		a[i+1]-=min(a[i+1],b[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
n=int(input())
a=[int(i) for i in input().split()]
b=[99]*n
for i in range(n//2,n):
    b[i]=a[i]
for i in range(n//2-1,-1,-1):
    s = sum(b[(i+1)*j-1] for j in range(2,n//(i+1)+1))
    if s%2==0:
        b[i]=a[i]
    else:
        b[i]=1-a[i]
print(sum(b))
print(*[i+1 for i in range(n) if b[i]==1])

Measured memory_bytes: 80476
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for(int i = 0;i < N;++i)
			S[i] = sc.next();
		sc.close();
		
		for(int i = 0;i < N;++i) {
			for(int j = i;j < N;++j) {
				if(S[i].compareTo(S[j]) > 0) {
					String cap = S[i];
					S[i] = S[j];
					S[j] = cap;
				}
			}
		}
		
		for(int i = 0;i < N;++i)
			System.out.print(S[i]);
		System.out.println();
	}
}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10,mod=1e9+7;
ll fac[N],n,k,res;
ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
ll C(ll n,ll m){return fac[m]*qpow(fac[n],mod-2)%mod*qpow(fac[m-n],mod-2)%mod;}
int main(){
	cin>>n>>k,fac[0]=1;
	for(int i=1;i<N;i++)fac[i]=fac[i-1]*i%mod;
	for(int i=0;i<=min(k,n-1);i++)res=(res+C(i,n)*C(n-i-1,n-1)%mod)%mod;
	return cout<<res<<endl,0;
}

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

int main() {
    int n, l; cin >> n >> l;
    vector<string> s(n);
    rep(i,n) {
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    string ans = "";
    rep(i,n) {
        ans += s[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int t = 700;
		for (char ch : sc.next().toCharArray()) t+=(ch=='o') ? 100 : 0;
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

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

using namespace std;

using LL = long long;
const int MOD = 2019;

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

	string S;
	cin >> S;

	const int N = S.size();

	int num = 0, pot10 = 1;

	LL ans = 0;
	vector < int > seen(MOD);
	seen[0] = 1;

	for(int i = N - 1; i >= 0; --i) {
		int dig = S[i] - '0';
		num = (num + dig * pot10) % MOD;
		pot10 = (pot10 * 10) % MOD;
		ans += seen[num];
		seen[num]++;
	}

	cout << ans << '\n';

	return 0;	
}

Measured memory_bytes: 3784
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

ll ans, a, b, c, d;
ll dis[100001];
map<ll, ll> m;
ll dfs(ll x, ll y) {
  ll res = 1000000000000000000;
  ll num;
  if (m.find(x) != m.end()) {
    ans = min(ans, y + m[x]);
    return m[x];
  }
  if (1000000000000000000 / d > x) {
    res = x * d;
    ans = min(ans, y + x * d);
  }
  if (x == 100000LL) {
    ans = min(ans, y + m[x]);
    return m[x];
  }
  if (x % 5LL == 0LL) {
    dfs(x / 5LL, y + c);
    res = min(res, m[x / 5LL] + c);
  } else {
    dfs((x + 5LL - x % 5LL) / 5LL, y + (5LL - x % 5LL) * d + c);
    res = min(res, m[(x + 5LL - x % 5LL) / 5LL] + (5LL - x % 5LL) * d + c);
    dfs((x - x % 5LL) / 5LL, y + x % 5LL * d + c);
    res = min(res, m[(x - x % 5LL) / 5LL] + x % 5LL * d + c);
  }
  if (x % 3LL == 0LL) {
    dfs(x / 3LL, y + b);
    res = min(res, m[x / 3LL] + b);
  } else {
    dfs((x + 3LL - x % 3LL) / 3LL, y + (3LL - x % 3LL) * d + b);
    res = min(res, m[(x + 3LL - x % 3LL) / 3LL] + (3LL - x % 3LL) * d + b);
    dfs((x - x % 3LL) / 3LL, y + x % 3LL * d + b);
    res = min(res, m[(x - x % 3LL) / 3LL] + x % 3LL * d + b);
  }
  if (x % 2LL == 0LL) {
    dfs(x / 2LL, y + a);
    res = min(res, m[x / 2LL] + a);
  } else {
    dfs((x + 1LL) / 2LL, y + d + a);
    res = min(res, m[(x + 1LL) / 2LL] + d + a);
    dfs((x - 1LL) / 2LL, y + d + a);
    res = min(res, m[(x - 1LL) / 2LL] + d + a);
  }
  ans = min(ans, res + y);
  m.insert({x, res});
  return res;
}

int main() {
  ll n, t;
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
  cin >> t;
  while (t--) {
    cin >> n >> a >> b >> c >> d;
    ans = 100000000000000000;
    m.clear();
    for (int i = 1LL; i <= 100000; i++) {
      dis[i] = 1000000000000000000;
    }
    while (!q.empty()) {
      q.pop();
    }
    q.push({0LL, 0LL});
    while (!q.empty()) {
      ll x, y;
      x = q.top().second;
      y = q.top().first;
      q.pop();
      if (dis[x] == y) {
        if (x - 1LL >= 0 && dis[x - 1LL] > y + d) {
          q.push({y + d, x - 1LL});
          dis[x - 1LL] = y + d;
        }
        if (x + 1LL <= 100000LL && dis[x + 1LL] > y + d) {
          q.push({y + d, x + 1LL});
          dis[x + 1LL] = y + d;
        }
        if (x * 2LL <= 100000LL && dis[x * 2LL] > y + a) {
          q.push({y + a, x * 2LL});
          dis[x * 2LL] = y + a;
        }
        if (x * 3LL <= 100000LL && dis[x * 3LL] > y + b) {
          q.push({y + b, x * 3LL});
          dis[x * 3LL] = y + b;
        }
        if (x * 5LL <= 100000LL && dis[x * 5LL] > y + c) {
          q.push({y + c, x * 5LL});
          dis[x * 5LL] = y + c;
        }
      }
    }
    for (ll i = 1LL; i <= 100000LL; i++) {
      m.insert({i, dis[i]});
    }
    dfs(n, 0LL);
    cout << ans << endl;
  }
}

Measured memory_bytes: 13068
#include<stdio.h>
#include<string.h>
#include<math.h>
struct node{
    double x,y;
}ma[10];
double cha(node a,node b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main(){
    int n;
    double s=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%lf%lf",&ma[i].x,&ma[i].y);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            s+=cha(ma[i],ma[j]);
        }
    }
    int f=1,l=0;
    for(int i=2;i<=n;i++)
        f*=i;
    for(int i=1;i<n;i++)
        l+=i;
        l=f*(n-1)/l;
   // l=f/l;
  //  printf("%d %d\n",l,f);
    s*=l;
    s/=f;
    printf("%.10lf\n",s);
}


Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<string>
#include<iomanip>
#include<algorithm>
using namespace std;

int dist(int x1,int y1,int x2,int y2)
{
	return abs(x1-x2)+abs(y1-y2);
 } 
int main()
{
	int temp,n,m;
	long long x1[100],y1[100],x2[100],y2[100];
	cin >> n >> m;
	
	for(int i = 0;i < n;i++)
		cin >> x1[i] >> y1[i]; 
		
	for(int i = 0;i < m;i++)
		cin >> x2[i] >> y2[i];
		
	for(int i = 0;i < n;i++)
	{
		int temp;//记录下标 
		long long MAX = pow(2,31)-1;
		for(int j = 0;j < m;j++)
		{
			int Dist = dist(x1[i],y1[i],x2[j],y2[j]);//记录曼哈顿距离 
			if(Dist < MAX)
			{
				temp = j;//记录标号 
				MAX = Dist;//调整最大距离 
			}
		} 
		cout << temp+1 << endl;//下标-1输出 
	}
	return 0; 
}

Measured memory_bytes: 256
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
   int n;
   cin >> n;
  string s;
  int c=0;
  cin >> s;
  for(int i=0; i<n-2; i++){
      if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
          c++;
      }
  }
  cout << c;
  
  
  
   return 0;
}

//()()()))


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;

int main(){
    string s;cin>>s;
    int ans=0;
    REP(d,s.size()/2) {
        bool ok=true;
        REP(i,d){
            if(s[i]!=s[i+d]) ok=false;
        }
        if(ok) ans=2*d;
    }
    cout<<ans<<endl;
}


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




int main() {
  
 int N, count;
 N = 0;
 count = 0;
   
 cin >> N;
  
 if(N >= 10000) {
   
   for(int soezi0 = 10000; soezi0 <= N && soezi0 < 100000; soezi0++) {
     
     count++;
     
   }
   
 }
  
 if(N >= 100) {
   
   for(int soezi1 = 100; soezi1 <= N && soezi1 < 1000; soezi1++) {
     
     count++;
     
   }
   
 }
  
 if(N >= 1) {
   
   for(int soezi2 = 1; soezi2 <= N && soezi2 < 10; soezi2++) {
     
     count++;
     
   }
   
 }
  
 
  
 cout << count << endl;
   
   
}

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

using namespace std;

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

    s.insert(0, "_");

    vector<int> left(N+2), right(N+2);
    for(int i=1; i<=N; i++) {
        left[i] = left[i-1];
        if(s[i] == 'W') left[i]++;
    }
    for(int i=N; i; i--) {
        right[i] = right[i+1];
        if(s[i] == 'R') right[i]++;
    }

    int ans = numeric_limits<int>::max();
    for(int i=0; i<=N; i++) {
        ans = min(ans, max(left[i], right[i+1]));
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static void Main(string[] args)
        {
            var C = Read();
            Console.WriteLine((char)(C[0] + 1));
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
 
    int counter = 0;
    rep(i, A + 1) {
        rep(j, B + 1) {
            rep(k, C + 1) {
                if (X == 500 * i + 100 * j + 50 * k) {
                    ++counter;
                }
            }
        }
    }
 
    cout << counter << endl;
}

Measured memory_bytes: 256
import numpy
import re
import math

def main():
	"""
	テストコード実行
	:return:
	"""
	"""
	ビットマスクを用いた解法
	"""
	src = list(input())
	sum = 0
	for i in range(2 ** (len(src) - 1)):
		p = bin(i)[2:] # 2進数の数値部分だけを取り出す
		#print(p)
		p = "0" * (len(src) - 1 - len(p)) + p # (srcの長さ - 1)の桁数だけ右から0埋め
		#print(p)
		x = ""
		for index, num in enumerate(src):
			x += num
			if index != (len(src) - 1) and p[index] == "1":
				x += "+"
		sum += eval(x)
	print(sum)

if __name__ == '__main__':
	main()


Measured memory_bytes: 12424
function Main(input) {
	input = input.split(" ");

	var a = parseInt(input[0], 10);
  	var b = parseInt(input[1], 10);
  
	if(a <= 8 && b <= 8  ){
      console.log('Yay!');
    }
  	else{
      console.log(':(');
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import re
import copy

def accept_input():
    ast,aen,bst,ben = map(int, input().split())
    return ast,aen,bst,ben

def process(s):
    if s == "#":
        return 1
    else:
        return 0
ast,aen,bst,ben = accept_input()

if ast >= bst and ast <= ben:
    print(min(ben,aen)-ast)
elif ast < bst:
    if aen < bst:
        print(0)
    else:
        print(min(aen,ben)-bst)
else:
    print(0)


Measured memory_bytes: 9936
import math
import sys
from copy import copy
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

n = int(input())
s = list(input())

count = 0


if s[0] == 'W' or s[-1] == 'W':
    print(0)
    sys.exit()

LR_list = ['' for i in range(2*n)]
LR_list[0] = 'L'

for i in range(1,len(LR_list)):
    if s[i] == s[i-1]:
        if LR_list[i-1] == 'R':
            LR_list[i] = 'L'
        else:
            LR_list[i] = 'R'
    else:
        if LR_list[i-1] == 'R':
            LR_list[i] = 'R'
        else:
            LR_list[i] = 'L'

values = []

if LR_list.count('L') != LR_list.count('R'):
    print(0)
    sys.exit()


li = 0
ri = 0
for i in range(len(LR_list)):
    if i != 0:
        if LR_list[i-1] == 'L':
            li += 1
        elif LR_list[i-1] == 'R':
            ri += 1
    if LR_list[i] == 'R':
        values.append(li-ri)
value = 1
for i in range(len(values)):
    value = value * values[i] % (10**9+7)
for i in range(2,n+1):
    value = value * i %(10**9+7)
print(value)



Measured memory_bytes: 20616
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        int ans = solve(N);
        System.out.println(ans);
    }
    static int help(long N){
        int ans = 0;
        while(N>0){
            ans += N%10;
            N = N/10;
        }
        return ans;
    }
    static int solve(long N){
        if(N<10) return (int)N;
        String s = String.valueOf(N);
        int len = s.length();
        int ans =  help(N);
        for(int i=2;i<=len;i++){
            long temp = (long)Math.pow(10,i-1);
            long cur = N/temp-1;
            ans = Math.max(ans,help(cur)+9*(i-1));
        }
        return ans;
    }
}


Measured memory_bytes: 23764
#include <stdio.h>
#include <vector>

using namespace std;

struct Node{
	Node(){
		parent = -1;
		depth = num_of_children = 0;
	}
	int parent;
	int depth;
	vector<int> children;
	int num_of_children;
};

void calcDepth(Node nodes[],int root_id){
	for(int i = 0;i < nodes[root_id].num_of_children;i++){
		nodes[nodes[root_id].children[i]].depth = nodes[root_id].depth+1;
		calcDepth(nodes,nodes[root_id].children[i]);
	}
}

int main(){
	int n,id,k,child_id,root_id;
	scanf("%d",&n);
	Node nodes[n];

	for(int i = 0; i < n; i++){
		scanf("%d %d",&id,&k);
		for(int j = 0; j < k; j++){
			scanf("%d",&child_id);
			nodes[id].children.push_back(child_id);
			nodes[id].num_of_children++;
			nodes[child_id].parent = id;
		}
	}

	for(root_id = 0; root_id < n; root_id++){
		if(nodes[root_id].parent == -1) break;
	}

	calcDepth(nodes,root_id);

	for(int i = 0; i < n; i++){
		if(nodes[i].parent == -1){
			printf("node %d: parent = -1, depth = 0, root, ",i);
		}else if(nodes[i].num_of_children == 0){
			printf("node %d: parent = %d, depth = %d, leaf, ",i,nodes[i].parent,nodes[i].depth);
		}else{
			printf("node %d: parent = %d, depth = %d, internal node, ",i,nodes[i].parent,nodes[i].depth);
		}
		printf("[");
		for(int j = 0; j < nodes[i].num_of_children-1; j++){
			printf("%d, ",nodes[i].children[j]);
		}
		if(nodes[i].num_of_children > 0){
			printf("%d",nodes[i].children[nodes[i].num_of_children-1]);
		}
		printf("]\n");
	}
}



Measured memory_bytes: 7320
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
    int main(){
      int n,m;
      cin >> n >> m;
      ll x[n],y[m];
      rep(i,n)cin >> x[i];
      rep(i,m)cin >> y[i];
      ll X=0;
      ll Y=0;
      rep(i,n){
       X+=((2*i+1-n)*x[i])%mod;
        X%=mod;
      }
      rep(j,m){
       Y+=((2*j+1-m)*y[j])%mod;
        Y%=mod;
      }
      cout << (X*Y)%mod << endl;
      return 0;}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    start = 0
    for i, a in enumerate(A):
        start += a * ((-1) ** (i % 2))
    L = [str(start)]
    res = start
    for i in range(N-1):
        res = -res
        res += 2 * A[i]
        L.append(str(res))
    print(" ".join(L))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  string S;
  bool a = false;
  for(int i = 0; i < N; i++){
      cin >> S;
      if(S == "Y")
      a = true;
  }
  if(a)
  cout << "Four" << endl;
  else
  cout << "Three" << endl;
} 

Measured memory_bytes: 256
#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; }

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> a(n);
    for(int i= 0; i < n; i++) cin >> a[i];
    vector<int> b(n);
    int pos = 0;
    if(n%2 == 0){
        for(int i = n-2; i>=0; i-=2){
            b[pos] = a[i];
            pos++;
        }
        for(int i = 1; i < n; i+=2){
            b[pos] = a[i];
            pos++;
        }
    } else {
        for(int i = n-2; i>0; i-=2){
            b[pos] = a[i];
            pos++;
        }
        for(int i = 0; i < n; i+=2){
            b[pos] = a[i];
            pos++;
        }

    }
    reverse(b.begin(), b.end());

    cout << b[0];
    for(int i = 1; i < n; i++) cout << " " << b[i];
    cout << endl;

    return 0;
}


Measured memory_bytes: 3712
#include <stdio.h>

#include <math.h> 
#include <iostream>
using namespace std;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main()
{
    int a, b;
    int flag=0;
    scanf("%d", &a);
    scanf("%d", &b);
    if (IsPrime(b)){
        cout << 1 << endl;
    }
    else{for (int i = 0; i <= b - a; i++)
        if (b % (a + i) == 0)
        {
            int d = b / (a + i);
            cout << d << endl;
            flag = 1;
            break;
      }
    }

    return 0;
}


Measured memory_bytes: 256
import math
import itertools
import sys

n=int(input())
last=input()
log=[]
log.append(last)
q=[]
ans="Yes"
for i in range(n-1):
    tmp=input()
    q.append(tmp)
for i in q:
    if(i[0]!=last[-1] or i in log):
        ans="No"
        break
    else:
        last=i
        log.append(i)
print(ans)


Measured memory_bytes: 9184
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

// ll M=1000000007;

//
//???????????°?????????????´¢???????????????
//

int main(void){
	int N;
	cin>>N;
	ll h[100001];
	rep(i,N)cin>>h[i];
	ll left[100001],right[100001];
	ll max=0;
	int j=0;
	rep(i,N){//?????????????´¢
		j=i-1;
		while(true){
			if(j==-1){
				left[i]=0;
				break;
			}
			if(h[j]>=h[i]){
				if(j==left[j]){
					j--;
				}else{
					j=left[j];
				}
			}else{
				left[i]=j+1;
				break;
			}
		}
	}
	irep(i,N){//?????????????´¢
		j=i+1;
		while(true){
			if(j==N){
				right[i]=N-1;
				break;
			}
			if(h[j]>=h[i]){
				if(j==right[j]){
					j++;
				}else{
					j=right[j];
				}
			}else{
				right[i]=j-1;
				break;
			}
		}
	}
	rep(i,N){
		if(max<(right[i]-left[i]+1)*h[i])max=(right[i]-left[i]+1)*h[i];
	}
	cout<<max<<endl;
	return 0;
}

Measured memory_bytes: 5432
n, x = list(map(int, input().split()))
m = []
for _ in range(n):
  m.append(int(input()))
m.sort()

def main():
  for i in range(n):
    if sum(m[0:i+1]) > x:
      print(i)
      return
  print(n)

if sum(m) > x:
  main()
else:
  print(n + (x - sum(m)) // m[0])


Measured memory_bytes: 9076
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, s = 0;
    cin >> n;
    for (ll i = 1; i <= n; i++)
        if (i % 3 && i % 5)
            s += i;
    cout << s;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n, p;
	cin >> n >> p;
	int ans = 1;
	int q = p;
	for (int i = 2; i*i <= q; i++) {
		if (p == 1) break;
		if (p%i == 0) {
			int sum = 0;
			while (p%i == 0) {
				p /= i;
				sum++;
			}
			while (sum >= n) {
				sum -= n;
				ans *= i;
			}
		}
	}
	if (p > 1) {
		if (n == 1) {
			ans *= p;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    map<int,int>mp;
    ll ans = 0;
    rep(i,n) {
        int A;
        cin >> A;
        ans += mp[(i+1)-A];
        mp[(i+1)+A]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 20988
import math
import bisect
import heapq
from collections import deque

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

v.sort()
heapq.heapify(v)

for _ in range(n-1):
    x = heapq.heappop(v)
    y = heapq.heappop(v)
    heapq.heappush(v, (x+y)/2.)

ans = heapq.heappop(v)
print(ans)



Measured memory_bytes: 3548
#include <iostream>
#include <vector>

int main()
{
	int numGems = -1;

	while (true)
	{
		std::cin >> numGems;
		if (numGems == 0)
		{
			break;
		}
		const int gridSize = 21;
		std::vector<bool> gems(gridSize * gridSize, false);
		int gemPointX = 0;
		int gemPointY = 0;

		for (int i = 0; i < numGems; i++)
		{
			std::cin >> gemPointX;
			std::cin >> gemPointY;

			gems[gemPointY * gridSize + gemPointX] = true;
		}

		int numOrders = 0;
		std::cin >> numOrders;

		char direction = ' ';
		int distance = 0;
		std::pair<int, int> currentPoint(10, 10);

		for (int i = 0; i < numOrders; i++)
		{
			std::cin >> direction;
			std::cin >> distance;

			switch (direction)
			{
			case 'N':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.second += 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			case 'E':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.first += 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			case 'S':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.second -= 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			case 'W':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.first -= 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			default:
				break;
			}
		}

		bool isAllGemCorrected = true;
		for (int i = 0; i < gridSize * gridSize; i++)
		{
			isAllGemCorrected = isAllGemCorrected && !gems[i];
		}
		if (isAllGemCorrected)
		{
			std::cout << "Yes" << std::endl;
		}
		else
		{
			std::cout << "No" << std::endl;
		}
	}
	return 0;
}

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

int main(){
	int N; cin>>N;
	vector<int> A(N);
	rep(i, N) cin>>A[i];
	int64_t yen = 1000;
	rep(i, N-1) yen += max(0L, yen/A[i] * (A[i+1] - A[i]));
	cout<< yen <<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> s(M, vector<int>(0));
  rep(i, 0, M){
    int k;
    cin >> k;
    rep(j,0,k) {
      int L;
      cin >> L;
      s.at(i).pb(L);
    }
  }
  vector<int> p(M);
  rep(i,0,M) cin >> p[i];
  
  int count = 0;
  int combi;
  int now;
  int button;
  bool ok = true;
  vector<int> swi(N);
  combi = pow(2,N);
  
  rep(i,0,combi){
    now = i;
    ok = true;
    rep(j,0,N){
      swi[j] = now % 2;
      now /= 2;
    }
    rep(j,0,M){
      button = 0;
      rep(k,0,s.at(j).size()) {
        button += swi[s.at(j).at(k)-1];
      }
      if (button % 2 != p.at(j)) ok = false;
    }
    if(ok) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 512
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <unordered_map>
#include <string>
typedef long long LL;
typedef long double LD;
using namespace std;

int main() {
    int n;
    LD x;
    string u;
    LD ans=0.0;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x >> u;
        if(u=="JPY"){
            ans += x;
        }else{
            ans += x*380000.0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(m)]

good_list = [1]*n

for i in range(m):
    a, b = ab[i][0], ab[i][1]
    if h[a-1] < h[b-1]:
        good_list[a-1] = 0
    elif h[a-1] > h[b-1]:
        good_list[b-1] = 0
    else:
        good_list[a-1] = 0
        good_list[b-1] = 0

print(good_list.count(1))


Measured memory_bytes: 31928
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    n = 10000 - n;
    n %= 1000;
    printf("%d", n);
    
    return 0;
}


Measured memory_bytes: 3220
#include <stdio.h>

int main()
{
    int n,m,h[100005]={},p,q,c[100005]={},cn=0;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) {
        scanf("%d",&h[i]);
    }
        while(m--) {
            scanf("%d%d",&p,&q);
            if(h[p]==h[q]) { c[p]=1;c[q]=1; }
            else if(h[p]>h[q]) { c[q]=1; }
            else { c[p]=1; }
        }
        for(int i=1;i<=n;i++) {
            if(c[i]==0) { cn++; }
        }
        printf("%d",cn);

    return 0;
}

Measured memory_bytes: 2512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mp(x,y) make_pair(x,y)
const int nax=1e6+5;
ld pie=3.141592653589793238;

void solve(){
    ld a,b,h,m;
    cin>>a>>b>>h>>m;
    ld a1=(m*6*pie)/(ld)(180);
    ld a2=((30*h+0.5*m)*(pie))/180;
    ld g=abs(a1-a2);
    ld r=sqrt(a*a+b*b-2*a*b*cos(g));
    cout<<r<<'\n';
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int tc;
    tc=1;
    cout<<fixed<<setprecision(20);
    while(tc--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 4172
#include <iostream>

using namespace std;

int main(){
    int H, N;
    cin >> H >> N;
    int sum = 0;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        sum += a;
    }
    if(sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,K,ans,temp;
int hai[40];

int main(){
    cin>>N>>M;
    rep(i,N){
        cin>>K;
        rep(j,K){
            cin>>temp;
            hai[temp]++;
        }
    }
    rep(i,40){
        if(hai[i]==N)ans++;
    }
    out(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
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() {
    int n;
    cin>>n;
    int ans=0;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i);
    }
    for(int i=0;i<n;i++){
        while(1){
            if(a.at(i)%2==0){
                ans++;
                a.at(i)/=2;
                // cout<<i<<" "<<a.at(i)<<endl;
            }
            else{
                break;
            }
        }
    }
    cout<<ans<<endl;





    return 0;
}


Measured memory_bytes: 256
//
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

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

int main(){

	int a, p;
	cin >> a >> p;
	cout << (a *3 + p) / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[10];
	int a[30];
	scanf("%s",s);
	int n;
	n=strlen(s);
	memset(a,0,sizeof(a));
	for(int i=0;i<n;i++)
	{
		a[s[i]-'A']++;
	}
	int sum=0;
	for(int i=0;i<30;i++)
	{
		if(a[i]==2)
		{
			sum++;
		} 
	}
	if(sum==2)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
} 

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

int main(){
	int N;
  long long int K;
  cin >> N >> K;
  vector<long long int> v(100001);

  for(int i = 0; i < N; ++i){
    int a, b;
    cin >> a >> b;
    v.at(a) += b;
  }
  for(int j = 0; j <= 100001; ++j){
    if(K <= v.at(j)){
      cout << j << endl;
      break;
    }
    K -= v.at(j);
  }
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define ll long long
#define vec vector<int, int>
#define vecll vector<ll, ll>
#define rep(i, n) for(ll i=0;i<n;i++)
#define FOR(i, m, n) for(ll i=m;m<n;i++)

using namespace std;


int bi(int x) {
    int r = 0;
    while (x % 2 == 0) {
        x /= 2;
        r++;
    }
    //cout << r << endl;
    return r;
}



int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i, n)
        cin >> a[i];

    int ans = 0;
    rep(i, n)
        ans += bi(a[i]);
    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 256
#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 n;
    cin>>n;
    int cnt=0;
    REP(i,n){
        int l=0,r=0;
        cin>>l>>r;
        cnt+=r-l+1;
    }
    cout<<cnt<<endl;
    
    
}

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

const int N = 55;

string s[N];
int freq[N][30], ans[30];

int main(){
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		cin>>s[i];
		for(int j = 0; j < s[i].length(); j++)	freq[i][s[i][j] - 'a']++;
	}
	for(int i = 0; i < 26; i++){
		ans[i] = INT_MAX;
		for(int j = 1; j <= n; j++)	ans[i] = min(ans[i], freq[j][i]);
		char ch = 'a' + i;
		for(int j = 0; j < ans[i]; j++)	cout<<ch;
	}
}

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

using namespace std;

int main()
{
    int N, E=0, W=0;
    string S;
    cin >> N >> S;
    for (int j=0; j < N; ++j) {
        switch (S[j]) {
            case 'E':E++;break;
            case 'W':W++;break;
        }
    }
    int m=S[0]=='E'?(E-1):E;
    int e=0, w=0;
    for (int j=0; j < N; ++j) {
        switch (S[j]) {
            case 'E':e++;break;
            case 'W':w++;break;
        }
        m = min(m, w+(E-e));
    }
    cout << m << endl;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	int n; cin >> n;
	vector<int> A(n, 0);
	for (int i=0; i<n; i++) cin >> A[i];
	map<int, int> count;
	for (int i=0; i<n; i++) {
		count[A[i]]++;
	}


	sort(A.begin(), A.end());
	bool flag;
	int ret =0;
	for (int i=0; i<n; i++) {
		int a = A[i];
		flag = true;
		for (int j=2; j*j <= a; j++) {
			if (a%j==0) {
				if (binary_search(A.begin(), A.end(), j) || binary_search(A.begin(), A.end(), a/j)){
					flag = false;
					break;
				}
			}
		}
		if (a!=1 && binary_search(A.begin(), A.end(), 1)) flag = false;
		if (count[a]>1) flag = false;
		if (flag) {
			ret++;
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 13464