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

using namespace std;
typedef long long ll;
typedef long double ld;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

//const ll MOD = 1e9+7;
//const ll MOD = 998244353;
//const ll MAX = 3e5+1;
//const ll INF = 1e18;
//const ld PI = acos(-1L);

map<ll, ll> primeFactorials(ll n) {
    map<ll, ll> factcount;
    while (n % 2 == 0) {
        factcount[2]++;
        n /= 2;
    }
    for (ll i=3; i<=sqrt(n); i+=2) {
        while (n % i == 0) {
            factcount[i]++;
            n /= i;
        }
    }
    // handle primes bigger than 2
    if (n > 2) factcount[n]++;
    return factcount;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    ll N;
    in(N);
    map<ll, ll> factcount;
    factcount = primeFactorials(N);
    ll ans = 0;
    for (pair<ll, ll> p: factcount) {
        ll a = p.second;
        ll j = 1;
        while (a > 0) {
            a -= j;
            ans++;
            j += 1;
        }
        if (a < 0) ans--;
    }
    out(ans);


    return 0;
}


Measured memory_bytes: 3680
a, b, c, d, e, f = map(int, input().split())

water = [0]*(f+1)
suger = [0]*(f+1)
water[0] = 1
suger[0] = 1
for i in range(f+1):
    if water[i]:
        if i+100*a <= f:
            water[i+100*a] = 1

        if i+100*b <= f:
            water[i+100*b] = 1
    if suger[i]:
        if i+c <= f:
            suger[i+c] = 1
        if i+d <= f:
            suger[i+d] = 1

water_ls = [i for i in range(f+1) if water[i]]
suger_ls = [i for i in range(f+1) if suger[i]]

suger_water = []
max_c = 100*e/(100+e)
for w in water_ls:
    for s in suger_ls:
        if f < w+s:
            continue
        if w+s == 0:
            continue
        if s*(100+e) <= e*(w+s):
            c = 100*s/(w+s)
            suger_water.append((c, w, s))

suger_water.sort(reverse=True)
max_c, w, s = suger_water[0]
print(w+s, s)


Measured memory_bytes: 3956
#include<iostream>
using namespace std;
int y,x,s;
 
int calc(int p,int x){
  return p*(100+x)/100;
}
 
