akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin, n, k;
    vector<ll> a(n);
    REP(i, 0, n) {
        cin, a[i];
    }
    ll l = 1, r = 1000000010;
    ll ans = r;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll cnt = 0;
        auto vv = a;
        REP(i, 0, n) {
            vv[i] -= mid;
            chmax(vv[i], 0LL);
        }
        REP(i, 0, n) {
            cnt += (vv[i] + mid - 1) / mid;
        }
        if (k >= cnt) {
            r = mid - 1;
            chmin(ans, mid);
        } else {
            l = mid + 1;
        }
    }
    print(ans);

    return 0;
}


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


#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ll long long


int soma_dig( int x ) {
	string s = to_string(x);
	int soma = 0;

	for ( int i = 0; i < s.size(); i++ ) {
		soma += s[i] - '0';
	}
	return soma;
}


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

    cout << ( n % soma_dig(n) == 0 ? "Yes\n" : "No\n");

    return 0;
}


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

int main(){
    int n, m, a[10000];
    cin >> n >> m;
    
    for (int i = 0; i < m; ++i) cin >> a[i];

    for (int i = 0; i < m; ++i){
        n -= a[i];
    }

    if (n < 0) cout << -1 << endl;
    else cout << n << endl;

}


Measured memory_bytes: 3656
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    if(n%2==1){
      System.out.println("No");
    }else{
      if(s.substring(0,n/2).equals(s.substring((n/2)))){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
         
  }
  

  
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
// #define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 
void solve(){
	ll n;cin>>n;
	vector<ll> vec(n);
	ll tgcd = 0;
	// cout<<"yo"<<endl;
	for(int i=0;i<n;i++){
		cin>>vec[i];
		tgcd = gcd(vec[i],tgcd);
	}
	if(tgcd!=1){
		cout<<"not coprime"<<endl;
	}
	else{
		int f1 = 0;
		int mxn = 1000001;
		vector<ll> spf(mxn);
		// cout<<"he"<<endl;
		spf[1] = 1;
		for(int i=2;i<mxn;i++){
			spf[i] = i;
		}
		for(int i=2;i<mxn;i+=2){
			spf[i] = 2;
		}
		for(int i=3;i*i<mxn;i++){
			if(spf[i]==i){
				for(int j=i*i;j<mxn;j+=i){
					if(spf[j]==j){
						spf[j] = i;
					}
				}
			}
		}
		// cout<<"hell"<<endl;
		bool prime[mxn];
		memset(prime,false,sizeof(prime));
		for(int i=n-1;i>=0;i--){
			ll x = vec[i];
			while(x!=1){
				// cout<<x<<endl;
				// cout<<spf[x]<<endl;
				if(prime[spf[x]]==true){
					f1 = 1;
					break;
				}
				else{
					prime[spf[x]] = true;
					ll tt = spf[x];
					while(x%tt==0){
						x = x/tt;
					}
					// x = x/spf[x];
					// cout<<x<<"----"<<endl;

				}
			}
			if(f1==1){
				break;
			}
		}
		if(f1==0){
			cout<<"pairwise coprime"<<endl;
		}
		else{
			cout<<"setwise coprime"<<endl;
		}
		// cout<<"let"<<endl;
	}

}
 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	ll t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}    
    return 0;
}

Measured memory_bytes: 19768
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;
 
long long mod = 1000000007;
 
long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}
 
void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
 
