akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ld			long double
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define sd(t) 		scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii 		cout << "hii" << endl
#define okay 		cout << "okay" << endl
#define hey 		cout << "hey" << endl

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
}

clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

const int N = 2e5+5;
int vis[N] = {0};
vector<int> adj[N];
// int dp[N] = {0};

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

	int dp[n][m];
	char arr[n][m];

	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >> arr[i][j];
		}
	}

	dp[0][0] = 1;
	for(int i=1; i<n; i++){
		if(dp[i-1][0] and arr[i][0]=='.'){
			dp[i][0] = 1;
		}
		else dp[i][0] = 0;
	}

	for(int i=1; i<m; i++){	
		if(dp[0][i-1] and arr[0][i]=='.'){
			dp[0][i] = 1;
		}
		else dp[0][i] = 0;

	}

	for(int i=1; i<n; i++){
		for(int j=1; j<m; j++){
			if(arr[i][j]=='#'){
				dp[i][j] = 0;
			}
			else{ 
				dp[i][j] = (dp[i-1][j] +  dp[i][j-1])%MOD;
			}
		}
	}

	cout << dp[n-1][m-1] << endl;
}			 	

int32_t main(){
	fast();
    int t = 1;
    // cin>> t;
    while(t--){
    	solve();
    }
	starboy1299();
}




Measured memory_bytes: 15232
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define getcx getchar_unlocked
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 100005
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';


int parent[2*MAX], hashi[2*MAX];
int find(int u) {
	if(u == parent[u])return u;
	return parent[u] = find(parent[u]);
}

void _union(int u, int v) {
	parent[find(u)] = find(v);
}

int main() {

	int n, m, a, b, i, mx = -1;
	cin>>n>>m;

	for(i = 1 ; i <= n; i++) {
		parent[i] = i;
	}

	for(i = 0 ; i < m; i++) {
		cin>>a>>b;
		_union(a,b);
	}

	for(i = 1; i <=n; i++) {
		int pu = find(i);
		hashi[pu]++;		
		mx = max(mx, hashi[pu]);
	}

	cout<<mx<<endl;
	return 0;

}

Measured memory_bytes: 10456
#include<iostream>
#include<string>
using namespace std;
int main(){
 string n;cin>>n;
  int a=0,b=0;
  for(int i=0;i<n.length();i++){
    if(n[i]=='o')a++;
    else b++;
    }
  if(b>7)cout<<"NO";
  else cout<<"YES";
}

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

int main(){
	
	int n;
	cin >> n;
	if(n < 1200){
		cout << "ABC\n";
	}else if(n < 2800){
		cout << "ARC\n";
	}else{
		cout << "AGC\n";
	}

	return 0;
}

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

struct UnionFind {
    static constexpr int M = 1 << 30;
    UnionFind(int n) : p(n, -1) {}
    int root(int u) {
        if (p[u] < 0) return u;
        int v = p[u] & ~M, m = p[u] & M;
        return p[u] = root(v) ^ m;
    }
    bool same(int u, int v) {
        return ((root(u) ^ root(v)) & ~M) == 0;
    }
    void unite(int u, int v) {
        u = root(u);
        v = root(v);
        if (((u ^ v) & ~M) == 0) {
            if (u == v) p[u & ~M] &= ~2;
            return;
        }
        int m = (u & M) ^ (v & M) ^ M;
        u &= ~M; v &= ~M;
        p[v] &= p[u] & ~1;
        p[u] = v ^ m;
    }
    vector<int> p; // rootでbit0は子がいないこと、bit1は二部グラフであることを表す
};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--; v--;
        uf.unite(u, v);
    }

    int64_t k[3] = {};
    for (int i = 0; i < n; i++) {
        if (uf.p[i] < 0) k[(~uf.p[i] & 1) + (~uf.p[i] >> 1 & 1)]++;
    }

    k[2] += k[1];
    int64_t r = k[0] * (n * 2 - k[0]) + k[2] * k[2] + k[1] * k[1];

    cout << r << endl;

    return 0;
}


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

int N;
vector<int> p, q;

void input()
{
    cin >> N;
    p.reserve(N);
    q.reserve(N);
    for (int i = 0; i < N; i++) {
        int pi;
        cin >> pi;
        p.push_back(--pi);
    }

    for (int i = 0; i < N; i++) {
        int qi;
        cin >> qi;
        q.push_back(--qi);
    }
}

