akhauriyash/Code-Regression huggingface dataset:
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] numbers=Console.ReadLine().Split(' ');
        var c=0;

        if(int.Parse(numbers[0])+int.Parse(numbers[1])+int.Parse(numbers[2])==int.Parse(numbers[0])*3)
        {
            Console.WriteLine("No");
            return;
        }

        for(var i=0; i<2; i++)
        {
            for(var j=i+1; j<3; j++)
            {
                if(numbers[i]==numbers[j]) c++;
            }
        }

        if(c==1)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
n = gets.to_i

def over(a, b)
  if a < b
    (b % a == 0) ? b / a : b / a + 1
  else
    1
  end
end

answer = 0
min_t = 0
min_a = 0

n.times { |i|
  t, a = gets.chomp.split(' ').map { |e| e.to_i }
  if (min_t <= t && min_a <= a)
    min_t, min_a = t, a
    answer = t + a
  else
    n = over(t, min_t)
    m = over(a, min_a)
    l = over(t + a, answer)

    p = [n,m,l].max
    min_t, min_a, answer = [t, a, t + a].map { |e| e * p }
  end
}
puts answer



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

using ll = long long;

int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    ll ans = 1;
    rep(i, N) {
        ans *= i + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

int S[50][2], G[50][2];

int main(void) {
  int N, M;
  cin >> N >> M;
  int a, b;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    S[i][0] = a;
    S[i][1] = b;
  }
  int c, d;
  for (int j = 0; j < M; j++) {
    cin >> c >> d;
    G[j][0] = c;
    G[j][1] = d;
  }
  
  int mn_Manhattan, Manhattan, ans;
  for (int n = 0; n < N; n++) {
    a = S[n][0];
    b = S[n][1];
    mn_Manhattan = 1000000000;
    
    for (int m = 0; m < M; m++) {
      c = G[m][0];
      d = G[m][1];
      Manhattan  = abs(a - c) + abs(b - d);
      if (mn_Manhattan > Manhattan) {
        mn_Manhattan = Manhattan;
        ans = m + 1;
      }
    }
    
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    int h,w,a,b;cin >> h >> w >> a >> b;
    rep(i,h){
        rep(j,w){
            if((i<b)^(j<a)){
                cout << 1;
            }
            else cout << 0;
        }
        cout << endl;
    }
    return 0;
}

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

#define int ll
#define pb push_back
#define DBGB if (true)

using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vvi=vector<vi>;
using vpii=vector<pii>;
using vvpii=vector<vpii>;
using E=array<int,3>;
using ve=vector<E>;

template<typename A, typename B> ostream& operator<<(ostream& out, const pair<A, B>& p) { return out << "(" << p.first << ", " << p.second << ")"; }
template<typename Ch, typename Tr, typename C> basic_ostream<Ch, Tr>& operator<<(basic_ostream<Ch, Tr>& out, const C& xs) { out << "["; for (const auto& x: xs) out << x << ", "; out << "]"; }

const int MOD = 1e9+7;


int factmod(int n) {
  int r = 1;
  while (n > 0) {
    r = r*n%MOD;
    --n;
  }
  return r;
}

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

  int n;
  string s;
  cin >> n >> s;
  int totcnt = 1;
  int open = 0;
  for (int i=0; i<2*n; ++i) {
    int flipthis = 0;
    if (s[i] == 'B')
      flipthis = 1;
    else
      assert(s[i] == 'W');
    if (open%2 == flipthis) {  // cannot open here
      if (open == 0)
        totcnt = 0;
      else {
        totcnt = (totcnt * open) % MOD;
        --open;
      }
    }
    else {  // need to open here
      ++open;
    }
  }
  if (open > 0)
    totcnt = 0;
  cout << totcnt*factmod(n)%MOD << endl;
}



Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <stdbool.h>
#include <bitset>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;
using namespace std;