int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if (s < t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  char s[101];
  int l, ans = 0;
  scanf("%s", s);
  l = strlen(s);
  for(int i = 0; i < l/2; i++) {
    if(s[i] != s[l-1-i]) ans++;
  }
  
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define REEP(i, N) for(ll i = N - 1; i >= 0; --i)
#define FOR(i,m,n) for(ll i = m; i < n; ++i)
#define RFOR(i,m,n) for(ll i = n - 1; i >= m; --i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define PB push_back
#define KIRIAGE(a, b) a += (b - a % b) % b // a ??? b ????????°????????§?¢???????
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;} // a / b ??\??????????°???´??°
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		int n;
		cin>>n;
		if(!n)return 0;
		vector<int> s(n);
		ll sum = 0;
		REP(i, n) {
			cin>>s[i];
			sum += s[i];
		}
		sort(ALL(s));
		sum -= s[0];
		sum -= s[n - 1];
		cout<<sum / (n - 2)<<endl;
	}
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<Int,Int> P;
Int m,n,i,j,k,a,b,c,d;
bool cmp( P a, P b )
{
    if( a.second  == b.second ) return a.first < b.first;
    return a.second < b.second;
}
main()
{
    cin >> n;
    vector< P  > v(n);
    for( int i = 0; i < n; i++ )cin >> v[i].first >> v[i].second;
    sort( begin(v), end(v), cmp );
    Int now = v[0].first;
    for( int i = 1; i < n; i++ )
    {
        if( v[i-1].second < now ){puts("No");return 0;}
        else now += v[i].first;
    }
    if( now > v[n - 1].second ){puts("No");return  0;}
    puts("Yes");
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
  
int main() {
  int a;
  cin >> a;
    int b;
      b = a % 2; //後で足す
    int c;
  	  c = a - b;
    int d;
      d = (c / 10) % 2; //後で足す
    int e;
      e = c / 10 - d;//後で足す
  cout << b + d + e / 10 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ff first
#define ss second
#define pb push_back
 
int bexp(int a, int b, int mod)
{
    int res = 1;
    if (mod <= 0)
        return 0;
 
    while (b)
    {
        if (b & 1) res = (res * a) % mod;
 
        a = (a * a) % mod; 
        b >>= 1;
    }
    return res;
}
 
#define N 300010
#define MOD 1000000007
 
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

struct comp {
    bool operator() (const pair<int, int> a, const pair<int, int> b) const
    {
        return a.ss * (a.ff - a.ff / 2) > b.ss * (b.ff - b.ff / 2);
    }
};

int f[1000001] = {};

vector<int> getprimes()
{
    vector<int> ans;

    f[1] = 1, f[0] = 1;
    f[2] = 0;
    for (int i = 2; i < 1001; ++i)
    {
        if (f[i] == 0)
        {
            for (int j = i * i; j < 1001; j += i)
            {
                f[j] = 1;
            }
        }
    }
    ans.push_back(2);

    for (int i = 3; i < 1001; i += 2)
        if (f[i] == 0)
            ans.push_back(i);

    return ans;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int n;
    cin >> n;

    int a;
    int k = 0;
    int p = 1;

    vector<int> primes = getprimes();
    memset(f, 0, sizeof(f));

    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        k = __gcd(k, a);

        int l = a;

        for (int k : primes)
        {
            if (a % k == 0)
            {
                f[k]++;

                while (a % k == 0) a /= k;
                
                if (f[k] == 2)
                {
                    // cout << a << " " << k << endl;
                    p = 0;
                }
            }
        }

        if (a > 1)
        {
            f[a]++;
            if (f[a] == 2)
                p = 0;
        }
    }


    if (p == 1)
        cout << "pairwise coprime\n";
    else if (k == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
    return 0;
}

Measured memory_bytes: 11484
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
vector<string> split(const string &s, char delim) {
	vector<string> elems;
	string item;
	for (char ch : s) {
		if (ch == delim) {
			if (!item.empty())
				elems.push_back(item);
			item.clear();
		} else {
			item += ch;
		}
	}
	if (!item.empty())
		elems.push_back(item);
	return elems;
}

// 本体

int main() {
	IOS();
	ll x, n;
	cin >> x >> n;
	set<ll> s;
	for (int i = 0; i < n; i++) {
		ll p;
		cin >> p;
		s.insert(p);
	}
	ll cnt	 = 0;
	while (1) {
		if (s.find(x - cnt) == s.end()) {
			dump(x - cnt);
			break;
		}
		if (s.find(x + cnt) == s.end()) {
			dump(x + cnt);
			break;
		}
		cnt++;
	}
}

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

#define ll  long long
#define PII pair<ll,ll>
#define VI  vector<ll>
#define VB  vector<bool>
#define VC vector<char>
#define VVI vector<vector<ll>>
#define VVC vector<vector<char>>
#define VS  vector<string>
#define VP  vector<PII>
#define lf(i,a,b) for(ll i=a;i<=b;i++)
#define lr(i,a,b) for(ll i=a;i>=b;i--)
#define lfl(i,v) for(ll i=0;i<v.size();i++)
#define lrl(i,v) for(ll i=(ll)(v.size())-1;i>=0;i--)
#define chk2(a,b) cout<<"check :  "<<a<<" "<<b<<endl
#define chk3(a,b,c) cout<<"check :  "<<a<<" "<<b<<" "<<c<<endl
#define chk4(a,b,c,d) cout<<"check :  "<<a<<" "<<b<<" "<<c<<" "<<d<<endl
#define chk5(a,b,c,d,e) cout<<"check :  "<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl
#define l_b(v,k)  lower_bound(v.begin(),v.end(),k)-v.begin()
#define u_b(v,k)  upper_bound(v.begin(),v.end(),k)-v.begin()
#define mod 1000000007
#define sort(v) sort(v.begin(),v.end())
#define p_b push_back
#define p_f push_front
#define m_p make_pair
#define fir first
#define sec second
#define sz size()
ll n,m,k;
ll dp[100005];
VI v;
ll fun(ll k)
    {   if(k<=0)
            return 0;
        if(dp[k]!=-1)
            return dp[k];
        lf(i,1,n)
        {   if(v[i]<=k)
            {   if(fun(k-v[i])==0)
                    return dp[k]=1;

            }
        }
        return dp[k]=0;
    }
int main() 
{   cin>>n>>k;
    v=VI(n+1);
    memset(dp,-1,sizeof(dp));
    lf(i,1,n)
        cin>>v[i];
    if(fun(k))
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
}

Measured memory_bytes: 4096
import java.util.*;
 
public class Main {
	     
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 
		while(true){
			int m = sc.nextInt();
			int t = sc.nextInt();
			int p = sc.nextInt();
			int r = sc.nextInt();
			if(m==0 && t==0 && p==0 && r==0) break;
			
			int[][] a = new int[t][3];
			for(int i=0;i<t;i++) a[i][0] = i+1;
			int[][] b = new int[t][p];
			
			for(int i=0;i<r;i++){
				int c = sc.nextInt();
				int d = sc.nextInt()-1;
				int e = sc.nextInt()-1;
				int f = sc.nextInt();
				if(f==0){
					a[d][1] += (c + b[d][e]*20);
					a[d][2]++;
				}
				else b[d][e]++;
			}
			
			Arrays.sort(a, new Comparator<int[]>(){
				public int compare(int[] o1, int[] o2) {
					if(o1[2]==o2[2]){
						if(o1[1]==o2[1]) return o2[0]-o1[0];
						else return o1[1]-o2[1];
					}
					return o2[2]-o1[2];
				}
			});
			
			System.out.print(a[0][0]);
			for(int i=1;i<t;i++){
				if(a[i-1][2]==a[i][2] && a[i-1][1]==a[i][1]) System.out.print("=");
				else System.out.print(",");
				System.out.print(a[i][0]);
			}
			System.out.println();
		}
    }   
}

Measured memory_bytes: 60752
import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int arr[]=new int[2*n];
        for(int i=0;i<2*n;i++){
            arr[i]=in.nextInt();
        }
        Arrays.sort(arr);
        int ans=0;
        for(int i=0;i<2*n;i+=2){
            ans+=arr[i];
        }
        System.out.println(ans);
    }
}

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