int main()
{
    input();

    // 各順列が何番目か
    map<vector<int>, int> ord;
    int iter = 0;

    // スタートとなる配列
    vector<int> v(N);
    for (int i = 0; i < N; i++) {
        v[i] = i;
    }

    do {
        ord[v] = iter++;

    } while (next_permutation(v.begin(), v.end()));

    cout << abs(ord[p] - ord[q]) << endl;

    return 0;
}

Measured memory_bytes: 5248
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int k = sc.nextInt();
    
    boolean[] list = new boolean[n];
    
    int ans = n;
     
	for (int i = 0; i < k; i++){
      int d = sc.nextInt();
      for (int j = 0; j < d; j++){
        int a = sc.nextInt();
        if(!(list[a-1])){
          list[a-1] = true;
          ans--;
        }
      }
    }
    
    System.out.println(ans);
  }
}

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

int main(){
    int N;cin>>N;
    vector<int> a(N),b(N);
    for(int i=0;i<N;i++)cin>>a.at(i);
    for(int i=0;i<N;i++)cin>>b.at(i);
    
    long S=0;
    int count=0;
    vector<int> dif;
    for(int i=0;i<N;i++){
        if(a.at(i)<b.at(i)){
            S+=b.at(i)-a.at(i);
            count++;
        }
        else dif.push_back(a.at(i)-b.at(i));
    }
    int ans=0;
    if(S==0){
        ans=0;
    }
    else{
        sort(dif.begin(),dif.end(),greater<int>());
        for(int i=0;i<dif.size();i++){
            S-=dif.at(i);
            if(S<0){
                ans+=i+1;
                break;
            }
        }
        if(S>0)ans=-1;
        else ans+=count;
    }
    
    cout<<ans<<endl;

    return 0;
}

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

int main(){
  
  int N,M;
  cin >> N >> M;
  int bk[M+2];
  bk[0]=-1;
  for(int i=0;i<M;i++){
    cin >> bk[i+1];
  }
  bk[M+1]=N+1;
  
  long fb[N+2];
  fb[0]=0;
  fb[1]=1;
  for(int i=2;i<N+2;i++){
    fb[i]=fb[i-1]+fb[i-2];
    if (fb[i] >= 1000000007){
      fb[i] -= 1000000007;
    }
  }
  
  long long total=1;
  for(int i=0;i<M+1;i++){
    total *= fb[bk[i+1]-bk[i]-1];
    total %= 1000000007;
    if (!total) break;
  }
  
  cout << total << endl;
  
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    REP(i, N) cin >> x[i] >> y[i];

    double ans = 0;
    for (int i=0; i<N-1; i++) {
        for (int j=i+1; j<N; j++) {
            double a = abs(x[i] - x[j]);
            double b = abs(y[i] - y[j]);
            double distance = sqrt(a*a + b*b);
            ans += distance * (2.0/N);
        }
    }
    cout << fixed << setprecision(10) << ans << endl;
}

int main()
{
    solve();

    return 0;
}


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

