akhauriyash/Code-Regression huggingface dataset:
//C++
//#pragma comment(linker, "/STACK:102400000,102400000")
//G++
//#define OPENSTACK
#define ONLINE_JUDGE
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cctype>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int MOD = 998244353;
const int N = 3e5 + 10, M = N;//刻意开大会消耗时间.

int ha[N], hb[N];

int main()
{
    #ifdef OPENSTACK
    int size = 64 << 20; // 64MB
    char *p = (char*)malloc(size) + size;
    #if (defined _WIN64) or (defined __unix)
        __asm__("movq %0, %%rsp\n" :: "r"(p));
    #else
        __asm__("movl %0, %%esp\n" :: "r"(p));
    #endif
    #endif
    #ifndef ONLINE_JUDGE
        freopen("../put/a.input","r",stdin);
        freopen("../put/a.output","w",stdout);
    #endif
    clock_t c1 = clock();
    //coding here......

    int h, w, m;
    cin >> h >> w >> m;

    // 难点是哈希查找该点是否真的存在.
    unordered_map<int, unordered_set<int>> hash;
    unordered_map<int, vector<int>> row;
    unordered_map<int, vector<int>> line;
    int max1 = 0, max2 = 0;
    // 最大值的时候相等, 但是如何找到是否没有该点.
    for(int i = 1; i <= m; i ++){
        int a, b;
        cin >> a >> b;
        hash[a].insert(b);

        ha[a] ++;
        if(ha[a] > max1) max1 = ha[a], row[max1].push_back(a);
        else if(ha[a] == max1) row[max1].push_back(a);
        hb[b] ++;
        if(hb[b] > max2) max2 = hb[b], line[max2].push_back(b);
        else if(hb[b] == max2) line[max2].push_back(b);
    }

    bool flag = false;
    vector<int> x1 = row[max1], y1 = line[max2];
    for(auto c : x1){
        for(auto s : y1)
            if(hash.count(c) == 0 || hash[c].count(s) == 0) {
                cout << max1 + max2 << endl, flag = true;
                break;
            }
        if(flag) break;
    }

    if(!flag) cout << max1 + max2 - 1 << endl;

    //finish here......
    #ifndef ONLINE_JUDGE
        std::cerr << "Time:" << clock() - c1 << "ms" << std::endl;
    #endif
    #ifdef OPENSTACK
        exit(0);
    #else
        return 0;
    #endif
}


Measured memory_bytes: 80516
// AOJ Volume 0 Problem 0070

#include <stdio.h>
#include <string.h>

#define MAX_SUM (2*1 + 3*2 + 4*3 + 5*4 +6*5 + 7*6 + 8*7 + 9*8 + 10*9)

int no;
int n, s;
int num[10];
int table[MAX_SUM + 1][10];

void combination(int depth, int sum)
{
	int i;
	int s;
	
	if (depth == 11){
		return;
	}

	for (i = 0; i <= 9; i++){
		if (num[i] == 0){
           	num[i] = 1;
			s = sum + i * depth;
			
			table[s][depth]++;
		    combination(depth + 1, s);
		    num[i] = 0;
		}
	}
}

int main(void)
{
	combination(1, 0);
	
	while (scanf("%d%d", &n, &s) != EOF){
		if (s > 330 || n > 10){
			printf("0\n");
			continue;
		}
		printf("%d\n", table[s][n]);
	}
	
	return (0);
}

Measured memory_bytes: 296
#include<stdio.h>

int main(void){
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/(double)b;
	printf("%d %d %lf",d,r,f);
	

return 0;
}