using namespace std;

#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define MP make_pair
#define PB push_back
#define X first
#define Y second

typedef long long int lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m;
	cin >> n >> m;

	vector<int> par(n);
    vector<int> sz(n, 1);
	iota(ALL(par), 0);

    function<int(int)> getPar = [&](int u) {
        return par[u] == u ? u : par[u] = getPar(par[u]);
    };

    auto Union = [&](int u, int v) {
        u = getPar(u);
        v = getPar(v);

        if (u == v)
            return;
        
        if (sz[v] > sz[u])
            swap(u, v);

        par[v] = u;
        sz[u] += sz[v];
    };

	while (m--) {
		int x, y;
		cin >> x >> y;
		x--, y--;

        Union(x, y);
	}

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int p = getPar(i);
        ans = max(ans, sz[p]);
    }

    cout << ans << '\n';

    return 0;
}

// g++ sol.cpp -o sol.out -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17

Measured memory_bytes: 4756
#include<iostream>
using namespace std;
typedef long long ll;
const int maxn = 1e5;
ll list[maxn];

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

Measured memory_bytes: 3192
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    while(true){
        int A,B,C;
        cin >> A >> B >> C;
        if(A + B + C == 0) break;
        int n;
        int ans[1000] = {0};
        for(int i = 1; i <= 1000; i++) ans[i] = 2;

        cin >> n;
        int a[1000],b[1000],c[1000],r[1000];


        for(int i = 0; i < n; i++){
            cin >> a[i] >> b[i] >> c[i] >> r[i];
            if(r[i] == 1){
                ans[a[i]] = ans[b[i]] = ans[c[i]] = 1;
            }
        }

        for(int i = 0; i < n; i++){
            if(r[i] == 0){
                if(ans[a[i]] == 1 && ans[b[i]] == 1 && ans[c[i]] != 1)
                    ans[c[i]] = 0;
                else if(ans[a[i]] == 1 && ans[c[i]] == 1 && ans[b[i]] != 1)
                    ans[b[i]] = 0;
                else if(ans[b[i]] == 1 && ans[c[i]] == 1 && ans[a[i]] != 1)
                    ans[a[i]] = 0;
            }
        }
        for(int i = 1; i <= A+B+C; i++){
            cout << ans[i] << endl;
        }
    }
	return 0;
}

Measured memory_bytes: 1176
A,B,K=map(int,input().split())
listAB=[]
for i in range(min(A,B)):
    if A%(i+1)==0 and B%(i+1)==0:
        listAB.append(i+1)
listAB.sort(reverse=1)
if A==1 and B==1:
    print(1)
else :
    print(listAB[K-1])