int main(){
  int N, L;
  cin >> N >> L;
  string S[N];
  for(int i = 0; i < N; i++){
    cin >> S[i];
  }
  sort(S, S + N);
  string ans;
  for(int i = 0; i < N; i++){
    ans += S[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		String[] sa = new String[n];
		boolean flag = true;
		
		sa[0] = sc.next();
		for (int i = 1; i < n; i++) {
			sa[i] = sc.next();
			int j = sa[i-1].length() - 1;
			if (!(sa[i].charAt(0) == sa[i-1].charAt(j)))
				flag = false;
		}
		
		for (int i = 0; i < n - 1; i++) {
			for (int j = i+1; j < n; j++) {
				if ((sa[i].equals(sa[j])))
					flag = false;
			}
		}
		
		System.out.println(flag == true ? "Yes" : "No");
	}
}

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

using namespace std;

const int mod = 1e9 + 7, P = 1e9 + 7;
int n;
pair <int, int> a[323456];
int dp[3036][7035];
int t;
//int x[10], y[10], p[10];

bool cmp(pair <int, int> a, pair <int, int> b) {
	if(a.first == b.first)
	return a.second > b.second;
	return a.first < b.first;
}
 
int main() {

	cin >> n >> t;
	int mex = 0;
	for(int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second, mex = max(mex, a[i].second);

	sort(a + 1, a + n + 1, cmp);

	memset(dp, -1, sizeof(dp));
	dp[0][0] = 0;
	for(int i = 1; i <= n; i++){
		for(int s = 0; s <= t + mex + 6; s++){
			dp[i][s] = dp[i - 1][s];
		}
		for(int s = 0; s < t ; s++){
			if(dp[i - 1][s] != -1){
				if((i == n && s < t) or s < t)
				if(dp[i][s + a[i].first] == -1 || dp[i][s + a[i].first] < dp[i - 1][s] + a[i].second){
		    		dp[i][s + a[i].first] = dp[i - 1][s] + a[i].second;
		    	}

			}
		}
	}
	int ans = 0;
	for(int i = 0; i <= t + mex + 6; i++){
		if(dp[n][i] != -1){
		    ans = max(dp[n][i],ans);
		    //cout << i<<' ';
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 84224
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, k;std::cin >> n >> k;
  vll a(n);re(i, n) scanf("%lld", &a[i]);
  // 不可/可能
  ll l = 0, r = 1000000001;
  while(r-l>1){
    ll mid = (l+r)/2;
    ll cnt = 0;
    for(int i=0;i<n;i++) cnt += (a[i]/mid + (a[i]%mid?1:0)) - 1;
    if(cnt<=k) r = mid;
    else l = mid;
  }
  std::cout << r << '\n';
  return 0;
}


Measured memory_bytes: 4396
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
main() {
    int res = 0, last = 0;
    string s, t;
    vector<int> m[30];
    cin >> s >> t;
    rep(i, s.size()) {
        m[s[i] - 'a'].push_back(i + 1);
    }
    for(auto c: t) {
        int j = c - 'a';
        if(!m[j].size()) {
            cout << -1;
            return 0;
        }
        if(m[j][m[j].size() - 1] <= last) res++, last = 0;
        last = *upper_bound(all(m[j]), last);
    }
    cout << res * s.size() + last;
}


Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
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> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> b(n);
    for (int i = 0; i < n - 1; i++) {
        cin >> b[i];
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll s = INF;
        if (i > 0) {
            s = b[i - 1];
        }
        if (i < n - 1) {
            chmin(s, b[i]);
        }
        ans += s;
    }
    cout << ans << endl;
}


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

using namespace std;

int main()
{
    string s,t;

 cin>>s;
 cin>>t;
int p=0;
for(int i=0;i<s.size();i++)
{
    if(s[i]!=t[i]){p=1;}
}
if(p==1){cout<<"No";}
else
    cout<<"Yes";

    return 0;
}


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

int i,j,k,l,m;
ll mod=1000000007;

int main(){    
    int s,w;cin>>s>>w;
    if(s<=w){cout<<"unsafe"<<endl;}
    else{cout<<"safe"<<endl;}
    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
using ull = unsigned long long;

int main(){
    unsigned N;
    scanf("%u", &N);
    unsigned A[N];
    for(unsigned i = 0; i < N; ++i){
        scanf("%u", A + i);
    }
    unsigned day = 0;
    ull money = 1000, stock = 0;
    while(day < N){
        while(day+1 < N && A[day+1] <= A[day]) day++;
        if(day+1 == N) break;
        stock = money/A[day];
        money = money%A[day];
        while(day+1 < N && A[day+1] >= A[day]) day++;
        money += A[day]*stock;
    }
    printf("%llu\n", money);
	return 0;
}

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

int main() {
  using vi = vector<int>;
  using vs = vector<string>;
  using vvi = vector<vi>;
  using vvs = vector<vs>;
  using pii = pair<int, int>;
  using vpii = vector<pii>;
  
  long long K, S, cnt = 0;
  cin >> K >> S;

  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      if (i + j + K < S) continue;
      else if (i + j > S) break;
      else cnt++;
    }
  }

  printf("%lld\n", cnt);
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int SUM(int n){
  int sum=0;
  while(n>0){
    sum+=n%10;
    n/=10;
  }
  return sum;
}
  
int main(){
  int a,b,n;
  int x=0;
  int sum=0;
  cin>>n>>a>>b;
for(int i=1;i<=n;i++){
  sum=SUM(i);
  if(sum>=a&&sum<=b){
    x+=i;
  }
}
  cout<<x<<endl;
}

    


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main() {
	int n, x, L[100],d,ans;
	ans = n = d = x = 0;
	//L[100] = { 0 };
	cin >> n >> x;
	for (int i = 0; i < n; ++i) {
		cin >> L[i];
	}
	for (int i = 0; (i < n + 1 && d <= x); ++i) {
		d = d + L[i];
		++ans;

		
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> //fixed << setprecision(10)

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;

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

int main(){
	ll a, b;
    cin >> a >> b;

    cout << a*b/gcd(a, b) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
    
    int H[300] = {};
    int W[300] = {};
    int i, j, k, l;
    
    for(i = 0; i < 300; i++) {
        scanf("%d %d", &H[i], &W[i]);
        if(H[i] == 0 && W[i] == 0) {
            break;
        }
    }
    
    for(j = 0; j < i; j++) {
        for(k = 1; k <= H[j]; k++) {
            for(l = 1; l <= W[j]; l++) {
                if(k == 1 || k == H[j] || l == 1 || l == W[j]) {
                    printf("#");
                }
                else {
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2108
/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-2-11 15:33:02
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  ll X, Y;
  cin >> X >> Y;
  vector<ll> V;
  V.push_back(X);
  ll now = X;
  while (true)
  {
    now *= 2;
    if (now <= Y)
    {
      V.push_back(now);
    }
    else
    {
      break;
    }
  }
  cout << V.size() << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main()
{
   long int n,k,max=0,count=0,i,j,min=9999;
   char a[101][101];
   scanf("%ld%ld\n",&n,&k);
   for(i=0;i<n;i++)
   {
      gets(a[i]);
   }
   for(i=0;i<k+2;i++)
   {
       printf("#");
   }
   printf("\n");
   for(i=0;i<n;i++)
   {
      printf("#%s#\n",a[i]);
   }
    for(i=0;i<k+2;i++)
   {
       printf("#");
   }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

vector<vector<int>> G;
vector<int> vis;
vector<int> ts;

bool loop = false;
void dfs(int cur) {
    if(vis[cur] == 1) {
        loop = true;
        return;
    }
    else if(vis[cur] == 0){
        vis[cur] = 1;
        for(int v: G[cur]) {
            dfs(v);
        }
        vis[cur] = 2;
        ts.pb(cur);
    }
}

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, M;
    cin >> N >> M;
    string s;
    cin >> s;
    G.resize(2 * N);
    
    // AABB
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if(s[a] == 'A' && s[b] == 'A') {
            G[a].pb(b + N);
            if(a != b) G[b].pb(a + N);
        }
        if(s[a] == 'A' && s[b]  == 'B') {
            G[a + N].pb(b);
            G[b + N].pb(a);
        }
        if(s[a] == 'B' && s[b] == 'A') {
            G[a + N].pb(b);
            G[b + N].pb(a);
        }
        if(s[a] == 'B' && s[b] == 'B') {
            G[a].pb(b + N);
            if(a != b) G[b].pb(a + N);
        }
    }
    
    vis.assign(2 * N, 0);
    
    rep(i, 2 * N) {
        if(vis[i] == 0) {
            dfs(i);
        }
    }
    reverse(all(ts));
    
    if(loop) {
        output("Yes");
    }
    else {
        output("No");
    }
    
    return 0;
}


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

int main (){
    int det[5];
    std::cin >> det[0] >> det[1] >> det[2] >> det[3] >> det[4];
    int min=10;
    int time=0;
    for (int i = 0; i < 5; i++){
        if(det[i]%10<min && det[i]%10!=0) min=det[i]%10;
        if(det[i]%10>0) det[i]+=10-(det[i]%10);
        time+=det[i];
    }    
    if(min!=10) time += min-10;
    printf("%d",time);
}

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

# 必要条件まではわかったけど、必ず任意の木を構築できる
# という考えには至らず。
# https://betrue12.hateblo.jp/entry/2018/09/30/125042
# の図とC++コードを参考にする
#
# まず1文字目は必ず1。最初は以下のようなエッジを構築。
#                 2(top)
#                /
#               1
# "top"は、つぎの頂点がつながる先を表す。
#
# 2文字目が0の場合:  topは移動しない
#                 2(top)
#                / \
#               1   3
# 2文字目が1の場合:  topは移動する
#                   3(top)
#                  /
#                 2
#                /
#               1


import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

def solve(S):
    # 必要条件の確認
    if S[-1] == '1':
        return -1
    if S[0] == '0':
        return -1
    size = len(S)
    i = 0
    j = size - 2
    while i < j:
        if S[i] != S[j]:
            return -1
        i += 1
        j -= 1

    # ここまで来た場合は必ず木を構築可能
    edges = []
    top = 0
    for i in range(size - 1):
        edges.append((top, i + 1))
        if S[i] == '1': 
            top = i + 1
    return edges

S = input()
ans = solve(S)
if ans == -1:
    print(ans)
else:
    for e in ans:
        print("{} {}".format(e[0] + 1, e[1] + 1))



Measured memory_bytes: 20464
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int H, W;
	cin >> H >> W;
	vector<char> tb(W+2, '#');
	vector<string> A(H);
	for (int i = 0; i < H; i++)
	{
		cin >> A[i];
	}
	for (int i = 0; i < W+2; i++)
		cout << tb[i];
	cout << endl;
	for (int i = 0; i < H; i++)
	{
		cout << "#" << A[i] << "#" << endl;
	}
	for (int i = 0; i < W+2; i++)
		cout << tb[i];
	cout << endl;
}



Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int a, b;
    cin >> a >> b;
    if(a > b)
    {
        cout << a-1 << endl;
    }
    else
    {
        cout << a << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Lucky7 | diff Lucky7.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Lucky7.cpp && ./a.out

/*
 
 4/12/2020
 
 5:00-
 
 */

string N;

void solve() {
  REP(i,SZ(N))if(N[i]=='7') {
    cout<<"Yes"<<endl;
    return;
  }
  cout<<"No"<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  solve();
  
  return 0;
}


Measured memory_bytes: 3656
# -*- coding: utf-8 -*-
A,B = input().split()
A = int(A)
B_i, B_d = B.split('.')
B_i = int(B_i)
# calc b_d
B_d = list(B_d)
B_100 = 100*B_i + int(B_d[0])*10 + int(B_d[1])

result_100 = A * B_100

if result_100 >= 100:
    print(str(result_100)[:-2])
else:
    print(0)

Measured memory_bytes: 9196
N, K = gets.chomp.split(" ").map(&:to_i)
ans = Array.new(N+1, 0)
K.times{
  gets.to_i
  gets.chomp.split(" ").map(&:to_i).each{|a|
    ans[a] += 1
  }
}

ans.shift
puts ans.count(0)


Measured memory_bytes: 14392
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
string s;
  string a[19];
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]==','){
      s[i]=' ';
    }
  }
  cout<<s<<endl;
  

  return 0;
}







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

const int mxN = 2e5 + 5;
double prefix[mxN];

int main() {
	int n, k;
	cin >> n >> k;
	double answer = -1;
	for(int i = 1; i <= n; ++i) {
		double x;
		cin >> x;
		x = (1 + x) / 2;
		prefix[i] = prefix[i - 1] + x;
		if(i >= k)
			answer = max(answer, prefix[i] - prefix[i - k]);
	}
	cout << fixed << setprecision(7) << answer;
}


Measured memory_bytes: 5320
S = input()
na = S.count("a")
nb = S.count("b")
nc = S.count("c")

n_kind = len(set(S))
nall = na+nb+nc
mx = max(na,nb,nc)
mn = min(na,nb,nc)
rest = nall - mx

if n_kind == 1:
    if len(S) == 1:
        print("YES")
        exit()
    else:
        print("NO")
        exit()
if n_kind == 2 and len(S) == 2:
    print("YES")
    exit()
if n_kind == 2 and len(S) > 2:
    print("NO")
    exit()
if n_kind == 3:
    if mx - mn >= 2:
        print("NO")
    else:
        print("YES")


Measured memory_bytes: 3188
N,X = map(int,input().split())

PforL = [1]
HforL = [1]
for i in range(1,51):
    PforL.append(PforL[i-1]*2+1)
    HforL.append(HforL[i-1]*2+3)

ans = 0
while 0<X:
    if(X<((HforL[N]-3)/2)+1):
        X -= 1
        N -= 1
        continue
    if(X==((HforL[N]-3)/2+1)):
        ans+=PforL[N-1]
        break
    if(X==((HforL[N]-3)/2+2)):
        ans+=PforL[N-1]+1
        break
    if(X<HforL[N]-1):
        ans += PforL[N-1]+1
        X -= 2+HforL[N-1]
        N -= 1
        continue
    if(X<=HforL[N]):
        ans += PforL[N]
        break
print(ans)


Measured memory_bytes: 3064
import sys

s = [ord(a)-97 for a in list(sys.stdin.readline().rstrip())]
t = [ord(b)-97 for b in list(sys.stdin.readline().rstrip())]
len_s = len(s)
len_t = len(t)

dp = [[0] * (len_t+1) for i in range(len_s+1)]
for i in range(len_s):
    for j in range(len_t):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

strings = []
while len_s > 0 and len_t > 0:
    if s[len_s-1] == t[len_t-1]:
        len_s -= 1
        len_t -= 1
        strings.insert(0,chr(s[len_s]+97))
    elif dp[len_s][len_t-1] > dp[len_s-1][len_t]:
        len_t -= 1
    else:
        len_s -= 1

print("".join(strings))


Measured memory_bytes: 113116
#include <iostream>
#include <vector>
#include <cmath>

#define llint long long int

int main(void){

  int n;
  std::cin >> n;

  llint count = 0;
  std::vector<llint> a(n+1), b(n);
  for(int i=0; i<n+1; i++){
    std::cin >> a[i];
  }
  for(int j=0; j<n; j++){
    std::cin >> b[j];
  }

  for(int j=0; j<n; j++){
    llint minval = std::min(a[j], b[j]);
    a[j]-=minval;
    b[j]-=minval;
    count+=minval;

    minval = std::min(a[j+1], b[j]);
    a[j+1] -= minval;
    b[j] -= minval;
    count += minval;
  }

  std::cout << count << std::endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<int, int>P;

int n, m, x[100010];
P xsa[100010];
vector<int> cutindexbefore;
vector<int> cutindex;

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> x[i];
	}
	if (m <= n) {
		cout << 0 << endl;
		return 0;
	}
	sort(x, x + m);

	for (int i = 0; i < m - 1; i++) {
		xsa[i] = P(abs(x[i] - x[i + 1]), i);
	}
	sort(xsa, xsa + m - 1, greater<P>());
	cutindex.push_back(0);
	for (int i = 0; i < n - 1; i++) {
		cutindex.push_back(xsa[i].second);
	}
	cutindex.push_back(m - 1);
	long long ans = 0;
	for (int i = 0; i < cutindex.size() - 1; i++) {
		ans += x[cutindex[i + 1]] - x[cutindex[i]];
		cutindex[i + 1] += 1;
	}

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

Measured memory_bytes: 2044
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//      debug shrine
//
// #######################
//     ##           ##
//   ###################
//     ##           ##
//     ##           ##
//     ##           ##
//     ##           ##
//     ##           ##

int main(int argc, char *argv[]) {
	ll N, Q;
	cin >> N >> Q;
	string s;
	cin >> s;
	vector<char> t(Q), d(Q);
	for (int i = 0; i < Q; i++)cin >> t[i] >> d[i];

	//左に落ちるゴーレムの右端
	int posL_r = N - 1, posL_l = 0;
	for (int i = 0; i < 100; i++) {
		int tmp = posL_l + (posL_r - posL_l) / 2;
		for (int j = 0; j < Q; j++) {
			if (tmp < 0 || tmp >= N)break;
			if (s[tmp] == t[j]) {
				if (d[j] == 'R')tmp++;
				else tmp--;
			}
		}
		if (tmp < 0) {
			posL_l = posL_l + (posL_r - posL_l) / 2 + 1;
		}
		else {
			posL_r = posL_l + (posL_r - posL_l) / 2 - 1;
		}
	}

	//右
	int posR_r = N - 1, posR_l = 0;
	for (int i = 0; i < 100; i++) {
		int tmp = posR_l + (posR_r - posR_l) / 2;
		for (int j = 0; j < Q; j++) {
			if (tmp < 0 || tmp >= N)break;
			if (s[tmp] == t[j]) {
				if (d[j] == 'R')tmp++;
				else tmp--;
			}
		}
		if (tmp >= N) {
			posR_r = posR_l + (posR_r - posR_l) / 2 - 1;
		}
		else {
			posR_l = posR_l + (posR_r - posR_l) / 2 + 1;
		}
	}

	cout << posR_r - posL_l + 1 << endl;
	return 0;
}

Measured memory_bytes: 900
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int k, x; cin >> k >> x;

    for(int i=x-(k-1); i<x+k; i++){
        cout << i << " ";
    }
    cout << ln;
}
    


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define M ((ll)(1e9)+7)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
void solve()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) a[i]=i+1;
    int b[n],c[n];
    for(int i=0;i<n;i++) cin>>b[i];
    for(int i=0;i<n;i++) cin>>c[i];
    ll co=1,c1=1;
    do{
        int i;
        for(i=0;i<n;i++)
        {
            if(a[i]!=b[i])
            break;
        }
        if(i!=n)
        co++;
        else
        break;
    }while(next_permutation(a,a+n));
    for(int i=0;i<n;i++) a[i]=i+1;
    do{
        int i;
        for(i=0;i<n;i++)
        {
            if(a[i]!=c[i])
            break;
        }
        if(i!=n)
        c1++;
        else
        break;
    }while(next_permutation(a,a+n));
    cout<<abs(co-c1)<<endl;
}
int main()
{
    solve();
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>

#define max 50

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    int n, p[max], i, cnt=0, q[max];
    
    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%d", &p[i]);
        q[i]=i+1;
        if (p[i]!=q[i]) {
            cnt++;
        }
    }
    
    if (cnt<=2) {
        printf("YES");
    } else {
        printf("NO");
    }
    
    return 0;
}



Measured memory_bytes: 128
from collections import Counter
from itertools import accumulate

N, M = map(int, input().split())
A = map(int, input().split())
acc = [0] 
acc.extend(accumulate(A))
acc = Counter(a % M for a in acc)
ans = sum(c * (c - 1) // 2 for c in acc.values())
print(ans)

Measured memory_bytes: 15404
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;
    cin >> n;
    int l[n],r[n];
    for(int i=0;i<n;i++){
        cin >> l[i] >>r[i];

    }
    sort(l,l+n,greater<int>());
    sort(r,r+n);
    int ans=0;
    int ansmax=0;
    for(int i=0;i<n;i++){
        if(ansmax<ans+2*l[i])ansmax=ans+2*l[i];
        if(ansmax<ans-2*r[i])ansmax=ans-2*r[i];
        ans+=2*l[i]-2*r[i];
          if(ansmax<ans)ansmax=ans;
         
        
            
        
    }
    cout << ansmax;
    return 0;
}

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

public class Main {
	private static int prime(int a){
		if(a==2||a==3)return 1;
		for(int i=2;i<Math.sqrt(a)+1;i++){
			if(a%i==0){
				return 0;
			}
		}
		return 1;
	}
	
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            int n=0,j=0,store=0;
            boolean first=true;
            while ((line = br.readLine()) != null) {
            	if(first){
            		n=Integer.parseInt(line);
            		first=false;
            	}else{
            		store+=prime(Integer.parseInt(line));
            		j++;
            		if(j==n){
            			break;
            		}
            	}           	
            }
            System.out.println(store);
        }
	}

}

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