Measured memory_bytes: 2104
#include <cstdio>
#include <algorithm>
using namespace std;
int A[100005], n, mini, maxi;
int main(){
	mini = 1e9;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++){
		scanf("%d", &A[i]);
		mini = min(mini, A[i]);
		maxi = max(maxi, A[i]);
	}
	if (maxi - mini >= 2){
		puts("No"); return 0;
	}
	int cnt=0, cnt2=0;
	for (int i = 1; i <= n; i++){
		if (maxi == A[i]){
			++cnt;
		}
		else cnt2++;
	}
	//a[i]값 모두 같을 때
	if (cnt == n){
		if (maxi == n - 1){
			puts("Yes"); return 0;
		}
		if (maxi * 2 > n)puts("No");
		else puts("Yes");
		return 0;
	}

	//cnt2-1개의 독보적 모자가 있어야 함
	if (cnt2 - 1 > mini){
		puts("No"); return 0;
	}
	//단독 색깔 가질 수 없는 집단 내에서 rem개의 서로다른 모자가 존재해야함
	int rem = mini - (cnt2 - 1);
	if (rem!=0 &&cnt >= 2 * rem || rem==0 && cnt==0 ){
		puts("Yes");
	}
	else puts("No");
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int N = read(), mina, negac = 0;
    int_fast64_t ans = 0;
    vector<int> A(N);
    for (int i = 0; i<N; i++) A[i] = read();
    mina = abs(A[0]);
    for (int i = 0; i<N; i++) {
        mina = min(mina, abs(A[i]));
        ans += abs(A[i]);
        if (A[i] < 0) negac++;
    }
    if (negac%2 != 0) ans -= 2*mina;
    printf("%lld\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

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

const int maxn = 100009;
vector<int> e[maxn];
int pa[maxn], size[maxn];
int n, a, b, res, p;

void dfs(int u, int d){
	if (u == n) res = d/2;
	size[u] = 1;
	for (int i=e[u].size()-1; i>=0; i--)
		if (e[u][i] != pa[u]){
			pa[e[u][i]] = u;
			dfs(e[u][i], d+1);
			size[u] += size[e[u][i]];
		}
}

int main(){
	scanf("%d", &n);
	for (int i=1; i<=n-1; i++){
		scanf("%d%d", &a, &b);
		e[a].push_back(b);
		e[b].push_back(a);
	}
	pa[1] = 0; dfs(1, 1); p = n;
	for (int i=1; i<=res-1; i++) p = pa[p];
	puts(size[p] >= n-size[p] ? "Snuke" : "Fennec");
	return 0;
}

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

vector<int> fact(int n) {
	vector<int> f;
	for (int i = 1; i * i <= n; i++) if (n % i == 0) {
		f.push_back(i);
		if (i * i != n) f.push_back(n / i);
	}
	sort(f.rbegin(), f.rend());
	return f;
}

int main()
{
	int b;
	while (cin >> b, b) {
		for (int x : fact(b * 2)) {
			if (b % x == 0) {
				if (x % 2 == 0) continue;
				int c = b / x;
				int l = c - x / 2;
				if (1 <= l) {
					cout << l << ' ' << x << endl;
					break;
				}
			}
			else if ((b * 2) % x == 0) {
				if (x % 2 != 0) continue;
				int c = b / x;
				int l = c - x / 2 + 1;
				if (1 <= l) {
					cout << l << ' ' << x << endl;
					break;
				}
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3156
#include<stdio.h>
#include<string.h>

int main(){
    int cnt,len,i;
    char s[101],r[101];

    cnt = 0;
    while(scanf("%s",s)!=EOF){
        len = strlen(s);
        for(i = 0;i < len;i++){
            r[i] = s[len - 1 - i];
        }
        r[i]='\0';
        if(strcmp(s,r) == 0)cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 548
#include<bits/stdc++.h>
using namespace std;
int n,a,b,town[100010];
long long totalsum=0;

int main()
{
	int i,j;
	
	scanf("%d %d %d",&n,&a,&b);
	for(i=0;i<n;i++)
	{
		scanf("%d",&town[i]);
	}
	
	long long a1,a2;
	a2 = b;
	for(i=1;i<n;i++)
	{
		a1 = a;
		a1 *= (town[i] - town[i-1]);
		if(a1 <= a2)
		{
			totalsum += a1;
		}
		else totalsum += a2;
	}
	printf("%lld\n",totalsum);
}

Measured memory_bytes: 4184
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		long N = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();

		sc.close();

		if ((B - A) % 2 == 0) {
			out.println((B - A) / 2);
		} else {
			long a = A + (B - A) / 2;
			long b = (N - A + (N - B + 1)) / 2;
			out.println(Math.min(a, b));
		}

	}

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


Measured memory_bytes: 23764
a = int(input())
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(L[a-1])

Measured memory_bytes: 38384
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n*3) ;
	for(auto &i:a) cin >> i ;
	vll mx(n*3,0),mn(n*3,0) ;
	priority_queue<ll,vector<ll>,greater<ll>> pq1 ;
	ll sum = 0 ;
	for(int i=0;i<n*3;i++){
		if(i<n){
			sum += a.at(i) ;
			pq1.push(a.at(i)) ;
		}else{
			ll t = pq1.top() ;
			if(t<a.at(i)){
				sum -= t ;
				sum += a.at(i) ;
				pq1.pop() ;
				pq1.push(a.at(i)) ;
			}
		}
		mx.at(i) = sum ;
	}
	priority_queue<ll> pq2 ;
	sum = 0 ;
	reverse(all(a)) ;
	for(int i=0;i<n*3;i++){
		if(i<n){
			sum += a.at(i) ;
			pq2.push(a.at(i)) ;
		}else{
			ll t = pq2.top() ;
			if(t>a.at(i)){
				sum -= t ;
				sum += a.at(i) ;
				pq2.pop() ;
				pq2.push(a.at(i)) ;
			}
		}
		mn.at(mn.size()-1-i) = sum ;
	}
	ll ans = -1000000000000000 ;
	for(int i=n-1;i<n*2;i++){
		ans = max(ans,mx.at(i)-mn.at(i+1)) ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 9588
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int x,y;
    cin>>x>>y;
    while(x>=0){
		while(x<y){
		y=y-x;
		}
		while(x>y){
			x=x-y;
		}
		if(x==y){
			cout<<x<<endl;
			break;
		}
	}
}



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

int main(void) {
    int n, m;
    cin >> n >> m;

    vector<vector<pair<int,long>>> G(n);

    for(int i=0; i<m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        G[a].push_back(pair<int,long>(b, -c));
    }

    vector<long> dis(n, 1e18);

    dis[0] = 0;

    for(int i=0; i<=n+10; i++) {
        for(int i=0; i<n; i++) {
            for(auto &j: G[i])
                if(dis[i] + j.second < dis[j.first])
                    dis[j.first] = dis[i] + j.second;
        }
    }

    for(int i=0; i<=n+10; i++) {
        for(int i=0; i<n; i++) {
            for(auto &j: G[i])
                if(dis[i] + j.second < dis[j.first]) {
                    dis[j.first] = dis[i] + j.second;
                    if(j.first == n-1) {
                        cout << "inf" << endl;
                        return 0;
                    }
                }
        }
    }

    cout << -dis[n-1] << endl;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#pragma comment(linker, "/STACK:36777216")

using namespace std;

#define MP make_pair
#define all(v) (v).begin(), (v).end()
#define PROBLEM_ID "A"

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int main() {
  //freopen(PROBLEM_ID".in", "r", stdin);
  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << "YES" << endl;
    return 0;
  }
  ll sum = 0;
  for (int i = 0; i < a.size(); ++i) {
    sum += a[i];
  }
  if (sum % (ll(n) * ll(n + 1) / 2) != 0) {
    cout << "NO" << endl;
    return 0;
  }
  ll s = sum / (ll(n) * ll(n + 1) / 2);
  reverse(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    int right = s - a[i] + a[(i + 1) % n];
    if (right < 0 || right % n != 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;
class UnionFind {
  vector<ll> par, rank; // par > 0: number, par < 0: -par
public:
  void init(ll n) {
    par.resize(n, 1); rank.resize(n, 0);
  }
  ll getSize(ll x) {
    return par[find(x)];
  }
  ll find(ll x) {
    if (par[x] > 0) return x;
    return -(par[x] = -find(-par[x]));
  }
  void merge(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
      par[y] += par[x];
      par[x] = -y;
    } else {
      par[x] += par[y];
      par[y] = -x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }
  bool isSame(ll x, ll y) {
    return find(x) == find(y);
  }
};


ll N,M;
ll h[100010];
vector<ll> edgeList[100010];
int main(){
    cin>>N>>M;
    for(ll i=0;i<N;i++)cin>>h[i];
    for(ll i=0;i<M;i++){
        ll a,b;cin>>a>>b;
        a--;b--;
        edgeList[a].push_back(b);
        edgeList[b].push_back(a);
    }
    ll ans=N;
    for(ll i=0;i<N;i++){
        for(auto e:edgeList[i]){
            if(h[e]>=h[i]){
                ans--;break;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 10264
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m; cin >> n >> m;
  vector<P> student(n);
  rep(i, n) {
    int a, b; cin >> a >> b;
    student.at(i) = P(a, b);
  }

  vector<P> checkpoint(m);
  rep(i, m) {
    int c, d; cin >> c >> d;
    checkpoint.at(i) = P(c, d);
  }
  
  rep(i, n) {
    int distance = INT_MAX;
    int pos = -1;
    rep(j, m) {
      int now = abs(student.at(i).first - checkpoint.at(j).first);
      now += abs(student.at(i).second - checkpoint.at(j).second);
      if (now < distance) {
        distance = now;
        pos = j;
      }
    }
    cout << pos+1 << endl;
  }
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  for (int i = 1; i <= n; i++) {  // i=1~nまで
    int cnt = 0;
    for (int x = 1; x * x < i; x++) {
      for (int y = x; y * y < i; y++) {
        for (int z = y; z * z < i; z++) {
          if (x * x + y * y + z * z + x * y + x * z + y * z == i) {
            if (x == y && y == z) {
              cnt++;
            } else if ((x == y && y != z) || (y == z && z != x) ||
                       (z == x && x != y)) {
              cnt += 3;
            } else {
              cnt += 6;
            }
          }
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 3620
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, T = MI()
    t = LI()
    x = 0
    for i in range(n-1):
        diff = t[i+1] - t[i]
        x += min(diff, T)
    x += T
    print(x)

if __name__ == '__main__':
    main()

Measured memory_bytes: 31004
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	string a, b; cin >> a >> b;
	ll num = stoi(a + b);
	ll sq = (ll)(floor(sqrt(num)));
	cout << (sq * sq == num ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    ll n,m;
    cin >> n >> m;
    int max_l=0,min_r=INT_MAX;
    rep(i,m){
        int l,r;
        cin >> l >> r;
        max_l = max(l,max_l);
        min_r = min(r,min_r);
    }
    cout << max(0, min_r-max_l+1) << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8

#問題文
#Atcoder国では、郵便番号は A+B+1 文字からなり、A+1 文字目はハイフン -、それ以外の全ての文字は 0 以上 9 以下の数字です。
#例：1111-11111
#文字列 S が与えられるので、Atcoder国の郵便番号の形式を満たすかどうか判定してください。
#
#制約
#1≦A,B≦5
#|S|=A+B+1
#S は 0 以上 9 以下の数字、およびハイフン - からなる
#入力
#入力は以下の形式で標準入力から与えられる。
#
#A B
#S
#出力
#S がAtcoder国の郵便番号の形式を満たすならば Yes 、そうでなければ No を出力せよ。

import re

a, b = input().split(" ")
s = input()

regex = "[0-9]{" + a + "}-[0-9]{" + b + "}"
match_res = re.fullmatch(regex, s)

ans = "No"
if(match_res != None):
   ans = "Yes"
print(ans)

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

using namespace std;
using vi = vector<int>;

#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"

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

  IN(N);

  vi H(N);
  REP(i, N) {
    cin >> H[i];
  }
  reverse(ALL(H));

  int ans = 0;
  int before = H[0];
  int count = 0;
  FOR(i, 1, N) {
    if (before <= H[i]) {
      ++count;
    } else {
      ans = max(ans, count);
      count = 0;
    }
    before = H[i];
  }
  ans = max(ans, count);
  OUT(ans);

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int X,A,B;
int main(){
    cin >> X >> A >> B;
    if(A >= B){
        cout << "delicious" << endl;
    }else if(A + X >= B){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
}

Measured memory_bytes: 256
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
  	for(int i=0;s[i];i++)
    {
      if(s[i]==',')
        s[i]=char(32);
    }
    cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
	
	int n,angka[105],i,j;
	
	scanf ("%d", &n);
	for (i=0;i<n;i++){
		scanf ("%d", &angka[i]);
	}
	for (j=n-1;j>0;j--){
		printf ("%d ", angka[j]);
	}
	printf ("%d\n",angka[0]);
	
return 0;
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define Rep(i,n) for(int i=0;i<(int)(n);++i)

#define int long long

using namespace std;

signed main()
{
    char x,y,z,w,i;
    std::vector<char> Size(4);
    std::vector<int>  Vec(4);
cin>>Size[0]>>Size[1]>>Size[2]>>Size[3];
Rep(x,3){
rep(i,3){
if((int)Size[i]>(int)Size[i+1]){
    std::swap(Size[i],Size[i+1]);
}
}


}
    if((int)Size[0]==(int)Size[1]&&(int)Size[2]==(int)Size[3]&&(int)Size[0]!=(int)Size[3]){
      
             cout<<"Yes"<<endl;

    }else{
         cout<<"No"<<endl;

    }
    return 0;
}

Measured memory_bytes: 256
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map(fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String

let n, m, c = readIntArray() |> fun x -> (x.[0], x.[1], x.[2])
let b = readIntArray();
let a = [for i in [1..n] -> readIntArray()]

let mul a1 a2 = Array.map2 (fun x y -> x * y) a1 a2 |> Array.sum

let rec solve list = 
    match list with
    | h::t -> if (mul h b) + c > 0 then (solve t) + 1 else solve t
    | _ -> 0

solve a
|> printfn "%d"

Measured memory_bytes: 14288
# coding: utf-8
# Your code here!

while True:
    n = int(input())
    #print(n)
    if n==0:
        break
    n = 1000-n
    #print(n)
    m = n//500
    n = n%500
    #print(n,m)
    m += n//100
    n = n%100
    #print(n,m)
    m += n//50
    n = n%50
    #print(n,m)
    m += n//10
    n = n%10
    #print(n,m)
    m += n//5
    n = n%5
    #print(n,m)
    m += n
    #print(n,m)
    
    print(m)



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

const int Maxn = 110;
int a[Maxn];

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

    int cnt = 0;
    for (int i = 0; i + 1 < n; ++i){
        if (a[i] == a[i+1]){
            ++cnt;
            ++i;

        }
    }

    cout << cnt << endl;

    return 0;
}

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

LL exp(LL a,LL b){
    if(b==0){
        return 1;
    }
    else{
        LL v=exp(a,b/2);
        if(b%2==0){
            return v*v;
        }
        else{
            return a*v*v;
        }
    }
}

int main() {
	LL n;
	cin>>n;
	LL cnt=0;
	LL p=n;
	LL dgts=0;
	while(p){
	    dgts++;
	    p=p/10;
	}
	for(LL i=1;i<dgts;i++){
	    if(i%2!=0){
	        cnt+=9*exp(10,i-1);
	    }
	}
	if(dgts%2!=0){
	    LL v=exp(10,dgts-1);
	    LL t=n-v+1;
	    cnt+=t;
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main(){

    //n個の整数
    int n; cin >> n;
    //整数
    vector<long long int> A(n);
    for(int i=0; i<n; i++) cin >> A[i];

    //0が含まれるかの確認
    for(int i=0; i<n; i++){
        if(A[i] == 0){
            cout << "0" << endl;
            exit(0);
        }
    }

    long long int ans = 1;
    for(int i=0; i<n; i++){
        if(A[i] > ((long long int)pow(10,18))/ans){
            cout << "-1" << endl;
            exit(0);
        }

        ans *= A[i]; 
    }

    cout << ans << endl;
}

Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
/*
 * 自明
 */

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n,d;
	cin>>n>>d;
	vi a(n);
	rep(i,n)cin>>a[i];
	sort(all(a));
	int p=abs(d-a[0]);
	
	for(int i=n-1;i>0;i--){
	    p=gcd(p,a[i]-a[0]);
	}
	cout<<p<<endl;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void){
  int a, b;
  scanf("%d%d", &a, &b );
  int max;
  int x = a + b;
  int y = a - b;
  int z = a * b;
  max = x;
  if ( y > max ) max = y;
  if ( z > max ) max = z;

  printf("%d", max );
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c;
	string str;
	cout << fixed << setprecision(10);
	cin>>a>>b>>c;
	cout<<max(0LL,c-a+b);


	cout<<endl;
} 


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#define N 100006
#define ll long long
#define dd double
#define esp 1e-10
using namespace std;

ll n;
int a[106],cnt;

int main(){
	scanf("%lld",&n);
	--n;
	cnt=0;
	while(n>0){
		a[++cnt]=n%26;
		n/=26;
		--n;
	}
	if(n==0)
		++cnt;
	for(int i=cnt;i>=1;--i)
		cout<<(char)(a[i]+'a');
}

Measured memory_bytes: 3676
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var A = new int[N];
        var B = new int[N];
        for (int i = 0; i < N; i++)
        {
            var line = ReadLine().Split(' ');
            A[i] = int.Parse(line[0]);
            B[i] = int.Parse(line[1]);
        }

        Array.Sort(B, A);

        var s = new long[N + 1];
        for (int i = 0; i < N; i++)
        {
            s[i + 1] = s[i] + A[i];
        }
        var ans = true;
        for (int i = 0; i < N; i++)
        {
            if (B[i] < s[i + 1]) ans = false;
        }
        WriteLine(ans ? "Yes" : "No");
    }
}

Measured memory_bytes: 18092
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int, S: str):
    return len([c for i, c in enumerate(S) if i == 0 or c != S[i-1]])


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    print(f'{solve(N, S)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 81472
#include <cstdlib>
#include <iostream>
#include <vector>


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

  int n, m;
  std::cin >> n >> m;
  std::vector<int> cnts(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    std::cin >> a >> b;
    cnts[a - 1]++;
    cnts[b - 1]++;
  }
  for (const auto& e : cnts) {
    std::cout << e << std::endl;
  }

  return EXIT_SUCCESS;
}


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

int main(){
  int a,b,v,ans=-1;
  cin >> a >> b;
  v = b/0.1;
  while(v < 1010){
    int x,y,tmp1,tmp2;
    x = v;
    y = v;
    x*=0.1;
    y*=0.08;
    tmp1 = x;
    tmp2 = y;
	if(tmp1 == b)
    if(tmp2 == a){
      ans = v;
      break;
    }
    v++;    
  }

  cout << ans;
  return 0;
} 

Measured memory_bytes: 256
# dp[i][w_sum]: i-1番目までの品物で重さがw_sumを超えないように選んだときの、価値の総和の最大値

N, W = map(int, input().split())
items = [tuple(map(int, input().split())) for i in range(N)]

dp = [[0 for w_sum in range(W+100)] for i in range(N+100)]

for i in range(N):
    for w_sum in range(W+1):

        # i-1番目の品物を選ぶ場合
        # 重量的に入れられるなら入れてみる
        if w_sum-items[i][0] >= 0:
            dp[i+1][w_sum] = max(dp[i+1][w_sum],
                                 dp[i][w_sum-items[i][0]]+items[i][1])

        # i-1番目の品物を選ばない場合
        dp[i+1][w_sum] = max(dp[i+1][w_sum], dp[i][w_sum])

print(dp[N][W])


Measured memory_bytes: 258312
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;

constexpr double PI = acos(-1);

int main()
{

    int a, b, C;
    cin >> a >> b >> C;

    double S = 0.5 * a * b * sin(C*PI/180);
    double c = sqrt(a*a + b*b -2*a*b*cos(C*PI/180));
    double h = b*sin(C*PI/180);
    cout << fixed;
    cout << S << endl;
    cout << a+b+c << endl;
    cout << h << endl;
}


Measured memory_bytes: 3544
from collections import deque
que=deque(input())
q=int(input())
rev=False
for i in range(q):
    s=input()
    if s=="1":
        rev= not rev
    else:
        t,f,c=s.split()
        if (f=='1' and rev==False) or (f=='2' and rev):
            que.appendleft(c)
        else:
            que.append(c)
A=que
if rev:
    A.reverse()
print("".join(A))

Measured memory_bytes: 8436
/*
Á·Ï°Ìâ£ºPrime Number_AOJ 0009 
*/

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

const int MAX_N=1000007;

//°£ÊÏÉ¸·¨(Sieve of Eratosthenes)
int prime[MAX_N]; //µÚi¸öËØÊý£¬´ËÎª´æ·ÅËØÊýµÄÊý×é 
bool is_prime[MAX_N]; //is_prime[]ÎªtrueÊ±ÎªËØÊý

//·µ»ØnÒÔÄÚËØÊýµÄ¸öÊý
int sieveErato(int n)
{
	int p=0;
	for(int i=0; i<=n; i++)
		is_prime[i]=true;
	is_prime[0]=false;
	is_prime[1]=false;
	for(int i=2; i<=n; i++)
	{
		if(is_prime[i])
		{
			prime[p++]=i;
			for(int j=2*i; j<=n; j+=i)
				is_prime[j]=false;
		}
	}
	return p;
}


int main()
{
	int n;
	while(scanf("%d", &n)!=EOF)
	{
		printf("%d\n", sieveErato(n));
	}
	return 0;
}


Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b;
  cin >> a >> b;
  if(a==b){
    cout << "Draw" << endl;
  }else if(a==1){
    cout << "Alice" << endl;
  }else if(b==1){
    cout <<  "Bob" << endl;
  }else if(a>b){
  	cout << "Alice" << endl;
  }else{
    cout << "Bob" << endl;
  }
}


Measured memory_bytes: 256
_,*s=open(0)
t="."
b=t*101
q=range(101)
i=0
for s in s:
 a=[i];i+=1
 for x,y,z,c in zip(b,t+s,s,q):a+=min(c+(t>z<x),a[-1]+(t>z<y)),
 b,q=s,a[1:]
print(a[-2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define MAXN (int)(2 * 1e5 + 5)
#define MAXL 20
#define F first
#define S second
#define endl "\n"
#define MOD (lli)(1e9 + 7)
#define lli long long int
#define sz(a) int(a.size())
#define DEBUG if (0) cout << "aqui" << endl;
#define PI 2 * acos(0.0)
typedef pair<int, int> ii;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1};

int n;
int ans[MAXN];

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

  cin >> n;
  for(int i=2;i<=n;i++) {
    int a;
    cin >> a;
    ans[a]++;
  }

  for(int i=1;i<=n;i++) cout << ans[i] << endl;

  return 0;
}

Measured memory_bytes: 4444
#include "bits/stdc++.h"
using namespace std;
int main(){
    string s;
    while(getline(cin,s)){
        if(s=="0") break;
        stringstream ss;
        vector<int> a;
        int n,f=0,sum=0;
        ss<<s;
        while(ss>>n){
            if(n==1)f=1;
            a.push_back((n>=10)?10:n);
            if(ss.eof()) break;
        }
        for(int i=0;i<a.size();++i) sum+=a[i];
        if(f&&sum<=11) sum+=10;
        if(sum>21)cout<<0<<endl;
        else cout<<sum<<endl;
    }
    return 0;
}

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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    string s;
    cin1(s);

    lli ans = 0;
    lli count = 0;
    REP(i, 0, s.length()) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            count++;
        }
        else {
            ans = max(ans, count);
            count = 0;
        }
    }
    cout << max(ans, count) << endl;
}


Measured memory_bytes: 256
import sys
from bisect import bisect_left, bisect_right

input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    A.sort()
    B.sort()
    C.sort()

    ans = 0
    for b in B:
        n_a = bisect_left(A, b)
        n_c = N - bisect_right(C, b)
        ans += n_a * n_c

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 29084
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;

int main() {
    int H,W;
    cin>>H>>W;
    vector<vector<char>> mat(H,vector<char>(W));
    vector<vector<ll>> dp(H,vector<ll>(W,0));
    dp[0][0] = 1;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>mat[i][j];
        }
    }
    for(int i=1;i<W;i++){
        if(mat[0][i] == '.'){
            dp[0][i] = dp[0][i-1];
        }else{
            dp[0][i] = 0;
        }
    }
    for(int i=1;i<H;i++){
        if(mat[i][0] == '.'){
            dp[i][0] = dp[i-1][0];
        }else{
            dp[i][0] = 0;
        }
    }
    for(int i=1;i<H;i++){
        for(int j=1;j<W;j++){
            if(mat[i][j]=='.'){
                dp[i][j] = dp[i-1][j]%MOD + dp[i][j-1]%MOD;
            }else{
                dp[i][j] = 0;
            }
            dp[i][j] %= MOD;
        }
    }
    cout<<dp[H-1][W-1]<<endl;
	return 0;
}

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

ll rec(ll a,ll b){
  if(a % b == 0){
    ll c = a/b;
    return b * (2*c-1);
  }else{
    ll res = b * 2 * (a/b);
    return res + rec(b, a % b);
  }
}

int main(void){
  ll n,x;
  cin >> n >> x;
  ll res = n;
  ll tmp = min(x,n-x);
  res += rec(n-tmp,tmp);
  cout << res << endl;
  return 0;
}


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    ll k = INF;
    ll ans = 0;
    rep(i, n - 1) {
        if (v[i] == v[i + 1]) {
            ans++;
            v[i + 1] = k;
            k++;
        }
    }
    cout << ans << endl;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

ll H, W;

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

  std::cin >> H >> W;

  ll res = -1;

  if(H == 1 || W == 1){
      res = 1;
  }else{
      ll n1 = (W + 1) / 2, n2 = W - n1;
      ll m1 = (H + 1) / 2, m2 = H - m1;
      res = n1 * m1 + n2 * m2;
  }

  std::cout << res << std::endl;
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a)<abs(x-b)) puts("A");
    else puts("B");
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

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

int main(void) {
  int n;
  vector<double> v;
  cin>>n;
  for(int i=0; i<n; i++) {
    double x;
    cin>>x;
    v.push_back(x);
  }

  sort(v.begin(), v.end());
  double x = (v[0] + v[1]) / 2.0;
  for(int i=2; i<n; i++) {
    x = (x + v[i]) / 2.0;
  }
  std::cout << setprecision(10) << x << std::endl;
  
  return 0;
}



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

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PDD;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

int main() {
  _upgrade;
  int k;
  cin >> k;
  priority_queue<LL, vector<LL>, greater<LL>> Q;
  for (auto e : {1, 2, 3, 4, 5, 6, 7, 8, 9}) {
    Q.push(e);
  }
  LL top;
  while (k--) {
    top = Q.top();
    DBG(top);
    Q.pop();
    LL last_digit = top % 10;
    Q.push(10 * top + last_digit);
    if (last_digit != 9) {
      Q.push(10 * top + last_digit + 1);
    }
    if (last_digit != 0) {
      Q.push(10 * top + last_digit - 1);
    }
  }
  cout << top << '\n';
  return 0;
}


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

typedef long long ll;
typedef long double ld;

typedef pair<int, int> p;

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

    int N;
    cin >> N;

    vector<bool> x(pow(10, 5));

    int c = 0;

    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;
        a--;
        if(x[a]) c++;
        else x[a] = true;
    }

    if(c % 2) c++;

    cout << N - c << endl;
}

Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     setbits(x)  __builtin_popcountll(x)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    string s;
    cin>>s;
    cout<<((s[2]==s[3] and s[4]==s[5])?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;



int main(){
    int x,y; cin>>x>>y;
    cout<<(x-1)*(y-1) << endl;


return 0;
}

Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(m)]
P = [int(i) for i in input().split()]

ans = 0

for bits in range(2 ** n):
    ok = True
    for i, k in enumerate(K):
        ok = ok and sum((bits >> (s - 1)) & 1 for s in k[1:]) % 2 == P[i]
    if ok:
        ans += 1

print(ans)

Measured memory_bytes: 43484
#include<iostream>
#include<vector>
#include<numeric>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iterator>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  rep(i, n) a.at(i) = l + i;
  if(l >= 0) a.erase(a.begin());
  if(l < 0){
    if(n <= abs(l)) a.pop_back();
  }
  long long ans = accumulate(a.begin(), a.end(), 0);
  cout << ans << endl;
}

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

int main(){
   int N;
   std::cin >> N;
   std::map<std::string, int> S;
   for (std::size_t i=0; i<N; i++){
      std::string key;
      std::cin >> key;
      S[key]++;
   }
   std::cout << S.size() << std::endl;
}



Measured memory_bytes: 19120
#include<stdio.h>

int main(){
  char m[4];
  scanf("%s",m);
  if(m[0] == '7')
  printf("Yes\n");
  else if(m[1] == '7')
  printf("Yes\n");
  else if(m[2] == '7')
  printf("Yes\n");
  else
  printf("No\n");
  return 0;
}


Measured memory_bytes: 1628
#include<stdio.h>
int main(void){
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if((a + c - 1)/ c <= b){
    printf("%s\n", "Yes");
  }else{
    printf("%s\n", "No");
  }
  return 0;
}

Measured memory_bytes: 1664
use proconio::input;

fn main() {

/*
    0 1 2 3 4 5 6 7 8

    3 4(0+1+3) 5(0+1+4) 6(1+2+3) 7(0+2+5) ...  20(5+6+7)    21

    21-3+1 = 19


    k - n 


    6 7 8
        n

    n+1-i(3)=6
*/

    input! {
        (n, k): (u64, u64)
    };

    let mut sum = 0;
    for i in k..=n+1 {
        sum += (n + (n+1-i)) * i / 2 - (0 + (i-1)) * i / 2 + 1;
        sum %= 1000000007;
    }

    println!("{}", sum);
}


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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10; 

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

    string s; cin >> s;
    string dir = "SNEW";
    vector<bool> present(4);

    for (int i = 0; i < 4; ++i)
        present[i] = s.find( dir[i] ) != s.npos;

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

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {

//変数の宣言

	double a,b,c,d,e,f;
	double x,y;	

	while(cin >>a>>b>>c>>d>>e>>f){
	
		if (a==0){
			y = c / b;
			x = (f - (e*c/b)) / d;
		}else if(b==0){
			x = c / a;
			y = (f - (d*c/a)) / e;
		}else if(d==0){
			y = f / e;
			x = (c - (b*f/e)) / a;
		}else if(e==0){
			x = f / d;
			y = (c - (a*f/d)) / b;
		}else{
			x = (f - (e*c/b)) / (d - (e*a/b));
			y = (f - (d*c/a)) / (e - (d*b/a));
		}
		if (x==-0) x=0;
		if (y==-0) y=0;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
int n,m;
signed main()
{
	scanf("%d%d",&n,&m);
	((!(n%m))?(putchar('-'),putchar(49)):(printf("%d",n)));
	return putchar(10),0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

n=int(input())
s=input()
k=int(input())
'''
#a,b=map(int,input().split())
a=[int(i) in range(n)]
a=[0]*n
for i in range(n):
    a.append(int(i))
'''

t=s[k-1]
ans=''
for i in range(n):
    if s[i]==t:
        ans+=t
    else:
        ans+='*'
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second

const int maxn = 200010;

int n;
int A[maxn];

int32_t main() {
	cin >> n;
	for (int i =0;i<n;i++) {
		cin >> A[i];
	}
	
	int curh = 0;
	int rans = 0;
	
	for (int i =0;i<n;i++) {
		if (A[i] < curh) rans += (curh - A[i]);
		curh = max(curh,A[i]);
	}
	
	cout << rans;
}


Measured memory_bytes: 5100