Measured memory_bytes: 3060
def f_single_dot():
    # https://atcoder.jp/contests/abc168/submissions/13368489
    import sys
    from collections import deque
    input = sys.stdin.readline
    N, M = [int(i) for i in input().split()]

    x_set, y_set = set([0]), set([0])  # 重複を除いた xy 座標の一覧 (座標圧縮に必要)

    vertical_lines = []
    for _ in range(N):
        a, b, c = map(int, input().split())
        vertical_lines.append((a, b, c))
        x_set |= {a, b}
        y_set |= {c}

    horizontal_lines = []
    for _ in range(M):
        d, e, f = map(int, input().split())
        horizontal_lines.append((d, e, f))
        x_set |= {d}
        y_set |= {e, f}

    x_set = sorted(x_set)
    y_set = sorted(y_set)

    # 座標圧縮 (壁も配列に格納するので、2 倍している)
    x_encoded = {n: i * 2 for i, n in enumerate(x_set)}
    y_encoded = {n: i * 2 for i, n in enumerate(y_set)}
    # 座標圧縮されたグリッドで縦横に 1 マス分進むことは実際にはどれくらい進んだことなのか
    x_length = [x_set[i // 2 + 1] - x_set[i // 2] if i %
                2 else 0 for i in range(len(x_set) * 2 - 1)]
    y_length = [y_set[i // 2 + 1] - y_set[i // 2] if i %
                2 else 0 for i in range(len(y_set) * 2 - 1)]

    grid = [[0] * (len(y_set) * 2 - 1) for _ in range(len(x_set) * 2 - 1)]
    for a, b, c in vertical_lines:
        a, b, c = x_encoded[a], x_encoded[b], y_encoded[c]
        for x in range(a, b + 1):
            grid[x][c] = 1
    for d, e, f in horizontal_lines:
        d, e, f = x_encoded[d], y_encoded[e], y_encoded[f]
        for y in range(e, f + 1):
            grid[d][y] = 1

    que = deque()
    used = [[0] * len(y_set) * 2 for _ in range(len(x_set) * 2)]
    dy = [1, 1, -1, -1]
    dx = [1, -1, 1, -1]
    for k in range(4):
        nnx, nny = x_encoded[0] + dx[k], y_encoded[0] + dy[k]
        if 1 <= nnx < len(x_set) * 2 - 1 and 1 <= nny < len(y_set) * 2 - 1:
            que.append((nnx, nny))
            used[nnx][nny] = 1
    ans = 0
    dy = [1, 0, -1, 0]
    dx = [0, 1, 0, -1]
    while que:
        x, y = que.popleft()
        if x % 2 and y % 2:
            ans += x_length[x] * y_length[y]
        for k in range(4):
            nx, ny = x + dx[k], y + dy[k]
            nnx, nny = nx + dx[k], ny + dy[k]
            if grid[nx][ny] == 0:
                if nnx < 0 or nnx >= len(x_set) * 2 - 1 or nny < 0 or nny >= len(y_set) * 2 - 1:
                    return 'INF'
                if not used[nnx][nny]:
                    que.append((nnx, nny))
                    used[nnx][nny] = 1
    return ans

print(f_single_dot())

Measured memory_bytes: 713580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] nums = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
            var dict = new Dictionary<int, int>(n);
            for (int i = 0; i < n; i++)
            {
                dict[i] = nums[i];
            }
            Console.WriteLine(string.Join(" ", dict.OrderBy(kv => kv.Value).Select(kv => kv.Key + 1)));
        }
    }
}


Measured memory_bytes: 30940
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
 
using namespace std;
typedef long long ll;
#define rep(a, n) for (int i = a; i < n;i++)
 
ll gcd(ll n1, ll n2)
{
    return n2 == 0 ? n1 : gcd(n2, n1 % n2);
}
 