int main() {
    
    double n,ans=0;
    double k;
    cin>>n>>k;

    if(n>k-1)ans+=(n-(k-1));
    
//    if(k=1)int x = 1;
//    else int x = log(2)/log(k) + 1;
    
    for(double i=1;i<=min(k-1,n);++i){
        double tmp = i;
        double tmp2 = 2;
        while(tmp<k){
            if(tmp*tmp2>=k){
                ans+=(1/tmp2);
                break;
            }
            else tmp2 *=2;
        }
//    cout<<setprecision(12)<<ans/n<<endl;
    }

    cout<<setprecision(20)<<ans/n<<endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
edges = []
node = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  edges += (a-1, b-1),
  node[a-1] += b-1,
  node[b-1] += a-1,

stuck = [(0,0)]
f = [1]+[0]*N
color_dic = dict()
while stuck:
  v, color = stuck.pop()
  i = 0
  for w in node[v]:
    if f[w]:
      continue
    f[w] = 1
    i += 1
    if i == color:
      i += 1
    stuck += (w,i),
    color_dic[v,w] = i

ans = []
for a,b in edges:
  if (a,b) in color_dic:
    ans += color_dic[a,b],
  else:
    ans += color_dic[b,a],

print(max(ans))
for i in ans:
  print(i)

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

int main() {
	int n;
	cin >> n;
	int s = 0;
	int tmp = n;
	while(tmp) {
		s += tmp%10;
		tmp /= 10;
	}
	if(n%s == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,s1,s2,max;
  char mise='A',maxc;
  
  while(1){
    max=-1;
    for(i=0;i<5;i++){
    scanf("%d %d",&s1,&s2);
    if(s1==0 && s2==0) break;
    if(max<(s1+s2)){
      max=s1+s2;
      maxc=i+mise;
    }
  }
  if(i==0 && s1==0 && s2 ==0) break;
  printf("%c %d\n",maxc,max);
  }

  return 0;
}

Measured memory_bytes: 600
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author RiaD
 */

#include <iostream>
#include <fstream>

#include <iostream>

using namespace std;

class TaskB {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n;
		in >> n;
		for (int64_t i = 1;;++i) {
			if (i * (i + 1) /2 >= n) {
				while (n >= i && i > 0) {
					out << i << "\n";
					n -= i;
					--i;
				}
				if (n) {
					out << n << "\n";
				}
				return;
			}
		}
	}
};


int main() {
	std::ios_base::sync_with_stdio(false);
	TaskB solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
	out << std::fixed;
	out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct node
{
    int x,id;
}a[100005];
bool cmp(node p1,node p2)
{
    return p1.x<p2.x;
}
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i].x),a[i].id=i;
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
    {
        int t=abs(i-a[i].id);
        ans+=t%2;
    }
    cout<<ans/2+ans%2<<endl;
}


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