int main(void) {
    int a,b;
    cin >> a >> b;
    auto result = max(a + a - 1, max(a + b, b + b - 1));
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 888
N, M=map(int, input().split())
mod=10**9+7
pre=-1
hole=[]
for i in range(M):
  a=int(input())
  hole.append(a-1-pre)
  pre=a
hole.append(N-pre)

  

dp=[0]*(N+3)
dp[1]=1
dp[2]=1
for i in range(3,N+3):
  dp[i]=(dp[i-1]+dp[i-2])%mod

  
#print(dp)
#print(hole)
ans=1
for h in hole:
  ans*=dp[h]
  ans%=mod
  
print(ans)

Measured memory_bytes: 7844
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
using namespace std;
#define MAX 100005
#define MOD 998244353
#define EPS 0.00000000001
#define INF 1000000000
int P[MAX];
int Find(int x)
{
    if(P[x]==x) return x;
    else
    {
        P[x]=Find(P[x]);
        return P[x];
    }
}
bool Join(int x,int y)
{
    int PoX=Find(x),PoY=Find(y);
    if(PoX==PoY) return false;
    else if(PoX<PoY) P[PoY]=PoX;
    else P[PoX]=PoY;
    return true;
}
int main()
{
    int n,m,i,j,x,y,z;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++) P[i]=i;
    int components=n;
    for(i=0;i<m;i++)
    {
        scanf("%d %d %d",&x,&y,&z);
        if(Join(x,y)) components--;
    }
    printf("%d",components);
    return 0;
}


Measured memory_bytes: 4088
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n;
    ll x, a;
    cin >> n >> x;
    vector<ll> v(n);
    for (int i = 0; i < n; i++) {
        cin >> a;
        v[i] = a;
    }
    vsort(v);
    int cnt = 0;
    for (int i = 0; i < n && x > 0; i++) {
        if (i == n - 1) {
            if (v[i] == x) {
                cnt++;
                x -= v[i];
            }
        }else{
            if (v[i] <= x) {
                cnt++;
                x -= v[i];
            }
        }
        
        
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
	string s; cin>>s;
	map<string,int> m;
	m["SUN"]=7;
	m["MON"]=6;
	m["TUE"]=5;
	m["WED"]=4;
	m["THU"]=3;
	m["FRI"]=2;
	m["SAT"]=1;
	cout<<m[s]<<endl;
}

Measured memory_bytes: 256
A, B, C, D = input().split()

A = int(A)
B = int(B)
C = int(C)
D = int(D)

while True:
  C -= B
  if(C <= 0):
    print('Yes')
    break
  A -= D
  if(A <= 0):
    print('No')
    break
  

Measured memory_bytes: 9116
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int r; cin >> r;
    cout << r * r << endl;

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 30 21:20:44 2020