int main(){
    ll N, ans = 0;
    cin >> N;
    vector<ll> A(N), R(N+1), L(N+1);
    rep(0, N) cin >> A[i];
    L[1] = A[0], R[N - 1] = A[N - 1];
 
    rep(0,N-1){
        L[i + 2] = gcd(A[i + 1], L[i + 1]);
        R[N - 2 - i] = gcd(R[N - i - 1], A[N - 2 - i]);
    }
    L[0] = R[N-1],R[N] = L[1];
    rep(0,N){
        ans = max(ans, gcd(L[i], R[i + 1]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

ll n,h,M=0;
P a[111111];

void Main() {
  cin >> n >> h;
  rep(i,n) {
    cin >> a[i].S >> a[i].F;
    M=max(M,a[i].S);
  }
  sort(a,a+n,greater<P>());
  ll ans=MAXL;
  rep(i,n+1) {
    ans=min(ans,i+(ll)ceil((double)max(0LL,h)/M));
    if(i==n) break;
    h-=a[i].F;
  }
  pr(ans);
}

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


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

#define ll long long
using namespace std;

const int N = 1e5 + 5;
int n, h[N];
ll dp[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    dp[1] = 0;
    for(int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    for(int i = 2; i <= n; i++) {
        dp[i] = abs(h[i] - h[i - 1]) + dp[i - 1];
        if(i > 2) dp[i] = min(dp[i], abs(h[i] - h[i - 2]) + dp[i - 2]);
    }
    cout << dp[n] << endl;
}

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

using namespace std;
/*
vector<int> Z_algorithm(string S) {
	int c = 0, n = S.length();
	vector<int> Z(n, 0);
	for (int i = 1; i < n; i++) {
		int l = i - c;
		if (i + Z[l] < c + Z[c]) {
			Z[i] = Z[l];
		}
		else {
			int j = max(0, c + Z[c] - i);
			while (i + j < n && S[j] == S[i + j])j++;
			Z[i] = j;
			c = i;
		}
	}

	Z[0] = n;
	return Z;
}
*/

vector<int> Z_algorithm(const string &S) {
	int N = (int)S.size();
	vector<int> res(N);
	res[0] = N;
	int i = 1, j = 0;
	while (i < N) {
		while (i + j < N && S[j] == S[i + j]) ++j;
		res[i] = j;
		if (j == 0) { ++i; continue; }
		int k = 1;
		while (i + k < N && k + res[k] < j) res[i + k] = res[k], ++k;
		i += k, j -= k;
	}
	return res;
}
int main() {
	int N;
	string S;
	cin >> N >> S;
	int ans = 0;
	for (int beg = 0; beg < N - 1; beg++) {
		string tmp = S.substr(beg);
		auto ret = Z_algorithm(tmp);
		for (int j = 1; j < ret.size(); j++) {
			if (ret[j] <= j)ans = max(ans, ret[j]);
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x & -x)
#define PI 3.14159265358979323846264338327950L
typedef long long ll;
using namespace std;
const int MAX = 0x7ffffff;
int t;

void slove()
{
	string s;cin >> s;
	int n = s.size() + 1;
	vector<int> a(n + 1, 0);
	for(int i = 0;i < n - 1;i ++)
	{
		if(s[i] == '<')
			a[i + 1] = max(a[i] + 1 , a[i + 1]);
	}
	for(int i = n - 2;i >= 0;i --)
	{
		if(s[i] == '>')
			a[i] = max(a[i] , a[i + 1] + 1);
	}
	ll ans = 0;
	for(int i = 0;i < n;i ++)ans += a[i];
	cout << ans << endl;
}
int main()
{
	SIS;
	slove();
}

Measured memory_bytes: 5800
#include<iostream>
#include<vector>
#include<algorithm>
#define MAX_N 100001
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
void eratos(vector<bool>& cp_list,int max){
  cp_list[0]=false;
  cp_list[1]=false;
  for(int i=2;i*i<=max;i++){
    if(cp_list[i]){
      for(int j=2;j*i<=max;j++){
        cp_list[i*j]=false;
      }
    }
  }
}
signed main(){
  ll q,l,r;
  vector<bool> cp_list(MAX_N);
  ll like_sum[MAX_N]={};
  fill(cp_list.begin(),cp_list.end(),true);
  eratos(cp_list,MAX_N-1);
  for(int i=1;i<MAX_N;i++){
    if(cp_list[i]&&cp_list[(i+1)/2]){
      like_sum[i]++;
    }
  }
  for(int i=1;i<MAX_N;i++){
    like_sum[i]+=like_sum[i-1];
  }
  cin >> q;
  ll tmp;
  for(int i=0;i<q;i++){
    cin >> l>>r;
    tmp = like_sum[r]-like_sum[l-1];
    cout << tmp << endl;
  }
}


Measured memory_bytes: 1408
import itertools

N,M,Q = map(int,input().split())
a = [0]*Q
b = [0]*Q
c = [0]*Q
d = [0]*Q

for i in range(Q):
    a[i],b[i],c[i],d[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1

ans = 0
for x in itertools.combinations_with_replacement(range(1, M+1), N):
    #print(x)
    count = 0
    for i in range(Q):
        if x[b[i]] - x[a[i]] == c[i]:
            count += d[i]
    ans = max(ans,count)

print(ans)

Measured memory_bytes: 68048
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
using System.Text;
namespace I_am_the_green_coder{
    class Inonoa{
        static void Main(){
            long n = ILongs()[0];
            int[,] ans = new int[n,n];
            
            for(int i=0;i<n-1;i++){
                for(int j=i+1;j<n;j++){
                    int ii = i;
                    int jj = j;
                    int an = 1;
                    while(true){
                        if(ii%2==jj%2){
                            ii /= 2;
                            jj /= 2;
                        }else{
                            ans[i,j] = an;
                            break;
                        }
                        an ++;
                    }
                }
            }

            for(int i=0;i<n-1;i++){
                StringBuilder sb = new StringBuilder("");
                for(int j=i+1;j<n-1;j++){
                    sb.Append(ans[i,j]);
                    sb.Append(' ');
                }
                sb.Append(ans[i,n-1]);
                WriteLine(sb.ToString());
            }
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 14176
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np

H, W = map(int, input().strip().split())
s = [input() for i in range(H)]

direction_x = [1, -1, 0, 0]
direction_y = [0, 0, 1, -1]
reached = np.zeros((H, W))
que_x = [0]
que_y = [0]
can_reach = False

for x, y in zip(que_x, que_y):
    if x == H - 1 and y == W - 1:
        can_reach = True
        break
    for i in range(4):
        next_x = x + direction_x[i]
        next_y = y + direction_y[i]
        if not(0 <= next_x < H) or not(0 <= next_y < W):
            continue
        if s[next_x][next_y] == '#':
            continue
        if reached[next_x][next_y] > 0:
            reached[next_x][next_y] = min(reached[next_x][next_y], reached[x][y] + 1)
            continue
        reached[next_x][next_y] = reached[x][y] + 1
        que_x.append(next_x)
        que_y.append(next_y)

res = 0
if can_reach:
    for i in range(H):
        for j in range(W):
            if s[i][j] == '.':
                res += 1
    res = res - reached[H-1][W-1] - 1
else:
    res = -1
print(int(res))


Measured memory_bytes: 27144
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int N,M,C;
            N = int.Parse(str[0]);
            M = int.Parse(str[1]);
            C = int.Parse(str[2]);

            string[] str2 = Console.ReadLine().Split(' ');
            int[] B = new int[M];
            for(int i = 0; i < M; i++)
            {
                B[i] = int.Parse(str2[i]);
            }
            int[,] A = new int[N, M];

            for(int i = 0; i < N; i++)
            {
                string[] str1 = Console.ReadLine().Split(' ');
                for(int j = 0; j < M; j++)
                {
                    A[i,j] = int.Parse(str1[j]);
                }
            }
            int ans = 0;

            for(int i = 0; i < N; i++)
            {
                int sum = 0;
                for(int j = 0; j < M; j++)
                {
                    sum += A[i, j] * B[j];
                }
                sum += C;
                if(sum > 0) ans++;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include<vector>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>

using namespace std;

int main(void){
   int A,B,C;
   cin>>A>>B>>C;
   if(A+B>=C)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0; 
}

Measured memory_bytes: 256
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if k>=b-a and k>=c-a and k>=d-a and k>=e-a and k>=c-b and k>=d-b and k>=e-b and k>=d-c and k>=e-c and k>=e-d:
  print("Yay!")
else:
  print(":(")

Measured memory_bytes: 12500
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	A := make([]int, N)

	var all int
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
		all = all + A[i]
	}

	sort.Sort(sort.Reverse(sort.IntSlice(A)))
	var count int
	for i := 0; i < N; i++ {
		if A[i]*4*M >= all {
			count++
		} else {
			break
		}
	}

	if count >= M {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

signed main(){
	cout<<fixed<<setprecision(7);
	
	int N, M, A, B, a = 0, b = 0;
	
	cin>>N>>M;
	
	rep(i,N){
		cin>>A;
		a+= A;
	}
	
	rep(j,M){
		cin>>B;
		b+=B;
	}
	
	cout<<a*b<<endl;
	return 0;
}


Measured memory_bytes: 3092
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


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

    int a, b;
    cin >> a >> b;
    if (a <= 8 && b <= 8) {
        cout << "Yay!" << '\n';
    } else {
        cout << ":(" << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
using namespace std; 
using ll = long long;



int main(int argc, char const *argv[])
{
   int a, b;
   cin >> a >> b;
   for (int n = 0; n < 10000; n++)
   {
       int za = n*8/100;
       int zb = n*10/100;
       if (a == za && b == zb)
       {
           cout << n << endl;
           return 0;
       }
       
   }
   cout << -1 << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
using namespace std;

const int m[4]={10,50,100,500};
int main(){
    int cost;
    bool f=true;
    int havingMoney[4];
    int a[4];
    while(cin>>cost&&cost!=0){
        if(!f)
            cout<<endl;
        else
            f=false;
        int sumMoney=0;
        for(int i = 0; i < 4; i++){
            cin>>havingMoney[i];
            sumMoney+=havingMoney[i]*m[i];
        }
        int left=sumMoney-cost;
        for(int i = 3; i >= 0; i--){
            a[i]=left/m[i];
            left-=a[i]*m[i];
        }
        for(int i = 3; i >= 0; i--)
            a[i]=max(havingMoney[i]-a[i],0);
        int num=10;
        for(int i = 0; i < 4; i++){
            if(a[i]!=0)
                cout<<num<<" "<<a[i]<<endl;
            if(i%2==0)
                num*=5;
            else
                num*=2;
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ull mod = 1e9+7;
constexpr int N = 13;
ull dp[100010][N];

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int k;
	cin >> k;
	cout << myPower(k, 3) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int N;
	int A,B;
	char T[100],H[100];
	int PT=0,PH=0;
	scanf("%d",&N);
	for(A=0;A<N;A++){
		scanf("%s %s",T,H);
		for(B=0;T[B] && H[B] && T[B]==H[B];B++);
		if(T[B]>H[B])
			PT+=3;
		else if(T[B]<H[B])
			PH+=3;
		else{
			PT++;
			PH++;
		}
	}
	printf("%d %d\n",PT,PH);
	return 0;
}

Measured memory_bytes: 596
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        Scanner sc = new Scanner(is);
        /* read */
        int n = sc.nextInt();

        Map<Integer, Set<Integer>> lists = new HashMap<>();

        for (int i = 0; i < n; i++) {
            String s = sc.next();
            Set<Integer> list = new HashSet<>();

            for (int j = 0; j < n; j++) {
                if (s.charAt(j) == '1') {
                    // matrix[i][j] = true;
                    list.add(j);
                }
            }
            lists.put(i, list);
        }

        int max = -1;
        for (int i = 0; i < n; i++) {
            max = Math.max(depth(i, lists, n), max);
        }

        os.println(max);
    }

    private static class Node {
        int node;
        Set<Integer> parents = new HashSet<>();
    }

    private static int depth(int start, Map<Integer, Set<Integer>> lists, int N) {
        HashMap<Integer, HashSet<Integer>> tempLists = new HashMap<>();
        for (int j = 0 ; j < N ; j++) {
            tempLists.put(j, new HashSet<>(lists.get(j)));
        }
        Set<Integer> visited = new HashSet<>();
        Set<Integer> curr = new HashSet<>();
        curr.add(start);

        int count = 0;
        while (0 < curr.size()) {
            count++;
            Set<Integer> next = new HashSet<>();
            for (Integer n : curr) {
                Set<Integer> nexts = tempLists.get(n);
                for (int nx : nexts) {
                    if (visited.contains(nx)) {
                        // visiting again
                        return -1;
                    }
                    next.add(nx);
                }
                visited.add(n);
            }
            for (Integer n : curr) {
                for(Integer child : next) {
                    tempLists.get(child).remove(n);
                }
            }
            curr = new HashSet<>(next);
        }
        return count;
    }
}

Measured memory_bytes: 159400
#include <iostream>

int main(void) {
    using namespace std;

    int n;
    string s;

    cin >> n >> s;

    int count = 1;
    char prev = s[0];

    for (int i = 1; i < n; i++) {
        if (prev != s[i]) {
            count++;
            prev = s[i];
        }
    }

    cout << count << endl;

    return 0;
}


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

#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define INF 1000000009
#define mod 1000000007
using namespace std;
typedef long long ll;

int n, m;
char mat[1002][1002];
ll deg[1002][1002];

int main(){
	//freopen("stl.gir", "r", stdin);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> mat[i][j];
		}
	}
	
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			deg[i][j] = (i == 0 && j == 0);
			if (mat[i][j] == '.'){
				if (i > 0) deg[i][j] += deg[i-1][j];
				if (j > 0) deg[i][j] += deg[i][j-1];
				deg[i][j] %= mod;
			}
		}
	}
	
	cout << deg[n-1][m-1] << endl;
	
	
}

Measured memory_bytes: 9088
#include<stdio.h>
#include<math.h>

int main()
{
    int a,b,c,d;
    int i,j,k,l,m,n;
    while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF)
    {
        if(b<=c||d<=a)
        {
            printf("0\n");
        }
        else
        {
            i=a<c?a:c;
            j=a+c-i;
            k=b<d?b:d;
            l=b+d-k;
            printf("%d\n",k-j);
        }
    }
    return 0;
}


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

int main(){
	int a,b;
	cin >> a >> b;
	int x = 0;
	for(int i = 1; i <= b - a; i++){
		x += i;
	}
	cout << x - b << endl;
}

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

using namespace std;

int a[100000], cost[100000];

int main() {
    int n, k;
    cin >> n;
    k = 2;
    // cin >> k;
    
    for(int i=0;i<n;++i) cin >> a[i];

    fill(cost+1, cost+n, 1 << 30);
    for(int i=0;i<n-1;++i) {
        for(int j=1;j<=k&&i+j<n;++j) {
            cost[i+j] = min(cost[i+j], cost[i] + abs(a[i+j] - a[i]));
        }
    }

    cout << cost[n-1] << "\n";
}

Measured memory_bytes: 1024
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)

N = int(input())
#print(N)
S=[]
for i in range(N):
    #print(i)
    S.append("".join(sorted(input())))
    # print(input())
S.sort()
#print(S)
n = 1
ans=0
for i in range(1,N):
    if S[i] == S[i-1]:
        n = n + 1
    else:
        #print(i,n)
        ans = ans + n * (n-1) //2 
        n = 1
ans = ans + n * (n-1) // 2
print(ans)


Measured memory_bytes: 10636
#include<stdio.h>
#include<math.h>
#define P M_PI/180
typedef struct xy{
  double x;
  double y;
}XY;
XY A[1000];
void kof(double x1,double y1,double x2,double y2,int dim){
  double x3,y3,x4,y4,x5,y5;
  if(dim>0){
    x3=(2*x1+x2)/3;
    y3=(2*y1+y2)/3;
    x5=(x1+2*x2)/3;
    y5=(y1+2*y2)/3;
    x4=x3+(x5-x3)*cos(60*P)-(y5-y3)*sin(60*P);
    y4=y3+(x5-x3)*sin(60*P)+(y5-y3)*cos(60*P);
    kof(x1,y1,x3,y3,dim-1);
    printf("%.8f %.8f\n",x3,y3);
    kof(x3,y3,x4,y4,dim-1);
    printf("%.8f %.8f\n",x4,y4);
    kof(x4,y4,x5,y5,dim-1);
    printf("%.8f %.8f\n",x5,y5);
    kof(x5,y5,x2,y2,dim-1);
  }  
}
main(){
  int n,j,k,temp;
  scanf("%d",&n);
  printf("0.00000000 0.00000000\n");
  kof(0,0,100,0,n); 
  printf("100.00000000 0.00000000\n");
  return 0;
}

Measured memory_bytes: 648
import sys

def main():
    input = sys.stdin.readline
    S = input().strip()
    k = len(S)
    win = 0
    for c in S:
        if c == 'o':
            win += 1

    if win + (15 - k) >= 8:
        return 'YES'
    else:
        return 'NO'


if __name__ == '__main__':
    print(main())


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

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

    std::vector<int> p(N);
    for (int i = 0; i < N; i++)
        std::cin >> p[i];

    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            std::swap(p[i], p[j]);

            bool flag = true;
            for (int i = 0; i < N - 1; i++)
                if (p[i] > p[i + 1])
                    flag = false;
            
            if (flag) {
                std::cout << "YES\n";
                return 0;
            }

            std::swap(p[i], p[j]);
        }
    }

    std::cout << "NO\n";
}

Measured memory_bytes: 256
from functools import reduce

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]
    T = [
        ['d','r','e','a','m'],
        ['d','r','e','a','m','e','r'],
        ['e','r','a','s','e'],
        ['e','r','a','s','e','r']
    ]
    S = list(_ for _ in input())
    S.reverse()

    for i in range(4):
        T[i].reverse()
    while len(S)>0:
        if(S[0:len(T[0])] == T[0]):
            for i in range(len(T[0])):
                S.pop(0)
        elif(S[0:len(T[1])] == T[1]):
            for i in range(len(T[1])):
                S.pop(0)
        elif(S[0:len(T[2])] == T[2]):
            for i in range(len(T[2])):
                S.pop(0)
        elif(S[0:len(T[3])] == T[3]):
            for i in range(len(T[3])):
                S.pop(0)
        else:
            print('NO')
            break
        
    if(len(S) ==0):
        print('YES')

    
if __name__ == '__main__':
    main()


Measured memory_bytes: 4604
n = int(input())
p = [int(s) for s in input().split()]
ans = 0
for i in range(1, n - 1):
    if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
        ans += 1
print(ans)


Measured memory_bytes: 3316
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 10000000000000010ll
#define ldb long double
#define pb push_back
#define put_(x) printf("%d ",x);
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define gi(x) scanf("%lf",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE int i=p;i<=n;++i)
#define go(x) for(int i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE int i=n;i>=p;--i)
#define vep(p,n,i) for(RE int i=p;i<n;++i)
#define pii pair<int,int>
#define mk make_pair
#define RE register
#define P 1000000007
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define uint unsigned long long
#define ui unsigned
#define EPS 1e-8
#define sq sqrt
#define S second
#define F first
#define mod 998244353
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
    RE int x=0,f=1;RE char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=((ll)x*10+ch-'0')%mod;ch=getc();}
    return x*f;
}
const int MAXN=200010;
int n,len;
string a;
map<string,int>H;
int main()
{
	//freopen("1.in","r",stdin);
	ios::sync_with_stdio(false);
	cin>>n;
	rep(1,n,i)
	{
		cin>>a;
		++H[a];
	}
	cout<<"AC "<<"x "<<H["AC"]<<endl;
	cout<<"WA "<<"x "<<H["WA"]<<endl;
	cout<<"TLE "<<"x "<<H["TLE"]<<endl;
	cout<<"RE "<<"x "<<H["RE"]<<endl;
	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

signed main(){
    int N,M;
    scanf("%lld%lld",&N,&M);
    const int INF=1001001001001001001;
    int L=-INF;
    int R=INF;
    rep(i,M){
        int l,r;
        scanf("%lld%lld",&l,&r);
        chmax(L,l);
        chmin(R,r);
    }
    cout<<max(0ll,R-L+1)<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A_LIST = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(N - 1):
    if A_LIST[i] < A_LIST[i + 1]:
        # 購入
        stock += money // A_LIST[i]
        money %= A_LIST[i]
        # print("購入")
        # print(money)

    if A_LIST[i] > A_LIST[i + 1]:
        # 売却
        money += A_LIST[i] * stock
        stock = 0
        # print("売却")
        # print(money)

# 最後
money += A_LIST[-1] * stock
stock = 0
print(money)


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0) {
      cout << (a + b) / 2 << '\n';
    } else {
      cout << "IMPOSSIBLE" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256