using namespace std;

#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)

const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

#define CMAX 1010
int noinit = 1;
llong memo[CMAX][CMAX];
template<typename T> T combination_memo(T a, T b) {
    if (noinit) {
        for (int i = 0; i < CMAX; ++i) {
            for (int j = 0; j < CMAX; ++j) {
                memo[i][j] = -1;
            }
        }
        noinit = 0;
    }

    if (b == 0 || a == b) return 1;
    if (0 <= memo[a][b]) return memo[a][b];

    return memo[a][b] = combination_memo(a - 1, b - 1) + combination_memo(a - 1, b);
}

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

    int n, p, a, even = 0, odd = 0;
    cin >> n >> p;
    rep(i, n) {
        cin >> a;
        if (a % 2) ++odd;
        else ++even;
    }

    llong ans = 0;
    rep(i, odd + 1) {
        if (p) {
            if (i % 2) ans += combination_memo(odd, i);
        } else {
            if (!(i % 2)) ans += combination_memo(odd, i);
        }
    }
    ans *= pow(2, even);

    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0);

int n;

int main() {

	FAST;

	cin >> n;
	vector <int> a(n + 1);
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	}
	map <int, int> cnt;
	intt ans = 0;
	for (int i = 1; i <= n; i ++) {
		ans += cnt[i - a[i]];
		cnt[i + a[i]] ++;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 21120
#include<iostream>
#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#define _ cin.tie(0);ios::sync_with_stdio(false);
using namespace std;
int main()
{
string a, t;
    while(cin >> a >> t)
    {
        reverse(a.begin(), a.end());
        if(a == t)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e6 + 7;
int lst[Max][2], ls[Max][2];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", &lst[i][0],&lst[i][1]);
	}
	for (int i = 1; i <= m; i++)
	{
		scanf("%d%d", &ls[i][0], &ls[i][1]);
	}
	for (int i = 1; i <= n; i++)
	{
		int res = 1e9,d;
		for (int j = 1; j <= m; j++)
		{
			if (abs(lst[i][0] - ls[j][0]) + abs(lst[i][1] - ls[j][1]) < res)
			{
				res = abs(lst[i][0] - ls[j][0]) + abs(lst[i][1] - ls[j][1]);
				d = j;
			}
		}
		cout << d << endl;
	}
}

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

using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int count = 1;
    for(int i = 0; i < N - 1; i++) {
        if(S.at(i) != S.at(i + 1)) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 512
import math
n, d = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        tmp = 0
        for k in range(d):
            tmp += (x[i][k]-x[j][k])**2 
        tmp = math.sqrt(tmp)
        if tmp.is_integer():
            cnt+=1

print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int n;double p[3100];double dp[3100][3100];
signed main() {
  cin>>n;repd(i,1,n+1)cin>>p[i];
	rep(i,3100)rep(j,3100)dp[i][j] = 0;
	dp[0][0] = 1;
	repd(i,1,n+1)rep(j,n+1){
		if(!j)dp[i][j] = dp[i-1][j]*(1-p[i]);
		else dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
	}
	double ans = 0;
	for(int i=0;(n-i)>i;i++)ans += dp[n][n-i];
	cout << std::setprecision(10) <<ans << endl;
}



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

int main() {
  int n; cin >> n;
  vector<long long> nums(n);
  for (int i = 0; i < n; i++) cin >> nums.at(i);
  
  vector<long long> sorted = nums;
  sort(sorted.begin(), sorted.end());
  
  long long low = sorted.at(n / 2 - 1);
  long long up = sorted.at(n / 2);
  
  for (int i = 0; i < n; i++) {
    if (nums.at(i) <= low) cout << up << endl;
    else cout << low << endl;
  }
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    vector<int> res;
    string s;cin >> s;
    rep(i,n){
        if(s[i] == 'R')res.push_back(0);
        else if(s[i] == 'G')res.push_back(1);
        else res.push_back(2);
    }
    vector<int> cnt(3);
    rep(i,n)cnt[res[i]]++;
    int ret = cnt[0]*cnt[1]*cnt[2];
    auto diff = [](int a,int b,int c){
        return a != b && b != c && c != a;
    };
    rep(j,n)rep(i,j){
        int k = 2*j -  i;
        if(k < n && diff(res[i],res[j],res[k]))ret--;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3636