@author: black
"""


X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

P = [(i, "RED") for i in p]
Q = [(i, "GREEN") for i in q]
R = [(i, "NO COLOR") for i in r]

all = []
all.extend(P)
all.extend(Q)
all.extend(R)
all.sort()

import copy
test = copy.deepcopy(all)

all.sort(reverse=True)

num_red = 0
num_green = 0
num_transparent = 0
total = 0

for i in all:
    if num_red + num_green + num_transparent < X + Y:
        if i[1] == "RED":
            if num_red < X:
                num_red += 1
                total += i[0]
        elif i[1] == "GREEN":
            if num_green < Y:
                num_green += 1
                total += i[0]
        elif i[1] == "NO COLOR":
            num_transparent += 1
            total += i[0]
    else:
        break

print(total)
    

Measured memory_bytes: 43584
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;



int main(int argc, const char * argv[]) {
#if EMULATE_CIN
  // input from txt
  std::ifstream in("input.txt");
  std::cin.rdbuf(in.rdbuf());
#endif

  string input;
  cin >> input;
  
  int length = 0;
  int maxLength = 0;
  for(auto c : input)
  {
    switch(c)
    {
      case 'A':case 'T':case 'G':case 'C':
        length++;
        break;
      default:
        
        maxLength = max(maxLength, length);
        length = 0;
    }
  }
  maxLength = max(maxLength, length);

  printf("%d\n", maxLength);
  
  return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
const ll INF=1000000000000000;

const ll V=10;//頂点数

ll d[10][10];//d[u][v]は辺e=(u,v)のコスト(存在しない場合はINF、ただしd[i][i]=1とする)

void warshall_floyd(){
	rep(k,V)rep(i,V)rep(j,V){
		d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
}

int main(){
	ll H,W; cin>>H>>W;
	
	//辺を張る
	rep(i,10)rep(j,10) cin>>d[i][j];
	//warshall_floyd
	warshall_floyd();
	
	ll ans=0;
	rep(i,H)rep(j,W){
		ll x; cin>>x;
		if(x!=-1){
			ans+=d[x][1];
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{   string str,T;
    getline(cin,str);
    stringstream X(str);
    while(getline(X,T,' '))
    {
        cout<<T[0];
    }
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 1020000,mo=998244353;
int n,m,res,fac[N],ifac[N];
inline int power(int a, int n){
	int res=1;
	while(n){
		if(n&1)res=1LL*res*a%mo;a=1LL*a*a%mo;n>>=1;
	}
	return res;
}
void init(int n){
	fac[0]=1;rep(i,1,n)fac[i]=1LL*fac[i-1]*i%mo;
	ifac[n]=power(fac[n],mo-2);per(i,n-1,0)ifac[i]=1LL*ifac[i+1]*(i+1)%mo;
}
inline int C(int n, int m){return 1LL*fac[n]*ifac[m]%mo*ifac[n-m]%mo;}
int main() {
	read(n);read(m);init(max(n,m));
	rep(k,0,min(n,m))res=(res+1LL*(k&1?mo-1:1)*C(n,k)%mo*C(m,k)%mo*fac[k]%mo*power(m+1,n-k)%mo*power(n+1,m-k))%mo;
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll X,Y,A,B,C;
multiset<pll> se;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> X >> Y >> A >> B >> C;
    for (int i = 0; i < A; i++)
    {
        ll a;
        cin >> a;
        se.insert({a,1});

    }
    for (int i = 0; i < B; i++)
    {
        ll a;
        cin >> a;
        se.insert({a,2});

    }
    for (int i = 0; i < C; i++)
    {
        ll a;
        cin >> a;
        se.insert({a,0});
    }
    
}

int solve(){
    ll ans=0;
    ll cntX=0,cntY=0,cnt=0;
    for (auto itr=--se.end();itr!=se.begin();--itr)
    {
        if((*itr).second==1 && cntX>=X) continue;
        if((*itr).second==2 && cntY>=Y) continue;
        if(cnt>=(X+Y)) break;
        if((*itr).second==1) cntX++;
        if((*itr).second==2) cntY++;
        cnt++;
        DBG((*itr).first)
        ans += (*itr).first;
    }
    cout << ans << endl;
    
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 19072
def partition(A, p, r):
    x = A[r]
    i = p-1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]

    A[i+1], A[r] = A[r], A[i+1]
    return i+1


if __name__ == "__main__":
    n = int(input())
    A = list(map(int, input().split()))
    i = partition(A, 0, n-1)
    A[i] = f"[{A[i]}]"
    print(*A)


Measured memory_bytes: 16396
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200000)


def read():
    S = input().strip()
    T = input().strip()
    return S, T


def solve(S, T):
    if T[:len(T)-1] == S:
        return "Yes"
    return "No"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 9116
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

ll mod = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    int len = s.length();
    vvll dp(len);

    {
        int i = 0;
        char si = s[len - 1 - i];
        dp[i] = vll(13, 0);
        if (si == '?')
        {
            for (int d = 0; d < 10; d++)
            {
                dp[i][d] = 1;
            }
        }
        else
        {
            int d = si - '0';
            dp[i][d] = 1;
        }
    }

    ll mb = 1;
    for (int i = 1; i < len; i++)
    {
        mb = mb * 10 % 13;
        char si = s[len - 1 - i];
        dp[i] = vll(13, 0);
        if (si == '?')
        {
            for (int d = 0; d < 10; d++)
            {
                ll m = mb * d % 13;
                for (int j = 0; j < 13; j++)
                {
                    dp[i][(j + m) % 13] += dp[i - 1][j];
                    dp[i][(j + m) % 13] %= mod;
                }
            }
        }
        else
        {
            int d = si - '0';
            ll m = mb * d % 13;
            for (int j = 0; j < 13; j++)
            {
                dp[i][(j + m) % 13] += dp[i - 1][j];
                dp[i][(j + m) % 13] %= mod;
            }
        }
    }

    cout << dp[len - 1][5] << endl;

    return 0;
}


Measured memory_bytes: 13696
/**
 *    author:  math2do
 *    created: 07.04.2020 10:01:16
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, k, c;
  cin >> n >> k >> c;
  string s;
  cin >> s;
  vector <int> rankR(n, 0);
  int rank = k;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      rankR[i] = rank--;
      i -= c;
    }
  }
  rank = 1;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'o') {
      if (rankR[i] == rank++) {
        cout << (i + 1) << '\n';
      }
      i += c;
    }
  }
  return 0;
}

Measured memory_bytes: 2564
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <string>
#include <sstream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;
bool f1(string s)
{
    if(s[0]==s[1]&&s[1]==s[2]) return 1;
    else if(s[1]==s[2]&&s[2]==s[3]) return 1;
    else return 0;
}

int main()
{
    string s;
    cin>>s;
    if(f1(s)) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        String s = ns();
        s = s.replaceAll(",", " ");
        out.println(s);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    class INA {
        int[][] a;

        INA(int n, int m) throws IOException {
            this(n, m, -1);
        }

        INA(int n, int m, int t) throws IOException {
            a = new int[m][n];

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

        int[] get(int i) {
            return a[i - 1];
        }
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8404
//
// author  : Abhishek
//
#include <bits/stdc++.h>
#include<chrono>

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;
using namespace chrono;

const ll MOD = 1000000007;
const ll N = 300005;  // array size
const ll inf = 10000000000000000;
const db PI = 3.14159265358979323846264338327950288419716939937510;

void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

void print(vector<pair<ll, ll> > v) {
    ll i;
    fo(i, v.size()) {
        cout << v[i].first << " " << v[i].second << "\n";
    }
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}

ll n, m;

vector<ll> adj[N];
vector<ll> vis(N + 1);
vector<ll> dp(N + 1, 0);

void dfs(ll cur) {
    vis[cur] = 1;
    ll mx = -1;
    for (auto next: adj[cur]) {
        if (!vis[next]) {
            dfs(next);
            mx = max(mx, dp[next]);
        } else {
            mx = max(mx, dp[next]);
        }
    }

    dp[cur] = mx + 1;
}

void solve() {
    ll t = 1;
//    cin >> (t);
    while (t--) {

        ll i, j, k, p, q, x, y, a, b, l, r;
        cin >> n >> m;
        if(n==m){
            cout<<"Yes\n";
        } else {
            cout<<"No\n";
        }

    }
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif

    auto start = high_resolution_clock::now();

    solve();

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif


    return 0;
}




Measured memory_bytes: 15044
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**9)

# input = stdin.readline


def isPrime(x):
  f = 2
  while f * f <= x:
    if x % f == 0:
      return False
    f += 1
  return True

def solve(k):
  x = 0
  maxVal =  k
  for i in range(maxVal):
    x += 7*pow(10,i,k)
    x %= k
    if x == 0:
      return i+1
  return -1



def main():
  K = int(input())
  # N,M = map(int,input().split())
  # a = list(map(int,input().split()))
  print(solve(K))
  return

if __name__ == '__main__':
  main()


Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, K; cin >> N >> K;

	vector<int> a(26, 0);
	rep (i, N){
		string s; cin >> s;
		++a[(int)(s[0] - 'A')];
	} // end rep

	sort(ALL(a), greater<int>());

	vector<int> part(K, 0);
	rep (i, K) part[i] = a[i];

	vector<int> remain(26, 0);
	for (int i = K; i < 26; ++i){
		remain[i] = a[i];
	} // end for

	int sum = accumulate(ALL(remain), 0);

	int i = 0;
	while(sum > 0){
		sort(ALL(part));
		++part[0];
		while(remain[i] == 0) ++i;
		--remain[i];
		sum = accumulate(ALL(remain), 0);
		++i;
		if (26 - K <= i) i = 0;
	} // end while

	sort(ALL(part));
	int res = part[0];
	cout << res << endl;			
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
using ll = long long;
using namespace std;
int main(){
    int n,a,b;
    cin >> n >>a >> b;
    if(abs(a-b)%2==0){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Borys"<<endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        if (str.charAt(2) == str.charAt(3) && str.charAt(4) == str.charAt(5)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

int main(){
  int N;
  cin>>N;
  vector<pair<int,int>> X(N);
  for(int i=0;i<N;i++){
    int j;
    cin>>j;
    X[i]=make_pair(j,i);
  }
  sort(X.begin(),X.end());
  map<int,int> A;
  for(int i=0;i<N;i++){
    if(i<N/2)
      A[X[i].second]=X[N/2].first;
    else
      A[X[i].second]=X[N/2-1].first;
  }
  for(int i=0;i<N;i++)
    cout<<A[i]<<endl;
}

Measured memory_bytes: 13312
#include <iostream>
#include <algorithm>
using namespace std;
long long a[3];
int main() {
	cin>>a[0]>>a[1]>>a[2];
	sort(a, a+3);
	cout<<(a[0]%2 && a[1]%2 && a[2]%2 ? a[0]*a[1]:0);
	return 0;
}

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

using namespace std;

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

    if((N[0]==N[1]&&N[1]==N[2]) || (N[1]==N[2]&&N[2]==N[3])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
/**************************************************************************
Coded by: Saba Karimi(_VINTAGE)
Institution: AIT PUNE
***************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
/**************************************************************************/
signed main()
{
    fast;
    int n,W;
    cin>>n>>W;
    int w[n+1],v[n+1];
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];
    int dp[n+1][W+1]={};
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=W;j++)
        {
            if(w[i]<=j)
            {
                dp[i][j] = max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
            }
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[n][W];
}

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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
#define BIG(c) (c)-0x20
#define SMALL(c) (c)+0x20
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int N, K;
      string S;
      cin >> N >> K >> S;
      S[K-1] = SMALL(S[K-1]);
      cout << S << endl;
}


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

 	ll mod = 998244353;
 	int arr[200001];
	int main() {

		#ifndef ONLINE_JUDGE
	        freopen("input.txt","r",stdin);
	        // freopen("output.txt","w",stdout);
	    #endif
	    ios::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	   	int n;
	   	cin>>n;
	  	for(int i=0;i<n;i++){
	  		cin>>arr[i];
	  	}
	  	sort(arr,arr+n,greater<int>());

	  	queue<int> q;
	  	q.push(arr[0]);
	   	ll comfort=0;
	   	for(int i=1;i<n;i++){
	   		comfort+=q.front();
	   		// cout<<q.front()<<endl;
	   		q.pop();
	   		q.push(arr[i]);
	   		q.push(arr[i]);
	   	}
	   	cout<<comfort<<endl;
	}


Measured memory_bytes: 4840
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=(1<<18)+233;
int n,m,a[N];
multiset<int> s;
vector<int> b;
int main() {
	rd(n); m=1<<n;
	for(int i=1;i<=m;++i) rd(a[i]),s.insert(a[i]);
	multiset<int>::iterator it=s.end();
	b.push_back(*(--it)); s.erase(it);
	for(int i=1;i<=n;++i) {
		for(int j=0;j<(1<<i-1);++j) {
			it=s.lower_bound(b[j]);
			if(it==s.begin()) {
				printf("No");
				return 0;
			}
			it--;
			b.push_back(*it); s.erase(it);
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 14716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

#define M 20

struct Con{
    ll a;
    ll x[M],y[M];
};


int main(){fastio
    ll n;cin>>n;
    Con c[n+1];
    rep(i,1,n){
        cin>>c[i].a;
        rep(j,0,c[i].a-1)cin>>c[i].x[j]>>c[i].y[j];
    }
    ll ans=0;
    rep(i,1,(1<<n)-1){
        bool per[n+1];
        rep(j,0,n-1){
            if((i>>j)&1)per[j+1]=1;
            else per[j+1]=0;
        }
        bool flag=true;
        rep(j,1,n){
            if(per[j]==0)continue;
            rep(k,0,c[j].a-1){
                if(per[c[j].x[k]]!=c[j].y[k])flag=false;
            }
        }
        if(flag){
            ll sum=0;rep(j,1,n)if(per[j])sum++;
            Max(ans,sum);
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
/*
       ()       ()()()()     ()        ()       ()        ()        ()
      ()()      ()     ()    ()()      ()      ()()       ()()      ()
     ()  ()     ()      ()   ()  ()    ()     ()  ()      ()  ()    ()
    ()()()()    ()      ()   ()    ()  ()    ()()()()     ()    ()  ()
   ()      ()   ()     ()    ()      ()()   ()      ()    ()      ()()
  ()        ()  ()()()()     ()        ()  ()        ()   ()        ()

*/
#include <bits/stdc++.h>
#define MOD  (int)(1e9+7)
#define SIZE (int)(1e5+5)
#define all(x) x.begin(),x.end()
#define si(i)  scanf("%d",&i)
#define sf(f)  scanf("%f",&f)
#define pi(i)  printf("%d",i)
#define pd(d)  printf("%lf",d)
#define deb(x) cout<<#x<<" is "<<x<<"\n";
#define lb     lower_bound
#define ub     upper_bound
#define pb     push_back
#define prDouble(x) cout<<fixed<<setprecision(10)<<x;
#define IOfast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

int64_t exponentiation(int64_t base,int exp)
{
    if (exp == 0)
        return 1;

    if (exp == 1)
        return base;

    int64_t t = exponentiation(base, exp / 2);

    t = (t * t);

    if (exp % 2 == 0)
        return t;
    else
        return base * t;
}

//int in_between;
//vector <int> index[26];
int64_t dp[401][401]; 

int64_t solve(vector<int64_t>& arr,int i,int j)
{
  if(i == j)
    return 0;
  if(dp[i][j] !=-1)
    return dp[i][j];
  int64_t sum=accumulate(arr.begin()+i,arr.begin()+j+1,(int64_t)0);
  
  int64_t ans = LLONG_MAX;

  for(int k=i;k<j;k++)
     ans = min( solve(arr,i,k) + solve(arr,k+1,j),ans);
  ans+=sum;
  return dp[i][j]=ans;     
}



//int arr[(int)1e3+1][(int)1e3+1]; 
int main()
{
  IOfast;
  int q=1;
  //cin>>q;
  memset(dp,-1,sizeof(dp));
  while(q--)
  {   
      int n;
      cin>>n;
      vector<int64_t> arr(n);      
      for(auto  &item:arr) cin>>item;
      cout<<solve(arr,0,n-1); 
  }
  
  return 0;
}


Measured memory_bytes: 1536
S = input()
Mylist = list(S)
Rlist = ["R","U","D"]
Llist = ["L","U","D"]
ANSlist = []
for i in range(1,len(Mylist)+1):
    if i%2 == 1:
        if Mylist[i-1] in Rlist:
            ANSlist.append("Y")
    if i%2 == 0:
        if Mylist[i-1] in Llist:
            ANSlist.append("Y")

if len(ANSlist) == len(Mylist):
    
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(integer i=0;i<(integer)(n);i++)

typedef long long int integer;
typedef pair<integer,integer> P;
const int MAX = 5004;

int acc[MAX + 8][MAX + 8];
int trecd[MAX + 8][MAX + 8];

int main() {
  integer n, m;
  cin >> n >> m;
  vector<integer> xs, ys;
  vector<P> treasures(n);
  for (P &p : treasures) {
    cin >> p.first >> p.second;
    xs.push_back(p.first);
    ys.push_back(p.second);
  }
  sort(xs.begin(), xs.end());
  xs.erase(unique(xs.begin(), xs.end()), xs.end());
  sort(ys.begin(), ys.end());
  ys.erase(unique(ys.begin(), ys.end()), ys.end());
  vector<integer> rxs = xs, rys = ys;
  reverse(rxs.begin(), rxs.end());
  for (integer &rx : rxs) rx = -rx;
  reverse(rys.begin(), rys.end());
  for (integer &ry : rys) ry = -ry;

  for (P p : treasures) {
    integer x = find(xs.begin(), xs.end(), p.first) - xs.begin() + 1;
    integer y = find(ys.begin(), ys.end(), p.second) - ys.begin() + 1;
    trecd[x][y]++;
  }
  
  for (integer y = 1; y < MAX; y++) for (integer x = 1; x < MAX; x++) {
    acc[x][y] = acc[x][y-1] + acc[x-1][y] - acc[x-1][y-1] + trecd[x][y];
  }

  REP (i, m) {
    integer xb, yb, xe, ye;
    cin >> xb >> yb >> xe >> ye;
    xb = lower_bound(xs.begin(), xs.end(), xb) - xs.begin() + 1;
    yb = lower_bound(ys.begin(), ys.end(), yb) - ys.begin() + 1;
    xe = rxs.end() - lower_bound(rxs.begin(), rxs.end(), -xe);
    ye = rys.end() - lower_bound(rys.begin(), rys.end(), -ye);
    integer ans = acc[xe][ye] - acc[xb-1][ye] - acc[xe][yb-1] 
      + acc[xb-1][yb-1];
    cout << ans << endl;
  }
}

Measured memory_bytes: 195880
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <unordered_map>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll N, a;
    bool can=true;
    unordered_map<ll, int> ma;
    cin>>N;
    rep(i, N){
        cin>>a;
        if(ma[a]!=0) can=false;
        else ma[a]=1;
    }
    cout<<(can ? "YES" : "NO")<<endl;
    return 0;
}


Measured memory_bytes: 8520
n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1]*(n+1)
A = [0]*q
U = 10**6
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted(r*U+i for i, (l, r) in enumerate(LR))
B = [0]*(1<<n.bit_length())
def add(i, a):
  while i <= n:
    B[i] += a
    i += i & -i
def acc(i):
  res = 0
  while i:
    res += B[i]
    i -= i & -i
  return res
temp = 1
for w in W:
  r, i = divmod(w, U)
  while temp <= r:
    c = C[temp]
    add(temp, 1)
    if D[c] != -1:
      add(D[c], -1)
    D[c] = temp
    temp += 1
  l = LR[i][0]
  A[i] = acc(r) - acc(l-1)
print(*A, sep="\n")

Measured memory_bytes: 243576
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int c[20];
int getsize(){
	int ret;
	for(ret=20;c[ret]==0;)ret--;
	ret++;
	return ret;
}
int main(void){
	int k;
	cin>>k;
	memset(c,(int)0,sizeof(c));
	REP(i,k){
		c[0]++;
		int _size=getsize();
		int a=-1;
//		cout<<_size<<' ';
		FORN(j,1,_size){
			if(abs(c[j]-c[j-1])>1){
				c[j]++;
				c[j-1]=-1;
				a=j;
			}
			else if(c[j-1]>=10){
				c[j]++;
				c[j-1]=-1;
				a=j;
			}
			else{
				break;
			}
		}
		if(c[_size-1]>=10){
			c[_size]=1;
			a=_size;
		}
//		cout<<a<<' ';
		for(int j=a-1;j>=0;j--){
			c[j]=max(c[j+1]-1,0);
		}
		
//		REP(i,_size)cout<<c[i];
//		cout<<endl;
	} 
	/*string s="";
	REP(i,20){
		s=num[c[i]]+s;
		cout<<c[i];
	}
	cout<<endl;
	int it=0;
	while(s[it]!=0)it++;
	cout<<it<<endl;
	cout<<s<<endl;
//	cout<<s.substr(it,s.size()-it+1);*/
	int len=getsize();
//	cout<<len<<endl;
	REP(i,len){
		cout<<c[len-i-1];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 384
import sys
from collections import deque
input = sys.stdin.readline

H, W = map(int, input().split())

m = [[0 for _ in range(W)] for _ in range(H)]
black = []
for i in range(H):
    # m.append(list(map(lambda x: 0 if x=="#" else 1, input()))）
    for j, c in enumerate(input()):
        if c == "#":
            m[i][j] = 1
            black.append((i, j, 0))

# print(m)
# print(root)

queue = deque(black)
queue_append = queue.append
ans = 0
while queue:
    p = queue.popleft()
    if ans < p[2]:
        ans += 1
    for i, j in ((-1, 0), (1, 0), (0, 1), (0, -1)):
        next_p = (p[0] + i, p[1] + j)
        if (0 <= next_p[0] < H) and (0 <= next_p[1] < W):
            if not m[next_p[0]][next_p[1]]:
                m[next_p[0]][next_p[1]] = 1
                queue_append((next_p[0], next_p[1], ans+1))
print(ans)


Measured memory_bytes: 138712
/// @file
/// @version Wrong Answer.
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(auto&x:a)cin>>x;
  
  int n_actions0=0;  // when even elements are positive.
  {
    int sum=0;
    for(int i=0;i<a.size();++i){
      bool want_positive=i%2==0;
      sum+=a[i];
      if(want_positive&&sum>0)continue;
      if(!want_positive&&sum<0)continue;
      n_actions0+=abs(sum)+1;
      sum=want_positive?1:-1;
    }
  }
  
  int n_actions1=0;  // when odd elements are positive.
  {
    int sum=0;
    for(int i=0;i<a.size();++i){
      bool want_positive=i%2!=0;
      sum+=a[i];
      if(want_positive&&sum>0)continue;
      if(!want_positive&&sum<0)continue;
      n_actions1+=abs(sum)+1;
      sum=want_positive?1:-1;
    }
  }
  
  cout<<min(n_actions0,n_actions1)<<endl;
}


Measured memory_bytes: 1024
S = input()
res = "Yes"
if "N" in S:
    if "S" not in S:
        res = "No"
if "W" in S:
    if "E" not in S:
        res = "No"
if "S" in S:
    if "N" not in S:
        res = "No"
if "E" in S:
    if "W" not in S:
        res = "No"
print(res)

Measured memory_bytes: 3060
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef long long ll;
#define sz(a) int((a).size());
#define pb push_back;
#define all(c) c.begin(),c.end();
#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());


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    int a[n+1];
    int b[n+1]={0};
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int p,q;
    int c=n;
    for(int i=1;i<=m;i++){
        cin>>p>>q;
        if(a[p]<=a[q]){
            if(b[p]==0){
                c--;
                b[p]=1;
            }
        }
        if(a[q]<=a[p]){
            if(b[q]==0){
                b[q]=1;
                c--;
            }
        }
    }
    cout<<max(0,c);
	return 0;
}


Measured memory_bytes: 4420
#include <iostream>
#include <string>

using namespace std;

int solve(string);

int a, b, c;

int main()
{
	int n, sum;
	string s;
	while(cin >> n, n)
	{
		a = 1;
		b = 2;
		c = 3;
		sum = 1;
		while(n--)
		{
			cin >> s;
			sum+=solve(s);
		}
		cout << sum << endl;
	}
}


int solve(string s)
{
	int tmp;
	if(s == "North")
	{
		tmp = a;
		a = b;
		b = 7 - tmp;
	}
	else if(s == "East")
	{
		tmp = c;
		c = a;
		a = 7 - tmp;
	}
	else if(s == "West")
	{
		tmp = a;
		a = c;
		c = 7 - tmp;
	}
	else if(s == "South")
	{
		tmp = b;
		b = a;
		a = 7 - tmp;
	}
	else if(s == "Right")
	{
		tmp = b;
		b = c;
		c = 7 - tmp;
	}
	else if(s == "Left")
	{
		tmp = c;
		c = b;
		b = 7 - tmp;
	}
	return a;
}

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

int main(void){
  int N;
  double sum=0.0;
  vector<double> vec(110);
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> vec[i];
    sum+=1.0/vec[i];
  }
  cout << fixed << setprecision(15);
  cout << 1.0/sum << endl;
}

Measured memory_bytes: 256
from itertools import product

def solve():
    N = int(input())
    graph = {i: [] for i in range(1, N+1)}
    for i in range(N): 
        A = int(input())
        for _ in range(A):
            x,y = map(int, input().split())
            graph[i+1].append((x,y))
            
    def dfs(nodes):
        searched = [-1] * N
        stack = [i+1 for i,node in enumerate(nodes) if node == 1]
        ret_len = len(stack)
        
        while stack:
            node = stack.pop(0)
            for x,y in graph[node]:
                if nodes[x-1] != y: return -1
                if searched[x-1] == -1:
                    searched[x-1] = y
                    if y == 1: stack.append(x)
                        
        # print(nodes, searched)
        return ret_len
                    
        
    ret = 0
    for nodes in product([0,1], repeat=N):
        ret = max(ret, dfs(nodes))
        
    print(ret)
    
solve()

Measured memory_bytes: 9104
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	long long aa, bb, cc, a, b, c, ct;
	cin >> aa >> bb >> cc;

	ct = 0;
	while ((aa % 2 == 0) && (bb % 2 == 0) && (cc % 2 == 0)) {
		if ((aa == bb) && (bb == cc)) break;
		ct++;
		a = bb / 2 + cc / 2;
		b = aa / 2 + cc / 2;
		c = aa / 2 + bb / 2;
		aa = a; bb = b; cc = c;
	}

	if ((aa == bb) && (bb == cc) && (aa % 2 == 0)) cout << "-1\n";
	else cout << ct << "\n";

	return 0;
}



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

#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    int n;
    ll k; 
    cin >> n >> k;
    vector<int> a(n);
    vector<int> f(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> f[i];
    sort(a.begin(), a.end());
    sort(f.rbegin(), f.rend());
    ll l = -1, r = 1e12;
    while(l+1 < r){
        ll c = (l+r) / 2;
        ll sum = 0;
        rep(i,n)sum += max(0ll, (a[i] - c/f[i]));
        if(sum <= k)r = c;
        else l = c;
    }
    cout << r << endl;
}

Measured memory_bytes: 1920
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n; cin >> n;
    bool hasY = false;
    for (int i = 0; i < n; ++i)  {
        char a; cin >> a;
        if (a == 'Y') hasY = true;
    }

    cout << (hasY ? "Four" : "Three") << endl;    
}

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

const int M = 1000005;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> cnt(M);
  for (int x : a) {
    if (cnt[x] != 0) {
      cnt[x] = 2;
      continue;
    }
    for (int i = x; i < M; i += x)cnt[i]++;
  }
  int ans = 0;
  for (int x : a) {
    if (cnt[x] == 1)ans++;
  }
  cout << ans << endl;
  return 0;
}

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

namespace ABC043A
{
    class Program
    {

        static void Main(string[] args)
        {
            int n, s;

            s = 0;
            n = int.Parse(Console.ReadLine());

            for (int i = 1; i <= n; i++)
            {
                s = s + i;
            }

            Console.WriteLine(s);

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < n;i++)
 
int main(){
 
    string s;
    cin >> s;
    if(s.at(2)==s.at(3) && s.at(4)==s.at(5)){
        cout << "Yes" << endl;
    }
    
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

string s;
LL n;
LL to0[7] = {2,4,0,0,6,5,4},to1[7] = {3,5,0,1,1,5,4}; 
LL dp[7][300005];

int main(){
	cin >> s; n = s.length(); s = ' ' + s;
	dp[0][1] = (s[1] != '1'); dp[1][1] = (s[1] != '0');
	for(LL i = 2;i <= n;i ++){
		for(LL j = 0;j < 7;j ++){
			if(s[i] != '0') dp[to1[j]][i] = (dp[to1[j]][i] + dp[j][i - 1]) % N;
			if(s[i] != '1') dp[to0[j]][i] = (dp[to0[j]][i] + dp[j][i - 1]) % N;
		}
	}
	cout << (dp[1][n] + dp[5][n]) % N << '\n';
	return 0;
}
//

Measured memory_bytes: 17116