int main(){
  while(1){
    cin>>x>>y>>s;
    if(y==0&&x==0&&s==0)break;
    int ans=0;
    for(int i=1;i<s;i++){
      for(int j=1;j<s;j++){
    if(calc(i,x)+calc(j,x)!=s)continue;
    ans=max(ans,calc(i,y)+calc(j,y));
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3100
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
  int A,B,C,D;
  int ans=0;
  scanf("%d%d%d%d", &A, &B, &C, &D);
  for(int i=0;i<=100;++i) {
    if (i >= A && i<B && i>=C && i<D) ans++;
  }
  printf("%d\n", ans);
  return 0;
}


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

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

  int first = stoi(s.substr(0, 2));
  int second = stoi(s.substr(2, 2));
  if (first >= 1 && first <= 12 && second >= 1 && second <= 12) {
    cout << "AMBIGUOUS" << endl;
  } else if (second >= 1 && second <= 12) {
    cout << "YYMM" << endl;
  } else if (first >= 1 && first <= 12) {
    cout << "MMYY" << endl;
  } else {
    cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
  unsigned long h, w;
  
  scanf("%lu %lu", &h, &w);
  
  if (h==1 || w==1) {
    printf("%d", 1);
  } else if (h%2==1 && w%2==1) {
    printf("%lu", h*w/2+1);
  } else {
    printf("%lu", h*w/2);
  }
  
  return 0;
  
}

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

using namespace std;

const int MAXN = 200010;
typedef pair<int,int> pii;
#define mp make_pair
int par[MAXN];
int Rank[MAXN];
int N, K, L;
int A[MAXN], B[MAXN];
map <pii, int> ans;

void init(int n) {
  for(int i = 1; i <= n; i++) {
    par[i] = i;
    Rank[i] = 0;
  }
}
  int find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }


  void unit(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(Rank[x] < Rank[y])
      par[x] = y;
    else {
      par[y] = x;
      if(Rank[x] == Rank[y])Rank[x]++;
    }
  }
     
int main() {

  cin >> N >> K >> L;

  init(N);

  for(int i = 1; i <= K; i++) {
    int p, q;
    cin >> p >> q;
    unit(p,q);
  }
  for(int i = 1; i <= N; i++) A[i] = find(i);

  init(N);

  for(int i = 1; i <= L; i++) {
    int r, s;
    cin >> r >> s;
    unit(r,s);
  }

  for(int i = 1; i <= N; i++) B[i] = find(i);

  for(int i = 1; i <= N; i++) {
    ans[mp(A[i],B[i])]++;
  }

  for(int i = 1; i <= N; i++) {
    cout << ans[mp(A[i],B[i])]<<" ";
  }
 
    
  return 0;
  
}  


Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
int main(){
	string S;cin>>S;
	char D[4]={'A','T','G','C'};
	int count=0;vector<int> C;
	for(int i=0;i<S.size();i++){
		for(int j=0;j<4;j++){
			if(S.at(i)==D[j]){
				count++;
				break;
			}if(j==3){
				C.push_back(count);
				count=0;
			}
		}
	}C.push_back(count);
    cout<<*max_element(C.begin(),C.end())<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

class UnionFindTree {
   public:
    vector<int> parent;
    vector<int> siz;

    UnionFindTree(int n) {
        siz.resize(n, 1);
        parent.resize(n);
        for (int i = 0; i < n; i++) {
            parent[i] = i;
        }
    }

    int root(int x) {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y) {
        int rx = root(x); int ry = root(y);
        if (rx == ry) return;
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        parent[ry] = rx;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int size(int x) {
        return siz[root(x)];
    }
};

int main() {
    int N, M; cin >> N >> M;
    UnionFindTree uft(N);

    REP(i, 0, M) {
        int a, b; cin >> a >> b;
        uft.unite(--a, --b);
    }

    int ans = 0;
    REP(i, 0, N) {
        ans = max(ans, uft.size(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4840
#include <stdio.h>
 
 
int main() {
  int x[4];
  int y[4];
  scanf("%d %d %d %d",x,y,x+1,y+1);
  x[2] = x[1] + y[0] - y[1];
  y[2] = y[1] + x[1] - x[0];
  x[3] = x[2] + x[0] - x[1];
  y[3] = y[2] + y[0] - y[1];
  
  printf("%d %d %d %d\n",x[2] ,y[2] ,x[3] ,y[3]);
  return 0;
}

Measured memory_bytes: 128
main = do
  n <- getLine
  h <- map read . words <$> getLine
  putStrLn . show $ solve h

solve :: [Int] -> Int
solve h = count $ map calc (zip h [0..])
  where
    calc (hx, i) = null $ filter (\x -> hx < x) (take i h)

count [] = 0
count (x:xs) = (if x then 1 else 0) + count xs


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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  
  int result = 1;
  for(int i = 1; i < n; ++i)
  {
    if(s[i - 1] != s[i]) { ++result; }
  }
  cout << result << endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

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

    int size = (int)s.size();
    int sum = 0;

    for(int i=0; i < size/2; i++){
        // cout << s[i] << endl;
        if(s[i]!=s[size -1 - i]){
            sum += 1;
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
int main(void){
    int x,y,z;
    cin>>x>>y>>z;
    cout<<(x-z)/(y+z)<<endl;
    return 0;
}

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

const int MOD=1e9+7;
int dp[105][100005],prefix[105][100005],a[105];
inline int add(int a, int b){
	a += b;
	if(a >= MOD)a -= MOD;
	return a;
}
 
inline int sub(int a, int b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}
int main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<=n;i++)dp[i][0]=prefix[i][0]=1;
    for(int j=0;j<=k;j++)prefix[0][j]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            int first=(j-a[i]-1>=0)? prefix[i-1][j-a[i]-1]:0;
            int last =prefix[i-1][j];
            dp[i][j]=add(dp[i][j],sub(last,first));
            prefix[i][j]=add(prefix[i][j-1],dp[i][j]);
        }
    }
    cout<<dp[n][k]<<endl;
}

Measured memory_bytes: 82176
import collections

# 入力
N = int(input())
A = list(map(int, input().split()))

# リストの中の各値が何個かあるかを連想配列化する
# ['a','b','d','b','e','a','c','d','b'] → {'a':2,'b':3,'c':1,'d':2,'e':1}
AC = collections.Counter(A)

# 1～Nまでの個数を出力する（rangeは第1引数から第2引数-1までの範囲）
# 例：range(1,5)→1,2,3,4
for i in range(1, N+1):
    # 連想配列にiと同じキーがあれば、その値を出力
    if i in AC:
        print(AC[i])

    # キーがない場合は0個ということなので、0を出力
    else:
        print(0)


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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    puts(bool(n & 1) ^ bool(s[0] != s[n - 1]) ? "Second" : "First");
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
 
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e4 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
    readc(n, k, c);
    string s;
    cin >> s;
    s = 'a' + s;
    
    vi nearest(2*n + 6, inf);
    FORD (i, n, 1)
    {
        if (s[i] == 'o') nearest[i] = i;
        else nearest[i] = nearest[i + 1];
    }
    
    vi nxt (2*n + 5, inf);
    FOR (i, 1, n)
    {
        if (s[i] == 'x') continue;
        nxt[i] = nearest[i + c + 1];
    }
    
    vi dp (2*n + 5), cnt(2*n + 5), dpc(2*n + 6);
    int mx = 0;
    FORD (i, n, 1)
    {
        if (s[i] == 'x') continue;
        if (nxt[i] == inf) dp[i] = 1;
        else dp[i] = dp[nxt[i]] + 1;
        cnt[dp[i]]++;
        mx = max(mx, dp[i]);
        dpc[i] = cnt[dp[i]];
        
        //cout << i << ": " << nxt[i] << " " << dp[i] << endl;
    }
    
    if (k != mx) return 0;
    
    int cur = nearest[1];
    while (cur <= n)
    {
        if (dpc[cur] == 1) cout << cur << "\n";
        cur = nxt[cur];
    }
}





















Measured memory_bytes: 17488
# 相手の手
s = input()

# 組み合わせ
# 相: 自
# p : g = +1
# g : p = -1
# p : p = g : g = 0

# 最大までpを出す。 = len(s)//2
# 相手のパーの数は、期待値-1点なので減点する = s.count("P")

P = s.count("p")
print((len(s)//2)-P)

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

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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

ll K,ans=0;
string S;

int main(){
    cin>>S>>K;
    if(K==1){
        ans+=S[0]-'0';
        ans+=9*(S.size()-1);
    }
    else if(K==2){
        ans+=(S.size()-1)*(S.size()-2)/2*9*9;
        ans+=(S[0]-'0'-1)*(S.size()-1)*9;
        repi(i,1,S.size()){
            if(S[i]!='0'){
                ans+=S[i]-'0'+(S.size()-i-1)*9;
                break;
            }
        }
    }
    else{
        ans+=(S.size()-1)*(S.size()-2)*(S.size()-3)/6*9*9*9;
        ans+=(S[0]-'0'-1)*(S.size()-1)*(S.size()-2)/2*9*9;
        repi(i,1,S.size()-1){
            if(S[i]!='0'){
                repi(j,i+1,S.size()){
                    if(S[j]!='0'){
                        ans+=(S[i]-'0'-1)*(S.size()-i-1)*9+S[j]-'0'+(S.size()-j-1)*9;
                        break;
                    }
                }
                ans+=(S.size()-i-1)*(S.size()-i-2)/2*9*9;
                break;
            }
        }
    }
    out(ans);
}

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

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

  int n,m;cin>>n>>m;
  if(n==m)puts("Yes");
  else puts("No");

  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include<iomanip>
using namespace std;
bool prime(int n){
 for(int i=2;i<=n/2;i++){
   if (n%i==0)
    return false;
 }
 return true;}
 int a[10000];
 int b[10000];
 int prefx[10000000];
 int prefx2[10000000];
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
#define loop(n)      for(int i=0;i<(n);i++)
#define lp(x,s,e)    for(int x=(s);x<(e);x++)
#define lpe(x,s,e)    for(int x=(s);x<=(e);x++)
#define MP make_pair
#define PB push_back
#define all(a)  a.begin(),a.end()
#define clr(x,val) memset((x),(val),sizeof(x))
#define endl '\n'
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    if(n%1000==0)
    cout<<n%1000;
    else 
    cout<<1000-(n%1000);     
    }

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

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

    int ans = 0;
    int a = n / 500;
    ans += a * 1000;
    if(n - 500 * a != 0)
    {
        int b = (n - 500 * a) / 5;
        ans += b * 5;
    }

    cout << ans << "\n";

}

Measured memory_bytes: 256
main = do
  a <- getLine
  let aaa = (\x -> [(length x)-1,last x]) [x| x<- [(read a),((read a)-3600)..0]]
  let bbb = (\x -> [(head aaa),(length x)-1,last x]) [x| x<- [(last aaa),((last aaa)-60)..0]]
  let ccc = tail $ foldl (\acc x -> acc ++ ":" ++ show x) "" bbb

  putStrLn $ ccc 


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

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


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

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

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N, M;
    cin >> N >> M;
    int ans = (1900 * M + 100 *(N -M)) * pow(2, M);
    cout << ans << endl;

    return 0;
}


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

int check(int a,int b){
  if(a==7){
    ++b;
  }
return b;
}

int main(){
  int n,x,y,z;
  cin >>n;
  x =n/100;
  y =(n-(x*100))/10;
  z = n-(x*100+y*10);
  int flag=0;
  flag =check (x,flag);
  flag =check (y,flag);
  flag =check (z,flag);
  if(flag){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
 
    x = x % p; // Update x if it is more than or  
                // equal to p
   
    if (x == 0) return 0; // In case x is divisible by p;
 
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
 
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
 


int main()
{
 
  fastio();

ll int T=1;

while(T--)
{
    ll int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d)
    {
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}



return 0;}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt","r",stdin);
    long long a,b;
    cin>>a>>b;
    cout<<a*b<<"\n";
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define VI vector<int>
#define PII pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x){return mrand()%x;}
clock_t ac; double TLE(){return (double)(clock()-ac)/CLOCKS_PER_SEC;}
void DBG() {cerr << "]" << endl;}
template<class H, class... T> void DBG(H h, T... t) {
cerr << to_string(h);
if(sizeof...(t)) cerr << ", ";
DBG(t...);}
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

int main(){
 ios::sync_with_stdio(0);
 cin.tie(0);
    int n;
    cin >> n;
    vector<int> cnt(202020);
    vector<int> a(n);
    long long int ans = 0;
    for (int i = 0; i < n; ++i) {
           cin >> a[i];
           ans += cnt[a[i]];
           ++cnt[a[i]];
     }
     for (int i = 0; i < n; ++i) {
            cout << ans - cnt[a[i]] + 1 << '\n';
     }
}




Measured memory_bytes: 4760
H, W = map(int, input().split())
lst = []
for _ in range(H):
    s = input()
    if s.find('#') >= 0:
        lst.append(s)

lst2 = []
for w in range(W):
    skip = True
    for h in range(len(lst)):
        if lst[h][w] == '#':
            skip = False
            break
    lst2.append(skip)

for x in lst:
    for idx, y in enumerate(x):
        if not lst2[idx]:
            print(y, end='')
    print()

Measured memory_bytes: 4468
/*input
9
*/
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define sz(a) int((a).size())
#define pb push_back
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())     
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define mp make_pair
#define N 998244353
#define PI acos(-1.0)
//if (s.find('R') != std::string::npos)
//s.replace(s.find("10"), sizeof("10") - 1, "");
using namespace std;

int main()
{
  // added the two lines below 
  ios_base::sync_with_stdio (false); 
  cin.tie(NULL);
  cout.tie(0);
  ull a,b,c,d;
  cin>>a>>b>>c>>d;
  ull x,y,z,gc;
  x=b/c-(a-1)/c;
  y=b/d-(a-1)/d;
  gc=(c*d)/__gcd(c,d);
  z=b/gc-(a-1)/gc;
  cout<<b-a+1-x-y+z;
  
  }

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

#define rep(i,x) for(int i = 0; i < x; i++)
#define rrep(i,x) for(int i = 1; i <= x; i++)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using ll = long long;
using ull = unsigned long long;
using namespace std;
const int INF = 1001001001;
const ll LINF = 1002003004005006007;

void dfs(vector<string> &ans, const int n, string str = "a", int candi = 0, int tier = 1){
    rep(i, tier + 1){
        if (candi + 1 < i) continue;
        char next_alb = 'a' + i;
        string next_str = str + next_alb;
        if (tier == n - 1) ans.push_back(next_str);
        int next_candi = max(candi, i);
        int next_tier = tier + 1;
        if (tier < n){
            dfs (ans, n, next_str, next_candi, next_tier);
        }
    }
}

int main(){
    int n; cin >> n;
    vector<string> ans;
    dfs(ans, n);
    if (n == 1) ans.push_back("a");
    for (auto str : ans){
        cout << str << endl;
    }
}


Measured memory_bytes: 7796
#include <iostream>
#include <vector>
#include <complex>
#include <algorithm>
#include <cstdio>

using namespace std;

#define EPS 1e-9

//typedef complex<double> P;

struct P {
	double x, y;
};

typedef vector<P> polygon;

bool operator <(const P& p1, const P& p2) {
	return p1.x < p2.x;
}
P operator -(const P& p1, const P& p2) {
	return (P){p1.x - p2.x, p1.y - p2.y};
}

int F(double v) {
	if ( abs(v) < EPS ) return 0;
	return v < 0 ? -1 : v > 0 ? 1 : 0;
}

double cross(P p1, P p2) {
	return p1.x * p2.y - p1.y * p2.x;
}

int ccw(P& p1, P& p2, P& p3) {
	return F(cross(p2 - p1, p3 - p1));
}

bool check(polygon& t, int comp) {
	int n = t.size();
	if (n < 3) return true;
	return ccw(t[n-3], t[n-2], t[n-1]) == comp;
}

int main() {
	int n;
	while ( cin >> n, n ) {
		vector<P> v;
		for (int i = 0; i < n; ++i) {
			double x, y;
			scanf("%lf,%lf", &x, &y);
			v.push_back( (P){x, y} );
		}
		sort( v.begin(), v.end() );

		int ans = n+2;

		polygon t;
		for (int i = 0; i < v.size(); ++i) {
			t.push_back(v[i]);
			while ( !check(t, 1) ) t.erase( t.end()-2, t.end()-1 );
		}
		ans -= t.size();

		t.clear();
		for (int i = 0; i < v.size(); ++i) {
			t.push_back(v[i]);
			while ( !check(t, -1) ) t.erase( t.end()-2, t.end()-1 );
		}
		ans -= t.size();

		cout << ans << endl;
	}
}

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

using int64 = long long;

constexpr int64 kMod = 1e9 + 7;

int64 kDP[100002][2];

int main() {
  std::string L;
  std::cin >> L;

  kDP[0][0] = 1;
  for (int i = 0; i < L.size(); i++) {
    for (int less : {0, 1}) {
      for (int d1 : {0, 1}) {
        for (int d2 : {0, 1}) {
          int nd = d1 ^ d2;

          if ((d1 == 1 && d2 == 1) || (!less && nd > L[i] - '0')) continue;

          (kDP[i + 1][less || (nd < L[i] - '0')] += kDP[i][less]) %= kMod;
        }
      }
    }
  }

  int64 ans = (kDP[L.size()][0] + kDP[L.size()][1]) % kMod;
  std::cout << ans << std::endl;

  return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
    
  if ( A == 1 && B != 1){
    cout << "Alice" << endl;
  }
  else if ( A != 1 && B == 1 ){
    cout << "Bob" << endl;
  }
  
  else {
    if ( A > B ) {
      cout << "Alice" << endl;
    }
    if ( A < B ) {
      cout << "Bob" << endl;
    }
    if ( A == B ) {
      cout << "Draw" << endl;
    }
  }
}


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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    
    if (b <= a) {
        cout << "delicious" << endl;
    }
    else if (b - a <= x) {
        cout << "safe" << endl;
    }
    else {
        cout << "dangerous" << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, M, Q;
int a[60], b[60], c[60], d[60];
int ans;

void dfs(vector<int> v){
    if(v.size() == N){
        int res = 0;
        for(int i = 0; i < Q; i++){
            if(v[b[i]] - v[a[i]] == c[i]) res += d[i];
        }
        chmax(ans, res);
        return;
    }
    auto it = v.rbegin();
    int mx = *it;
    for(; mx <= M; mx++){
        vector<int> tmp = v;
        tmp.push_back(mx);
        dfs(tmp);
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M >> Q;
    for(int i = 0; i < Q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i], a[i]--, b[i]--;
    dfs(vector<int>{1});
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> T(N);
  for (int i = 0; i < N; ++i) {
    int a, b;
    cin >> a >> b;
    T[i] = make_pair(b, a);
  }
  
  sort(T.begin(), T.end());
  int time = 0;
  string ans = "Yes";
  for (int i = 0; i < N; ++i) {
    time += T[i].second;
    if (time > T[i].first) ans = "No";
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll co(ll n, ll k) { ll a = 1; rep(i, 1ll, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main(void) {
	int ans = INF;
	string s, t;
	cin >> s >> t;
	rep(i, 0, s.size() - t.size() + 1) {
		int temp = 0;
		rep(i2, 0, t.size()) {
			if (s[i + i2] != t[i2])temp++;
		}
		ans = min(temp, ans);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;




int main()
{
	int y,m,d;

	scanf("%d/%d/%d",&y,&m,&d);

	if (m > 4){
		printf("TBD");
	}
	else {
		if (m < 4) {
			printf("Heisei");
		}
		else {
			if (d <= 30) {
				printf("Heisei");
			}
			else {
				printf("TBD");
			}
		}
	}


	return 0;
}



Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  REP(i,19) {
    char c;
    cin >> c;
    if(c == ',') cout << " ";
    else cout << c;
  }
  cout << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    
    ll N; cin >> N;
    ll ans = 0LL;
    if(N % 2LL == 1) cout << 0 << endl;
    else {
        ans += N / 10LL;
        N /= 10;
        ll bunbo = 5;
        while(N/bunbo) {
            ans += N / bunbo;
            bunbo *= 5;
        }
        cout << ans << endl;
    }
}

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

int main() {
  int h,w;
  int ans=0;
  const int INF=1001001001;
  const int di[] = {-1,0,1,0};
  const int dj[] = {0,-1,0,1};
  cin >> h >> w;
  vector<string> a(h);
  rep(i,h)cin >> a[i];
  vector <vector<int>> dist(h,vector<int>(w,INF));
  queue <P> q;
  auto update = [&](int i,int j,int k){
		  if(dist[i][j]!=INF)return;
		  dist[i][j]=k;
		  P p = P(i,j);
		  q.push(P(i,j));
		};
  rep(i,h)rep(j,w){
    if(a[i][j]=='#'){
      update(i,j,0);
    }
  }
  
  while(!q.empty()){
    int i = q.front().first;
    int j = q.front().second;
    q.pop();
    rep(dir,4){
      int ni = i + di[dir];
      int nj = j + dj[dir];
      if(ni<0||nj<0||ni>=h||nj>=w)continue;
      update(ni,nj,dist[i][j]+1);
    }
  }
  rep(ti,h)rep(tj,w){
    if(dist[ti][tj]!=INF)ans = max(ans,dist[ti][tj]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 13456
def main():
    N = int(input())
    S = input()

    rc0 = [0] * N
    gc0 = [0] * N
    bc0 = [0] * N

    rc = [0] * N
    gc = [0] * N
    bc = [0] * N

    rlist = []
    glist = []
    blist = []

    if True:
        i = N - 1
        if S[i] == 'R':
            rc[i] = 1
            rc0[i] = 1
        elif S[i] == 'G':
            gc[i] = 1
            gc0[i] = 1
        elif S[i] == 'B':
            bc[i] = 1
            bc0[i] = 1

    for i in range(N - 2, -1, -1):
        if S[i] == 'R':
            rc[i] += 1
            rc0[i] = 1
            rlist.append(i)
        elif S[i] == 'G':
            gc[i] += 1
            gc0[i] = 1
            glist.append(i)
        else:
            bc[i] += 1
            bc0[i] = 1
            blist.append(i)

    for i in range(N - 2, -1, -1):
        rc[i] += rc[i + 1]
        gc[i] += gc[i + 1]
        bc[i] += bc[i + 1]

    def count(rlist, glist, bc, bc0):
        v = 0

        for i in rlist:
            for j in glist:
                if i >= j:
                    break
                k = 2 * j - i
                if k < N:
                    v += bc[j + 1] - bc0[k]
                else:
                    v += bc[j + 1]
        return v

    rgb = 0
    rgb += count(rlist, glist, bc, bc0)
    rgb += count(rlist, blist, gc, gc0)
    rgb += count(glist, rlist, bc, bc0)
    rgb += count(glist, blist, rc, rc0)
    rgb += count(blist, rlist, gc, gc0)
    rgb += count(blist, glist, rc, rc0)
    print(rgb)


main()


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

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

int main() {
	string a, b, c;
	cin >> a >> b >>c;
  	if(a[a.size()-1]==b[0] and b[b.size()-1]==c[0]){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
m=10**9+7
t=input()[::-1]
dp=[0]*13
dp[0]=1
for d in range(len(t)):
  p=[0]*13
  if t[d]=='?':
    for x in range(10):
      r=int(x)*pow(10,d,13)
      for i in range(13):
        p[(i+r)%13]+=dp[i]
  else:
    r=int(t[d])*pow(10,d,13)
    for i in range(13):
      p[(i+r)%13]=dp[i]
  dp=[j%m for j in p]
print(dp[5]%m)


Measured memory_bytes: 43756
#include<stdio.h>
int main ()
{
int a , b , c ;
scanf("%d%d%d" ,& a ,& b ,& c );
if (( a >= b ) && ( a >= c))
{
if ( b >= c )
{
printf ("%d %d %d\n",  c,b,a);
}
else
{

printf ("%d %d %d\n",b,c,a);
}
}
else if (( b >= a ) && ( b >= c ))
{
if ( a >= c )
{
printf ("%d %d %d\n", c,a,b);
}
else
{
printf ("%d %d %d\n",a,c,b);
}
}
else if (( c >= a ) && ( c >= b ))
{
if ( a >= b )
{
printf ("%d %d %d\n", b,a,c);
}
else
{
printf ("%d %d %d\n",a,b,c);
}
}
return 0;
}


Measured memory_bytes: 2040
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    a,b,c=MI()
    week,r=divmod(c,7*a+b)
    day=(r+a-1)//a
    print(week*7+min(7,day))

main()


Measured memory_bytes: 5612
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;
int main(){
    int N; cin >> N;
    vi a;
    vi b(N);
    int sumRain = 0;
    int oneToN1 = 0;
    rep(i, 0, N){
        int x;
        cin >> x;
        sumRain += x;
        if(i % 2 == 1){
            oneToN1 += x;
        }
        a.push_back(x);
    }
    sumRain = sumRain / 2;
    int b1 = sumRain - oneToN1;
    b[0] = 2 * b1;
    int curb = b1;
    for(int i=0; i<N-1; i++){
        int ansb = a[i] - curb;
        b[i+1] = 2 * ansb;
        curb = ansb;
    }
    rep(i, 0, N){
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}




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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for(int i = 0; i < n; i++){
    int in;
    cin >> in;
    a[i] = make_pair(in, i + 1);
  }
  
  sort(a.begin(), a.end());
  
  cout << a[0].second;
  for(int i = 1; i < n; i++){
    cout << ' ' << a[i].second;
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  int64_t ans = 0;
  cin >> N >> K;
  vector<int64_t> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = K; i < N; i++) {
    ans += a.at(i);
  }
  cout << ans << endl;
}

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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    int n = Integer.parseInt(r.readLine());

    boolean[][] f = new boolean[101][11];
    int[][] p = new int[101][11];

    for (int i = 0; i < n; i++)
    {
      String[] ls = r.readLine().split("[\\s]+");
      for (int j = 0; j < 10; j++)
      {
        f[i][j] = (Integer.parseInt(ls[j]) == 1);
      }
    }

    for (int i = 0; i < n; i++)
    {
      String[] ls = r.readLine().split("[\\s]+");
      for (int j = 0; j < 10; j++)
      {
        p[i][j] = Integer.parseInt(ls[j]);
      }
    }

    int max = Integer.MIN_VALUE;

    for (int s = 1; s <= 1023; s++)
    {
      int[] de = new int[101];
      for (int i = 0; i < n; i++)
      {
        de[i] = 0;
        for (int j = 0; j < 10; j++)
        {
          if (f[i][j] && (((s >> j) & 1) == 1))
          {
            de[i]++;
          }
        }
      }

      int pro = 0;
      for (int i = 0; i < n; i++)
      {
        pro += p[i][de[i]];
      }
      max = Integer.max(max, pro);
    }

    System.out.println(max);
  }

}


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

int main() {
  int N;
  cin >> N;
  if(N%10==2 ||N%10==4 ||N%10==5 ||N%10==7 ||N%10==9) {
    cout << "hon" << endl;
  }
  else if(N%10==0 ||N%10==1||N%10==6 ||N%10==8){
    cout << "pon" << endl;
  }
  else {
    cout << "bon" << endl;
  }
 
  
}


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

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B;
	cin>>A>>B;
	
	if(((B+A-1)/A)*A-B <= (B/A)) cout<<-1<<endl;
	else cout<<((B+A-1)/A)*A<<endl;
	
	return 0;
}


Measured memory_bytes: 3236
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, d; cin >> n >> d;
    V<V<double> > x(n, V<double>(d));
    REP(i, n) REP(j, d) cin >> x[i][j];
    ll ans = 0;
    REP(i, n) rep(j, i+1, n) {
        double dist=0.0;
        REP(_d, d) dist += (x[i][_d] - x[j][_d]) * (x[i][_d] - x[j][_d]);
        if ((ll)sqrt(dist) * (ll)sqrt(dist) == dist) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
//4008802802
//4008160009
//1175114440
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define pb push_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define forn(i, a) for(register int i=0; i<a; i++)
#define Forn(i, a) for(register int i=1; i<=a; i++)
#define memINF 127
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;
typedef vector<vector<ll> > matrix;

inline int in() 
{
    int x=0, c;
    while((uint)((c=getchar())-48)>=10) 
        if(c=='-') 
            return -in();
    do 
    { x=(x<<3)+(x<<1)+(c^48); }
    while((uint)((c=getchar())^48)<10);
    return x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=1e5+5;

int N, K, a, b, val[MAX], L[MAX], R[MAX];
vi e[MAX];

inline void Dfs(int x, int p)
{
    L[x]=-1e9-1, R[x]=1e9+1;
    if(val[x]!=-1)
        L[x]=R[x]=val[x];
    foreach(it, e[x])
        if(*it!=p)
        {
            Dfs(*it, x);
            if(L[*it]<-1e9/2)
                continue;
            if(L[x]<-1e9/2)
            {
                L[x]=L[*it]-1;
                R[x]=R[*it]+1;
                continue;
            }
            if((abs(L[x])&1)==(abs(L[*it])&1))
            {
                puts("No");
                exit(0);
            }
            L[x]=max(L[x], L[*it]-1);
            R[x]=min(R[x], R[*it]+1);
        }
    if(L[x]>R[x])
    {
        puts("No");
        exit(0);
    }
}

inline void Make(int x, int p)
{
    foreach(it, e[x])
        if(*it!=p)
        {
            if(val[*it]==-1)
            {
                if(L[*it]<=val[x]+1&&val[x]+1<=R[*it])
                    val[*it]=val[x]+1;
                else
                    val[*it]=val[x]-1;
            }
            Make(*it, x);
        }
    
}

int main()
{
    memset(val, -1, sizeof(val));
    N=in();
    Forn(i, N-1)
    {
        a=in(), b=in();
        e[a].eb(b);
        e[b].eb(a);
    }
    
    K=in();
    while(K--)
        a=in(), val[a]=in();
    
    Dfs(1, 0);
    
    puts("Yes");
    if(val[1]==-1)
        val[1]=L[1];
        
    Make(1, 0);
    Forn(i, N)
        printf("%d\n", val[i]);
    return 0;
}

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

using namespace std;

int main(void)
{
    set<int> st;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int x = 0;
        cin >> x;
        st.insert(x);
    } 
    cout << st.size();
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    string a,b;
    cin>>a>>b;
    rep(i,max(a.length(),b.length())){
        if(i<a.length()){
            cout<<a[i];
        }
        if(i<b.length()){
            cout<<b[i];
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

for s in S:
    for i in range(W):
        if s[i] == ".": s[i] = 0

for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            if i > 0:
                if S[i-1][j] != "#": S[i-1][j] += 1
                if j > 0 and S[i-1][j-1] != "#": S[i-1][j-1] += 1
                if j < W-1 and S[i-1][j+1] != "#": S[i-1][j+1] += 1
            if i < H-1:
                if S[i+1][j] != "#": S[i+1][j] += 1
                if j > 0 and S[i+1][j-1] != "#": S[i+1][j-1] += 1
                if j < W-1 and S[i+1][j+1] != "#": S[i+1][j+1] += 1
            if j > 0 and S[i][j-1] != "#": S[i][j-1] += 1
            if j < W-1 and S[i][j+1] != "#": S[i][j+1] += 1

for s in S:
    print("".join(map(str, s)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;cin>>n;
  ll a[200000];
  vector<ll> b;
  REP(i,n){
    cin>>a[i];
  }
  if(n%2==1){
    int t=n-1;
    while(t>0){
      cout<<a[t]<<" ";
      t-=2;
    }
    cout<<a[0]<<" ";
    int tt=1;
    while(tt<n-1){
      cout<<a[tt]<<" ";
      tt+=2;
    }
  }
  if(n%2==0){
    int t=n-1;
    while(t>0){
      cout<<a[t]<<" ";
      t-=2;
    }
    cout<<a[0]<<" ";
    int tt=2;
    while(tt<n-1){
      cout<<a[tt]<<" ";
      tt+=2;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
#include<stdio.h>
 int n;

 int solve(int i,int A[],int m){
         int tmp;
         if(m==0)return 1;
         if(i>=n)return 0;
         tmp=(solve(i+1,A,m)||solve(i+1,A,m-A[i]));
         return tmp;
         }     

 int main(){
         int q,A[2001],m,i;
         scanf("%d",&n);
         for(i=0;i<n;i++){
                    scanf("%d",&A[i]);
                    }
         scanf("%d",&q);
         for(i=0;i<q;i++){
                    scanf("%d",&m);
                    if(solve(0,A,m))printf("yes\n");
                    else printf("no\n");
                    }
         return 0;
         }



Measured memory_bytes: 2040
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N;
std::vector<LL>A;

LL f(LL b)
{
	LL res = 0;
	rep(i, N) res += abs(A[i] - b);
	return res;
}

int main()
{
	in >> N;
	A.resize(N);
	rep(i, N)
	{
		in >> A[i];
		A[i] += N-i;
	}
	LL l = -1123456789, r = 1123456789;
	while (r - l > 1)
	{
		LL m = (l + r) / 2;
		if (f(m - 1) < f(m + 1)) r = m;
		else l = m;
	}
	out << f(l) << std::endl;
	return 0;
}


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

int main() {
  int N; cin >> N;
  vector<pair<int, int> > data(N);
  
  for(int i = 0; i < N; ++i){
    int A, B; cin >> A >> B;
    data.at(i).first = B;
    data.at(i).second = A;
  }
  
  sort(data.begin(), data.end());
  
  bool flag = true;
  
  for(int i = 1; i < N; ++i){
    data.at(i).second += data.at(i-1).second;
    if(data.at(i).second > data.at(i).first) flag = false;
  }
  
  if(data.at(0).second > data.at(0).first) flag = false;
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 1792